mirror of
https://github.com/friendica/friendica
synced 2024-11-19 01:03:40 +00:00
Support for desktop notifications for reshared posts
This commit is contained in:
parent
35e2ae3925
commit
8bb2c9fc13
2 changed files with 19 additions and 2 deletions
|
@ -257,8 +257,12 @@ class UserNotification
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($notification_type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only create notifications for posts and comments, not for activities
|
// Only create notifications for posts and comments, not for activities
|
||||||
if (empty($notification_type) || !in_array($item['gravity'], [GRAVITY_PARENT, GRAVITY_COMMENT])) {
|
if (($item['gravity'] == GRAVITY_ACTIVITY) && ($item['verb'] != Activity::ANNOUNCE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +284,7 @@ class UserNotification
|
||||||
*/
|
*/
|
||||||
private static function insertNotificationByItem(int $type, int $uid, array $item): void
|
private static function insertNotificationByItem(int $type, int $uid, array $item): void
|
||||||
{
|
{
|
||||||
if (($item['gravity'] == GRAVITY_ACTIVITY) &&
|
if (($item['verb'] != Activity::ANNOUNCE) && ($item['gravity'] == GRAVITY_ACTIVITY) &&
|
||||||
!in_array($type, [self::TYPE_DIRECT_COMMENT, self::TYPE_DIRECT_THREAD_COMMENT])) {
|
!in_array($type, [self::TYPE_DIRECT_COMMENT, self::TYPE_DIRECT_THREAD_COMMENT])) {
|
||||||
// Activities are only stored when performed on the user's post or comment
|
// Activities are only stored when performed on the user's post or comment
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -153,6 +153,8 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
|
||||||
$title = '';
|
$title = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->logger->debug('Got verb and type', ['verb' => $Notification->verb, 'type' => $Notification->type]);
|
||||||
|
|
||||||
switch ($Notification->verb) {
|
switch ($Notification->verb) {
|
||||||
case Activity::LIKE:
|
case Activity::LIKE:
|
||||||
switch ($Notification->type) {
|
switch ($Notification->type) {
|
||||||
|
@ -182,6 +184,17 @@ class Notification extends BaseFactory implements ICanCreateFromTableRow
|
||||||
case Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT:
|
case Post\UserNotification::TYPE_DIRECT_THREAD_COMMENT:
|
||||||
$msg = $userL10n->t('%1$s shared your post %2$s');
|
$msg = $userL10n->t('%1$s shared your post %2$s');
|
||||||
break;
|
break;
|
||||||
|
case Post\UserNotification::TYPE_SHARED:
|
||||||
|
if (($causer['id'] != $author['id']) && ($title != '')) {
|
||||||
|
$msg = $userL10n->t('%1$s shared the post %2$s from %3$s');
|
||||||
|
} elseif ($causer['id'] != $author['id']) {
|
||||||
|
$msg = $userL10n->t('%1$s shared a post from %3$s');
|
||||||
|
} elseif ($title != '') {
|
||||||
|
$msg = $userL10n->t('%1$s shared the post %2$s');
|
||||||
|
} else {
|
||||||
|
$msg = $userL10n->t('%1$s shared a post');
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Activity::POST:
|
case Activity::POST:
|
||||||
|
|
Loading…
Reference in a new issue