diff options
Diffstat (limited to 'lib/public/Comments/ICommentsManager.php')
-rw-r--r-- | lib/public/Comments/ICommentsManager.php | 86 |
1 files changed, 40 insertions, 46 deletions
diff --git a/lib/public/Comments/ICommentsManager.php b/lib/public/Comments/ICommentsManager.php index c34bd4718cc..7e59b5c7b06 100644 --- a/lib/public/Comments/ICommentsManager.php +++ b/lib/public/Comments/ICommentsManager.php @@ -1,30 +1,9 @@ <?php + /** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Christoph Wurst <christoph@winzerhof-wurst.at> - * @author Joas Schilling <coding@schilljs.com> - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author Robin Appelman <robin@icewind.nl> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCP\Comments; @@ -39,7 +18,6 @@ use OCP\PreConditionNotMetException; * @since 9.0.0 */ interface ICommentsManager { - /** * @const DELETED_USER type and id for a user that has been deleted * @see deleteReferencesOfActor @@ -62,12 +40,12 @@ interface ICommentsManager { public function get($id); /** - * returns the comment specified by the id and all it's child comments + * Returns the comment specified by the id and all it's child comments * * @param string $id * @param int $limit max number of entries to return, 0 returns all * @param int $offset the start entry - * @return array + * @return array{comment: IComment, replies: list<array{comment: IComment, replies: array<empty, empty>}>} * @since 9.0.0 * * The return array looks like this @@ -107,19 +85,19 @@ interface ICommentsManager { * @param string $objectType the object type, e.g. 'files' * @param string $objectId the id of the object * @param int $limit optional, number of maximum comments to be returned. if - * not specified, all comments are returned. + * not specified, all comments are returned. * @param int $offset optional, starting point * @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments - * that may be returned - * @return IComment[] + * that may be returned + * @return list<IComment> * @since 9.0.0 */ public function getForObject( - $objectType, - $objectId, - $limit = 0, - $offset = 0, - \DateTime $notOlderThan = null + $objectType, + $objectId, + $limit = 0, + $offset = 0, + ?\DateTime $notOlderThan = null, ); /** @@ -128,9 +106,10 @@ interface ICommentsManager { * @param int $lastKnownCommentId the last known comment (will be used as offset) * @param string $sortDirection direction of the comments (`asc` or `desc`) * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. + * set to 0, all comments are returned. * @param bool $includeLastKnown - * @return IComment[] + * @param string $topmostParentId Limit the comments to a list of replies and its original root comment + * @return list<IComment> * @since 14.0.0 * @deprecated 24.0.0 - Use getCommentsWithVerbForObjectSinceComment instead */ @@ -140,7 +119,8 @@ interface ICommentsManager { int $lastKnownCommentId, string $sortDirection = 'asc', int $limit = 30, - bool $includeLastKnown = false + bool $includeLastKnown = false, + string $topmostParentId = '', ): array; /** @@ -150,9 +130,10 @@ interface ICommentsManager { * @param int $lastKnownCommentId the last known comment (will be used as offset) * @param string $sortDirection direction of the comments (`asc` or `desc`) * @param int $limit optional, number of maximum comments to be returned. if - * set to 0, all comments are returned. + * set to 0, all comments are returned. * @param bool $includeLastKnown - * @return IComment[] + * @param string $topmostParentId Limit the comments to a list of replies and its original root comment + * @return list<IComment> * @since 24.0.0 */ public function getCommentsWithVerbForObjectSinceComment( @@ -162,7 +143,8 @@ interface ICommentsManager { int $lastKnownCommentId, string $sortDirection = 'asc', int $limit = 30, - bool $includeLastKnown = false + bool $includeLastKnown = false, + string $topmostParentId = '', ): array; /** @@ -174,7 +156,7 @@ interface ICommentsManager { * @param string $verb Limit the verb of the comment * @param int $offset * @param int $limit - * @return IComment[] + * @return list<IComment> * @since 14.0.0 */ public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array; @@ -197,12 +179,12 @@ interface ICommentsManager { * @param $objectType string the object type, e.g. 'files' * @param $objectId string the id of the object * @param \DateTime|null $notOlderThan optional, timestamp of the oldest comments - * that may be returned + * that may be returned * @param string $verb Limit the verb of the comment - Added in 14.0.0 * @return Int * @since 9.0.0 */ - public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = ''); + public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = ''); /** * @param string $objectType the object type, e.g. 'files' @@ -262,7 +244,7 @@ interface ICommentsManager { string $objectId, string $verb, string $actorType, - array $actors + array $actors, ): array; /** @@ -272,6 +254,7 @@ interface ICommentsManager { * @param IUser $user * @return array [$fileId => $unreadCount] * @since 12.0.0 + * @deprecated 29.0.0 use getNumberOfUnreadCommentsForObjects instead */ public function getNumberOfUnreadCommentsForFolder($folderId, IUser $user); @@ -482,4 +465,15 @@ interface ICommentsManager { * @since 21.0.0 */ public function load(): void; + + /** + * Delete comments with field expire_date less than current date + * Only will delete the message related with the object. + * + * @param string $objectType the object type (e.g. 'files') + * @param string $objectId e.g. the file id, leave empty to expire on all objects of this type + * @return boolean true if at least one row was deleted + * @since 25.0.0 + */ + public function deleteCommentsExpiredAtObject(string $objectType, string $objectId = ''): bool; } |