@@ -59,8 +59,7 @@ public function update(Request $request, int $commentId)
5959 'html ' => ['required ' , 'string ' ],
6060 ]);
6161
62- $ comment = $ this ->commentRepo ->getById ($ commentId );
63- $ this ->checkOwnablePermission (Permission::PageView, $ comment ->entity );
62+ $ comment = $ this ->commentRepo ->getVisibleById ($ commentId );
6463 $ this ->checkOwnablePermission (Permission::CommentUpdate, $ comment );
6564
6665 $ comment = $ this ->commentRepo ->update ($ comment , $ input ['html ' ]);
@@ -76,8 +75,7 @@ public function update(Request $request, int $commentId)
7675 */
7776 public function archive (int $ id )
7877 {
79- $ comment = $ this ->commentRepo ->getById ($ id );
80- $ this ->checkOwnablePermission (Permission::PageView, $ comment ->entity );
78+ $ comment = $ this ->commentRepo ->getVisibleById ($ id );
8179 if (!userCan (Permission::CommentUpdate, $ comment ) && !userCan (Permission::CommentDelete, $ comment )) {
8280 $ this ->showPermissionError ();
8381 }
@@ -96,8 +94,7 @@ public function archive(int $id)
9694 */
9795 public function unarchive (int $ id )
9896 {
99- $ comment = $ this ->commentRepo ->getById ($ id );
100- $ this ->checkOwnablePermission (Permission::PageView, $ comment ->entity );
97+ $ comment = $ this ->commentRepo ->getVisibleById ($ id );
10198 if (!userCan (Permission::CommentUpdate, $ comment ) && !userCan (Permission::CommentDelete, $ comment )) {
10299 $ this ->showPermissionError ();
103100 }
@@ -116,7 +113,7 @@ public function unarchive(int $id)
116113 */
117114 public function destroy (int $ id )
118115 {
119- $ comment = $ this ->commentRepo ->getById ($ id );
116+ $ comment = $ this ->commentRepo ->getVisibleById ($ id );
120117 $ this ->checkOwnablePermission (Permission::CommentDelete, $ comment );
121118
122119 $ this ->commentRepo ->delete ($ comment );
0 commit comments