Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions app/Http/Controllers/Api/VideoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use App\Jobs\Federation\DeliverUndoCommentReplyLikeActivity;
use App\Jobs\Federation\DeliverUndoVideoLikeActivity;
use App\Jobs\Federation\DeliverVideoLikeActivity;
use App\Jobs\PushNotifications\SendPushNotificationJob;
//use App\Jobs\PushNotifications\SendPushNotificationJob;
use App\Jobs\Video\VideoCustomThumbnailJob;
use App\Jobs\Video\VideoOptimizeJob;
use App\Jobs\Video\VideoProcessingCompleteJob;
Expand Down Expand Up @@ -455,15 +455,15 @@ public function like(Request $request, $id)

app(LikeService::class)->addVideoLike((string) $video->id, (string) $pid);

if (app(ConfigService::class)->pushNotifications()) {
/*if (app(ConfigService::class)->pushNotifications()) {
if ($pid != $video->profile_id && ! $video->uri) {
SendPushNotificationJob::dispatch_newVideoLike(
profileId: $video->profile_id,
videoId: $video->id,
actorId: $pid,
);
}
}
}*/

if ($video->uri) {
$config = app(ConfigService::class);
Expand Down Expand Up @@ -635,7 +635,7 @@ public function storeComment(StoreCommentRequest $request, $vid)
app(FederationDispatcher::class)->dispatchCommentReplyCreation($comment);
}

if ($config->pushNotifications()) {
/*if ($config->pushNotifications()) {
if ($pid != $parent->profile_id && $pid != $video->profile_id) {
SendPushNotificationJob::dispatch_newVideoCommentReply(
profileId: $parent->profile_id,
Expand All @@ -644,7 +644,7 @@ public function storeComment(StoreCommentRequest $request, $vid)
commentId: $comment->id,
);
}
}
}*/
} else {
$comment = new Comment;
$comment->video_id = $vid;
Expand All @@ -661,7 +661,7 @@ public function storeComment(StoreCommentRequest $request, $vid)
app(FederationDispatcher::class)->dispatchCommentCreation($comment);
}

if ($config->pushNotifications()) {
/*if ($config->pushNotifications()) {
if ($pid != $video->profile_id) {
SendPushNotificationJob::dispatch_newVideoComment(
profileId: $video->profile_id,
Expand All @@ -670,7 +670,7 @@ public function storeComment(StoreCommentRequest $request, $vid)
commentId: $comment->id,
);
}
}
}*/
}

$video->recalculateCommentsCount();
Expand Down Expand Up @@ -729,14 +729,14 @@ public function storeCommentMedia(StoreCommentMediaRequest $request, $vid)
if ($config->federation()) {
app(FederationDispatcher::class)->dispatchCommentCreation($comment);
}
if ($config->pushNotifications() && $pid != $video->profile_id) {
/*if ($config->pushNotifications() && $pid != $video->profile_id) {
SendPushNotificationJob::dispatch_newVideoComment(
profileId: $video->profile_id,
videoId: $video->id,
actorId: $pid,
commentId: $comment->id,
);
}
}*/

CommentKlipyMediaShareTriggerJob::dispatch((string) $klipyId, $type, (string) $user->id);

Expand Down
45 changes: 45 additions & 0 deletions app/Services/NotificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

namespace App\Services;

use App\Jobs\PushNotifications\SendPushNotificationJob;
use App\Models\Notification;
use App\Models\StarterKit;
use App\Models\Video;
use App\Services\ConfigService;
use Illuminate\Support\Facades\Cache;

class NotificationService
Expand Down Expand Up @@ -68,6 +71,15 @@ public static function newVideoLike($uid, $vid, $pid)
]);
self::clearUnreadCount($uid);

$video = Video::find($vid);
if (app(ConfigService::class)->pushNotifications() && $pid != $video->profile_id && ! $video->uri) {
SendPushNotificationJob::dispatch_newVideoLike(
profileId: $uid,
videoId: $vid,
actorId: $pid,
);
}

return $res;
}

Expand Down Expand Up @@ -155,6 +167,13 @@ public static function newFollower($uid, $pid)

self::clearUnreadCount($uid);

if (app(ConfigService::class)->pushNotifications()) {
SendPushNotificationJob::dispatch_newFollow(
profileId: $uid,
actorId: $pid,
);
}

return $res;
}

Expand Down Expand Up @@ -221,6 +240,15 @@ public static function newVideoComment($pid, $uid, $vid, $cid)
]);
self::clearUnreadCount($uid);

if (app(ConfigService::class)->pushNotifications()) {
SendPushNotificationJob::dispatch_newVideoComment(
profileId: $uid,
videoId: $vid,
actorId: $pid,
commentId: $cid,
);
}

return $res;
}

Expand Down Expand Up @@ -277,6 +305,15 @@ public static function newVideoCommentReply($pid, $uid, $vid, $cid, $crid)
]);
self::clearUnreadCount($uid);

if (app(ConfigService::class)->pushNotifications()) {
SendPushNotificationJob::dispatch_newVideoCommentReply(
profileId: $uid,
videoId: $vid,
actorId: $pid,
commentId: $cid,
);
}

return $res;
}

Expand Down Expand Up @@ -307,6 +344,14 @@ public static function newVideoShare($uid, $vid, $pid)
]);
self::clearUnreadCount($uid);

if (app(ConfigService::class)->pushNotifications()) {
SendPushNotificationJob::dispatch_newRepost(
profileId: $uid,
videoId: $vid,
actorId: $pid,
);
}

return $res;
}

Expand Down
Loading