Browse Source

Update StoryController, add StoryIndexService s markSeen support for webUI endpoint

Daniel Supernault 3 weeks ago
parent
commit
44914a5143
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/Http/Controllers/StoryController.php

+ 4 - 0
app/Http/Controllers/StoryController.php

@@ -7,6 +7,7 @@ use App\Profile;
 use App\Services\AccountService;
 use App\Services\FollowerService;
 use App\Services\PollService;
+use App\Services\StoryIndexService;
 use App\Services\StoryService;
 use App\Services\UserRoleService;
 use App\Story;
@@ -183,6 +184,7 @@ class StoryController extends StoryComposeController
         $authed = $user->profile;
 
         $story = Story::with('profile')
+            ->whereActive(true)
             ->findOrFail($id);
         $exp = $story->expires_at;
 
@@ -202,6 +204,8 @@ class StoryController extends StoryComposeController
 
         if ($v->wasRecentlyCreated) {
             Story::findOrFail($story->id)->increment('view_count');
+            $index = app(StoryIndexService::class);
+            $index->markSeen($authed->id, $story->profile_id, $story->id, $story->created_at);
 
             if ($story->local == false) {
                 StoryViewDeliver::dispatch($story, $authed)->onQueue('story');