Merge pull request #9052 from annando/fix-change-owner
Fix: Don't change the owner of your own posts
This commit is contained in:
commit
2e5b4dedb8
1 changed files with 5 additions and 4 deletions
|
@ -2009,7 +2009,8 @@ class Item
|
||||||
*/
|
*/
|
||||||
private static function setOwnerforResharedItem(array $item)
|
private static function setOwnerforResharedItem(array $item)
|
||||||
{
|
{
|
||||||
$parent = self::selectFirst(['id', 'owner-id', 'author-id', 'author-link'], ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
|
$parent = self::selectFirst(['id', 'owner-id', 'author-id', 'author-link', 'origin'],
|
||||||
|
['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
|
||||||
if (!DBA::isResult($parent)) {
|
if (!DBA::isResult($parent)) {
|
||||||
Logger::error('Parent not found', ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
|
Logger::error('Parent not found', ['uri-id' => $item['parent-uri-id'], 'uid' => $item['uid']]);
|
||||||
return;
|
return;
|
||||||
|
@ -2026,14 +2027,14 @@ class Item
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($author['contact-type'] != Contact::TYPE_COMMUNITY) && Contact::isSharing($parent['author-link'], $item['uid'])) {
|
if (($author['contact-type'] != Contact::TYPE_COMMUNITY) && (Contact::isSharing($parent['author-link'], $item['uid']) || $item['origin'])) {
|
||||||
logger::info('The parent author is a user contact: quit', ['author' => $parent['author-link'], 'uid' => $item['uid']]);
|
logger::info('The parent author is a following contact: quit', ['author' => $parent['author-link'], 'uid' => $item['uid']]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cid = Contact::getIdForURL($author['url'], $item['uid']);
|
$cid = Contact::getIdForURL($author['url'], $item['uid']);
|
||||||
if (empty($cid) || !Contact::isSharing($cid, $item['uid'])) {
|
if (empty($cid) || !Contact::isSharing($cid, $item['uid'])) {
|
||||||
logger::info('The resharer is not a user contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid']]);
|
logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid']]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue