1
1
Fork 0

Don't lose ownership on forum posting

This commit is contained in:
Michael 2021-06-05 06:13:10 +00:00
parent 86d56c7f57
commit 98c314599c
2 changed files with 21 additions and 17 deletions

View file

@ -40,6 +40,7 @@ use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\APContact;
use Friendica\Model\Attach; use Friendica\Model\Attach;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Conversation; use Friendica\Model\Conversation;
@ -438,18 +439,24 @@ function item_post(App $a) {
// we tagged a forum in a top level post. Now we change the post // we tagged a forum in a top level post. Now we change the post
$private = $private_forum; $private = $private_forum;
$str_group_allow = ''; if ($only_to_forum) {
$str_contact_deny = ''; $postopts = '';
$str_group_deny = ''; }
if ($private_forum) {
$str_contact_allow = '<' . $private_id . '>'; if ($private_forum || !APContact::getByURL($forum_contact['url'])) {
} else { $str_group_allow = '';
$str_contact_allow = ''; $str_contact_deny = '';
$str_group_deny = '';
if ($private_forum) {
$str_contact_allow = '<' . $private_id . '>';
} else {
$str_contact_allow = '';
}
$contact_id = $private_id;
$contact_record = $forum_contact;
$_REQUEST['origin'] = false;
$wall = 0;
} }
$contact_id = $private_id;
$contact_record = $forum_contact;
$_REQUEST['origin'] = false;
$wall = 0;
} }
/* /*

View file

@ -1061,7 +1061,7 @@ class Item
} }
// Create Diaspora signature // Create Diaspora signature
if ($item['origin'] && empty($item['diaspora_signed_text'])) { if ($item['origin'] && empty($item['diaspora_signed_text']) && ($item['gravity'] != GRAVITY_PARENT)) {
$signed = Diaspora::createCommentSignature($uid, $item); $signed = Diaspora::createCommentSignature($uid, $item);
if (!empty($signed)) { if (!empty($signed)) {
$item['diaspora_signed_text'] = json_encode($signed); $item['diaspora_signed_text'] = json_encode($signed);
@ -1227,13 +1227,10 @@ class Item
Logger::info('The resharer is no forum: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]); Logger::info('The resharer is no forum: quit', ['resharer' => $item['author-id'], 'owner' => $parent['owner-id'], 'author' => $parent['author-id'], 'uid' => $item['uid']]);
return; return;
} }
self::update(['post-reason' => self::PR_ANNOUNCEMENT, 'causer-id' => $item['author-id']], ['id' => $parent['id']]);
Logger::info('Set announcement post-reason', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
return;
} }
self::update(['owner-id' => $item['author-id'], 'contact-id' => $cid], ['id' => $parent['id']]); self::update(['post-reason' => self::PR_ANNOUNCEMENT, 'causer-id' => $item['author-id']], ['id' => $parent['id']]);
Logger::info('Change owner of the parent', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid'], 'owner-id' => $item['author-id'], 'contact-id' => $cid]); Logger::info('Set announcement post-reason', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
} }
/** /**