mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update Notification logic, remove message and rendered fields
This commit is contained in:
parent
eb5bb9fede
commit
6cdb5bc672
12 changed files with 4 additions and 41 deletions
|
@ -368,8 +368,6 @@ class DirectMessageController extends Controller
|
||||||
$notification->profile_id = $recipient->id;
|
$notification->profile_id = $recipient->id;
|
||||||
$notification->actor_id = $profile->id;
|
$notification->actor_id = $profile->id;
|
||||||
$notification->action = 'dm';
|
$notification->action = 'dm';
|
||||||
$notification->message = $dm->toText();
|
|
||||||
$notification->rendered = $dm->toHtml();
|
|
||||||
$notification->item_id = $dm->id;
|
$notification->item_id = $dm->id;
|
||||||
$notification->item_type = "App\DirectMessage";
|
$notification->item_type = "App\DirectMessage";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
|
|
@ -328,8 +328,6 @@ class StoryApiV1Controller extends Controller
|
||||||
$n->item_id = $dm->id;
|
$n->item_id = $dm->id;
|
||||||
$n->item_type = 'App\DirectMessage';
|
$n->item_type = 'App\DirectMessage';
|
||||||
$n->action = 'story:comment';
|
$n->action = 'story:comment';
|
||||||
$n->message = "{$request->user()->username} commented on story";
|
|
||||||
$n->rendered = "{$request->user()->username} commented on story";
|
|
||||||
$n->save();
|
$n->save();
|
||||||
} else {
|
} else {
|
||||||
StoryReplyDeliver::dispatch($story, $status)->onQueue('story');
|
StoryReplyDeliver::dispatch($story, $status)->onQueue('story');
|
||||||
|
|
|
@ -442,8 +442,6 @@ class StoryComposeController extends Controller
|
||||||
$n->item_id = $dm->id;
|
$n->item_id = $dm->id;
|
||||||
$n->item_type = 'App\DirectMessage';
|
$n->item_type = 'App\DirectMessage';
|
||||||
$n->action = 'story:react';
|
$n->action = 'story:react';
|
||||||
$n->message = "{$request->user()->username} reacted to your story";
|
|
||||||
$n->rendered = "{$request->user()->username} reacted to your story";
|
|
||||||
$n->save();
|
$n->save();
|
||||||
} else {
|
} else {
|
||||||
StoryReactionDeliver::dispatch($story, $status)->onQueue('story');
|
StoryReactionDeliver::dispatch($story, $status)->onQueue('story');
|
||||||
|
@ -516,8 +514,6 @@ class StoryComposeController extends Controller
|
||||||
$n->item_id = $dm->id;
|
$n->item_id = $dm->id;
|
||||||
$n->item_type = 'App\DirectMessage';
|
$n->item_type = 'App\DirectMessage';
|
||||||
$n->action = 'story:comment';
|
$n->action = 'story:comment';
|
||||||
$n->message = "{$request->user()->username} commented on story";
|
|
||||||
$n->rendered = "{$request->user()->username} commented on story";
|
|
||||||
$n->save();
|
$n->save();
|
||||||
} else {
|
} else {
|
||||||
StoryReplyDeliver::dispatch($story, $status)->onQueue('story');
|
StoryReplyDeliver::dispatch($story, $status)->onQueue('story');
|
||||||
|
|
|
@ -94,8 +94,6 @@ class CommentPipeline implements ShouldQueue
|
||||||
$notification->profile_id = $target->id;
|
$notification->profile_id = $target->id;
|
||||||
$notification->actor_id = $actor->id;
|
$notification->actor_id = $actor->id;
|
||||||
$notification->action = 'comment';
|
$notification->action = 'comment';
|
||||||
$notification->message = $comment->replyToText();
|
|
||||||
$notification->rendered = $comment->replyToHtml();
|
|
||||||
$notification->item_id = $comment->id;
|
$notification->item_id = $comment->id;
|
||||||
$notification->item_type = "App\Status";
|
$notification->item_type = "App\Status";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
|
|
@ -97,8 +97,6 @@ class FollowPipeline implements ShouldQueue
|
||||||
$notification->profile_id = $target->id;
|
$notification->profile_id = $target->id;
|
||||||
$notification->actor_id = $actor->id;
|
$notification->actor_id = $actor->id;
|
||||||
$notification->action = 'follow';
|
$notification->action = 'follow';
|
||||||
$notification->message = $follower->toText();
|
|
||||||
$notification->rendered = $follower->toHtml();
|
|
||||||
$notification->item_id = $target->id;
|
$notification->item_id = $target->id;
|
||||||
$notification->item_type = "App\Profile";
|
$notification->item_type = "App\Profile";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
|
|
@ -84,8 +84,6 @@ class LikePipeline implements ShouldQueue
|
||||||
$notification->profile_id = $status->profile_id;
|
$notification->profile_id = $status->profile_id;
|
||||||
$notification->actor_id = $actor->id;
|
$notification->actor_id = $actor->id;
|
||||||
$notification->action = 'like';
|
$notification->action = 'like';
|
||||||
$notification->message = $like->toText($status->in_reply_to_id ? 'comment' : 'post');
|
|
||||||
$notification->rendered = $like->toHtml($status->in_reply_to_id ? 'comment' : 'post');
|
|
||||||
$notification->item_id = $status->id;
|
$notification->item_id = $status->id;
|
||||||
$notification->item_type = "App\Status";
|
$notification->item_type = "App\Status";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
|
|
@ -67,10 +67,6 @@ class MentionPipeline implements ShouldQueue
|
||||||
'action' => 'mention',
|
'action' => 'mention',
|
||||||
'item_type' => 'App\Status',
|
'item_type' => 'App\Status',
|
||||||
'item_id' => $status->id,
|
'item_id' => $status->id,
|
||||||
],
|
|
||||||
[
|
|
||||||
'message' => $mention->toText(),
|
|
||||||
'rendered' => $mention->toHtml()
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,6 @@ class SharePipeline implements ShouldQueue
|
||||||
'action' => 'share',
|
'action' => 'share',
|
||||||
'item_type' => 'App\Status',
|
'item_type' => 'App\Status',
|
||||||
'item_id' => $status->reblog_of_id ?? $status->id,
|
'item_id' => $status->reblog_of_id ?? $status->id,
|
||||||
],
|
|
||||||
[
|
|
||||||
'message' => $status->shareToText(),
|
|
||||||
'rendered' => $status->shareToHtml()
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,6 @@ class StatusReplyPipeline implements ShouldQueue
|
||||||
$notification->profile_id = $target->id;
|
$notification->profile_id = $target->id;
|
||||||
$notification->actor_id = $actor->id;
|
$notification->actor_id = $actor->id;
|
||||||
$notification->action = 'comment';
|
$notification->action = 'comment';
|
||||||
$notification->message = $status->replyToText();
|
|
||||||
$notification->rendered = $status->replyToHtml();
|
|
||||||
$notification->item_id = $status->id;
|
$notification->item_id = $status->id;
|
||||||
$notification->item_type = "App\Status";
|
$notification->item_type = "App\Status";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
|
|
@ -74,16 +74,13 @@ class MediaTagService
|
||||||
{
|
{
|
||||||
$p = $tag->status->profile;
|
$p = $tag->status->profile;
|
||||||
$actor = $p->username;
|
$actor = $p->username;
|
||||||
$message = "{$actor} tagged you in a post.";
|
|
||||||
$rendered = "<a href='/{$actor}' class='profile-link'>{$actor}</a> tagged you in a post.";
|
|
||||||
$n = new Notification;
|
$n = new Notification;
|
||||||
$n->profile_id = $tag->profile_id;
|
$n->profile_id = $tag->profile_id;
|
||||||
$n->actor_id = $p->id;
|
$n->actor_id = $p->id;
|
||||||
$n->item_id = $tag->id;
|
$n->item_id = $tag->id;
|
||||||
$n->item_type = 'App\MediaTag';
|
$n->item_type = 'App\MediaTag';
|
||||||
$n->action = 'tagged';
|
$n->action = 'tagged';
|
||||||
$n->message = $message;
|
|
||||||
$n->rendered = $rendered;
|
|
||||||
$n->save();
|
$n->save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,9 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
||||||
|
|
||||||
if($n->actor_id) {
|
if($n->actor_id) {
|
||||||
$res['account'] = AccountService::get($n->actor_id);
|
$res['account'] = AccountService::get($n->actor_id);
|
||||||
$res['relationship'] = RelationshipService::get($n->actor_id, $n->profile_id);
|
if($n->profile_id != $n->actor_id) {
|
||||||
|
$res['relationship'] = RelationshipService::get($n->actor_id, $n->profile_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($n->item_id && $n->item_type == 'App\Status') {
|
if($n->item_id && $n->item_type == 'App\Status') {
|
||||||
|
@ -66,11 +68,8 @@ class NotificationTransformer extends Fractal\TransformerAbstract
|
||||||
'comment' => 'comment',
|
'comment' => 'comment',
|
||||||
'admin.user.modlog.comment' => 'modlog',
|
'admin.user.modlog.comment' => 'modlog',
|
||||||
'tagged' => 'tagged',
|
'tagged' => 'tagged',
|
||||||
'group:comment' => 'group:comment',
|
|
||||||
'story:react' => 'story:react',
|
'story:react' => 'story:react',
|
||||||
'story:comment' => 'story:comment',
|
'story:comment' => 'story:comment',
|
||||||
'group:join:approved' => 'group:join:approved',
|
|
||||||
'group:join:rejected' => 'group:join:rejected'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if(!isset($verbs[$verb])) {
|
if(!isset($verbs[$verb])) {
|
||||||
|
|
|
@ -483,8 +483,6 @@ class Inbox
|
||||||
$notification->profile_id = $profile->id;
|
$notification->profile_id = $profile->id;
|
||||||
$notification->actor_id = $actor->id;
|
$notification->actor_id = $actor->id;
|
||||||
$notification->action = 'dm';
|
$notification->action = 'dm';
|
||||||
$notification->message = $dm->toText();
|
|
||||||
$notification->rendered = $dm->toHtml();
|
|
||||||
$notification->item_id = $dm->id;
|
$notification->item_id = $dm->id;
|
||||||
$notification->item_type = "App\DirectMessage";
|
$notification->item_type = "App\DirectMessage";
|
||||||
$notification->save();
|
$notification->save();
|
||||||
|
@ -594,9 +592,6 @@ class Inbox
|
||||||
'action' => 'share',
|
'action' => 'share',
|
||||||
'item_id' => $parent->id,
|
'item_id' => $parent->id,
|
||||||
'item_type' => 'App\Status',
|
'item_type' => 'App\Status',
|
||||||
], [
|
|
||||||
'message' => $status->replyToText(),
|
|
||||||
'rendered' => $status->replyToHtml(),
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1023,8 +1018,6 @@ class Inbox
|
||||||
$n->item_id = $dm->id;
|
$n->item_id = $dm->id;
|
||||||
$n->item_type = 'App\DirectMessage';
|
$n->item_type = 'App\DirectMessage';
|
||||||
$n->action = 'story:react';
|
$n->action = 'story:react';
|
||||||
$n->message = "{$actorProfile->username} reacted to your story";
|
|
||||||
$n->rendered = "{$actorProfile->username} reacted to your story";
|
|
||||||
$n->save();
|
$n->save();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1134,8 +1127,6 @@ class Inbox
|
||||||
$n->item_id = $dm->id;
|
$n->item_id = $dm->id;
|
||||||
$n->item_type = 'App\DirectMessage';
|
$n->item_type = 'App\DirectMessage';
|
||||||
$n->action = 'story:comment';
|
$n->action = 'story:comment';
|
||||||
$n->message = "{$actorProfile->username} commented on story";
|
|
||||||
$n->rendered = "{$actorProfile->username} commented on story";
|
|
||||||
$n->save();
|
$n->save();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue