comments should compile mentions also if done by author
it is used by clients for formatting reasons, there is no reason not format the author if her handle is included in the comment body. It is unrelated to sending out notifications. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
c121610d5a
commit
3784fa2074
2 changed files with 7 additions and 6 deletions
|
@ -232,10 +232,6 @@ class Comment implements IComment {
|
|||
$uids = array_unique($mentions[0]);
|
||||
$result = [];
|
||||
foreach ($uids as $uid) {
|
||||
// exclude author, no self-mentioning
|
||||
if($uid === '@' . $this->getActorId()) {
|
||||
continue;
|
||||
}
|
||||
$result[] = ['type' => 'user', 'id' => substr($uid, 1)];
|
||||
}
|
||||
return $result;
|
||||
|
|
|
@ -8,6 +8,9 @@ use Test\TestCase;
|
|||
|
||||
class CommentTest extends TestCase {
|
||||
|
||||
/**
|
||||
* @throws \OCP\Comments\IllegalIDChangeException
|
||||
*/
|
||||
public function testSettersValidInput() {
|
||||
$comment = new Comment();
|
||||
|
||||
|
@ -58,6 +61,9 @@ class CommentTest extends TestCase {
|
|||
$comment->setId('c17');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \OCP\Comments\IllegalIDChangeException
|
||||
*/
|
||||
public function testResetId() {
|
||||
$comment = new Comment();
|
||||
$comment->setId('c23');
|
||||
|
@ -133,7 +139,7 @@ class CommentTest extends TestCase {
|
|||
'@alice @bob look look, a duplication @alice test @bob!', ['alice', 'bob']
|
||||
],
|
||||
[
|
||||
'@alice is the author, but notify @bob!', ['bob'], 'alice'
|
||||
'@alice is the author, notify @bob, nevertheless mention her!', ['alice', 'bob'], 'alice'
|
||||
],
|
||||
[
|
||||
'@foobar and @barfoo you should know, @foo@bar.com is valid' .
|
||||
|
@ -159,7 +165,6 @@ class CommentTest extends TestCase {
|
|||
$uid = array_shift($expectedUids);
|
||||
$this->assertSame('user', $mention['type']);
|
||||
$this->assertSame($uid, $mention['id']);
|
||||
$this->assertNotSame($author, $mention['id']);
|
||||
}
|
||||
$this->assertEmpty($mentions);
|
||||
$this->assertEmpty($expectedUids);
|
||||
|
|
Loading…
Reference in a new issue