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: case ItemModel::PR_DISTRIBUTE:
$row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('Distributed')]; $row['direction'] = ['direction' => 6, 'title' => $this->l10n->t('Distributed')];
break; break;
case ItemModel::PR_PUSHED:
$row['direction'] = ['direction' => 1, 'title' => $this->l10n->t('Pushed to us')];
break;
} }
$row['thr-parent-row'] = $thr_parent; $row['thr-parent-row'] = $thr_parent;

View file

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

View file

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

View file

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