Add more post reasons

This commit is contained in:
Michael 2022-07-29 21:28:22 +00:00
parent 0971bcf165
commit 699152e15e
4 changed files with 15 additions and 5 deletions

View file

@ -901,7 +901,9 @@ class Conversation
case ItemModel::PR_DISTRIBUTE:
$row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('Distributed')];
break;
case ItemModel::PR_PUSHED:
$row['direction'] = ['direction' => 1, 'title' => $this->l10n->t('Pushed to us')];
break;
}
$row['thr-parent-row'] = $thr_parent;

View file

@ -79,6 +79,8 @@ class Item
const PR_DIRECT = 77;
const PR_ACTIVITY = 78;
const PR_DISTRIBUTE = 79;
const PR_PUSHED = 80;
const PR_LOCAL = 81;
// system.accept_only_sharer setting values
const COMPLETION_NONE = 1;
@ -908,6 +910,10 @@ class Item
$item['post-reason'] = self::PR_FOLLOWER;
}
if ($item['origin'] && empty($item['post-reason'])) {
$item['post-reason'] = self::PR_LOCAL;
}
// Ensure that there is an avatar cache
Contact::checkAvatarCache($item['author-id']);
Contact::checkAvatarCache($item['owner-id']);

View file

@ -363,11 +363,11 @@ class Processor
if (!empty($activity['raw'])) {
$item['source'] = $activity['raw'];
$item['protocol'] = Conversation::PARCEL_ACTIVITYPUB;
}
if (isset($activity['push'])) {
$item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL;
}
}
if (!empty($activity['from-relay'])) {
$item['direction'] = Conversation::RELAY;
@ -900,6 +900,8 @@ class Processor
$item['post-reason'] = Item::PR_RELAY;
} elseif (!empty($activity['thread-completion'])) {
$item['post-reason'] = Item::PR_FETCHED;
} elseif (in_array($item['post-reason'], [Item::PR_GLOBAL, Item::PR_NONE]) && !empty($activity['push'])) {
$item['post-reason'] = Item::PR_PUSHED;
}
if ($item['isForum'] ?? false) {

View file

@ -986,7 +986,7 @@ class Receiver
}
if (!empty($reply)) {
$parents = Post::select(['uid'], ['uri' => $reply]);
$parents = Post::select(['uid'], DBA::mergeConditions(['uri' => $reply], ["`uid` != ?", 0]));
while ($parent = Post::fetch($parents)) {
$receivers[$parent['uid']] = ['uid' => $parent['uid'], 'type' => self::TARGET_ANSWER];
}