diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-10-26 14:02:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-26 14:02:49 +0200 |
commit | cde7f535bd9fd95325545a68e4c0e8926b726a2e (patch) | |
tree | 94a1525dd139de54e5e6db6534ed0aefe5435766 /lib/public | |
parent | b358b4eebc5079416c9cb437ff54705686cb215c (diff) | |
parent | b12b52b73bb225c29f4009f9b9095cacc093ea7e (diff) | |
download | nextcloud-server-cde7f535bd9fd95325545a68e4c0e8926b726a2e.tar.gz nextcloud-server-cde7f535bd9fd95325545a68e4c0e8926b726a2e.zip |
Merge pull request #1738 from nextcloud/comments-provide-displaynames-with-mentions
comment mentions: show displayname not uid
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Comments/IComment.php | 22 | ||||
-rw-r--r-- | lib/public/Comments/ICommentsManager.php | 28 |
2 files changed, 50 insertions, 0 deletions
diff --git a/lib/public/Comments/IComment.php b/lib/public/Comments/IComment.php index bb997a07223..8210d4c8c7e 100644 --- a/lib/public/Comments/IComment.php +++ b/lib/public/Comments/IComment.php @@ -133,6 +133,28 @@ interface IComment { public function setMessage($message); /** + * returns an array containing mentions that are included in the comment + * + * @return array each mention provides a 'type' and an 'id', see example below + * @since 9.2.0 + * + * The return array looks like: + * [ + * [ + * 'type' => 'user', + * 'id' => 'citizen4' + * ], + * [ + * 'type' => 'group', + * 'id' => 'media' + * ], + * … + * ] + * + */ + public function getMentions(); + + /** * returns the verb of the comment * * @return string diff --git a/lib/public/Comments/ICommentsManager.php b/lib/public/Comments/ICommentsManager.php index 98169fb335f..6a32cfd803d 100644 --- a/lib/public/Comments/ICommentsManager.php +++ b/lib/public/Comments/ICommentsManager.php @@ -246,4 +246,32 @@ interface ICommentsManager { */ public function registerEventHandler(\Closure $closure); + /** + * registers a method that resolves an ID to a display name for a given type + * + * @param string $type + * @param \Closure $closure + * @throws \OutOfBoundsException + * @since 9.2.0 + * + * Only one resolver shall be registered per type. Otherwise a + * \OutOfBoundsException has to thrown. + */ + public function registerDisplayNameResolver($type, \Closure $closure); + + /** + * resolves a given ID of a given Type to a display name. + * + * @param string $type + * @param string $id + * @return string + * @throws \OutOfBoundsException + * @since 9.2.0 + * + * If a provided type was not registered, an \OutOfBoundsException shall + * be thrown. It is upon the resolver discretion what to return of the + * provided ID is unknown. It must be ensured that a string is returned. + */ + public function resolveDisplayName($type, $id); + } |