Create notifications for shared posts
This commit is contained in:
parent
4b15b9fe56
commit
4ee858740e
|
@ -597,7 +597,7 @@ function check_item_notification($itemid, $uid, $notification_type) {
|
|||
$fields = ['id', 'uri-id', 'mention', 'parent', 'parent-uri-id', 'title', 'body',
|
||||
'author-link', 'author-name', 'author-avatar', 'author-id',
|
||||
'guid', 'parent-uri', 'uri', 'contact-id', 'network'];
|
||||
$condition = ['id' => $itemid, 'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'deleted' => false];
|
||||
$condition = ['id' => $itemid, 'deleted' => false];
|
||||
$item = Item::selectFirstForUser($uid, $fields, $condition);
|
||||
if (!DBA::isResult($item)) {
|
||||
return false;
|
||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Database\DBA;
|
|||
use Friendica\DI;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Model\Tag;
|
||||
use Friendica\Protocol\Activity;
|
||||
|
||||
class UserItem
|
||||
{
|
||||
|
@ -50,7 +51,8 @@ class UserItem
|
|||
*/
|
||||
public static function setNotification(int $iid)
|
||||
{
|
||||
$fields = ['id', 'uri-id', 'uid', 'body', 'parent', 'gravity', 'tag', 'contact-id', 'thr-parent', 'parent-uri', 'author-id'];
|
||||
$fields = ['id', 'uri-id', 'uid', 'body', 'parent', 'gravity', 'tag',
|
||||
'contact-id', 'thr-parent', 'parent-uri', 'author-id', 'verb'];
|
||||
$item = Item::selectFirst($fields, ['id' => $iid, 'origin' => false]);
|
||||
if (!DBA::isResult($item)) {
|
||||
return;
|
||||
|
@ -197,7 +199,7 @@ class UserItem
|
|||
*/
|
||||
private static function checkShared(array $item, int $uid)
|
||||
{
|
||||
if ($item['gravity'] != GRAVITY_PARENT) {
|
||||
if (($item['gravity'] != GRAVITY_PARENT) && ($item['verb'] != Activity::ANNOUNCE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -206,6 +208,10 @@ class UserItem
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($item['gravity'] != GRAVITY_PARENT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Or the contact is a mentioned forum
|
||||
$tags = DBA::select('tag-view', ['url'], ['uri-id' => $item['uri-id'], 'type' => [Tag::MENTION, Tag::EXCLUSIVE_MENTION]]);
|
||||
while ($tag = DBA::fetch($tags)) {
|
||||
|
|
Loading…
Reference in a new issue