Implement isContentAuthor for user profile comments
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 7 Aug 2020 11:55:20 +0000 (13:55 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 7 Aug 2020 11:58:04 +0000 (13:58 +0200)
wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php

index 29dc8a061aab21ce292c890142edd1378ec236a1..6b8cbc4648a334de400e6b19378ceccf66b0023d 100644 (file)
@@ -4,6 +4,7 @@ use wcf\data\comment\response\CommentResponse;
 use wcf\data\comment\response\CommentResponseList;
 use wcf\data\comment\Comment;
 use wcf\data\comment\CommentList;
+use wcf\data\DatabaseObjectDecorator;
 use wcf\data\object\type\ObjectTypeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\like\IViewableLikeProvider;
@@ -251,4 +252,14 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa
                        }
                }
        }
+       
+       /**
+        * @inheritDoc
+        */
+       public function isContentAuthor($commentOrResponse) {
+               if ($commentOrResponse instanceof CommentResponse || ($commentOrResponse instanceof DatabaseObjectDecorator && $commentOrResponse->getDecoratedObject() instanceof CommentResponse)) {
+                       return $commentOrResponse->userID == $commentOrResponse->getComment()->objectID;
+               }
+               return $commentOrResponse->userID == $commentOrResponse->objectID;
+       }
 }