Browse Source
Merge pull request #1919 from nextcloud/bugfix/1841/allow-to-escapce-commands
Allow to escape commands
pull/1951/head
Joas Schilling
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
21 additions and
0 deletions
-
lib/Chat/Command/Listener.php
-
lib/Chat/Parser/UserMention.php
-
tests/integration/features/chat/commands.feature
|
|
|
@ -63,6 +63,10 @@ class Listener { |
|
|
|
/** @var self $listener */ |
|
|
|
$listener = \OC::$server->query(self::class); |
|
|
|
|
|
|
|
if (strpos($message->getMessage(), '//') === 0) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
/** @var Command $command */ |
|
|
|
/** @var string $arguments */ |
|
|
|
|
|
|
|
@ -123,6 +123,10 @@ class UserMention { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (strpos($message, '//') === 0) { |
|
|
|
$message = substr($message, 1); |
|
|
|
} |
|
|
|
|
|
|
|
$chatMessage->setMessage($message, $messageParameters); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -31,3 +31,16 @@ Feature: chat/commands |
|
|
|
| room | actorType | actorId | actorDisplayName | message | messageParameters | |
|
|
|
| group room | users | participant1 | participant1-displayname | Message 2 | [] | |
|
|
|
| group room | users | participant1 | participant1-displayname | Message 1 | [] | |
|
|
|
|
|
|
|
Scenario: double slash escapes a command for everyone |
|
|
|
Given user "participant1" creates room "group room" |
|
|
|
| roomType | 2 | |
|
|
|
| roomName | room | |
|
|
|
And user "participant1" adds "participant2" to room "group room" with 200 |
|
|
|
When user "participant1" sends message "//help" to room "group room" with 201 |
|
|
|
Then user "participant1" sees the following messages in room "group room" with 200 |
|
|
|
| room | actorType | actorId | actorDisplayName | message | messageParameters | |
|
|
|
| group room | users | participant1 | participant1-displayname | /help | [] | |
|
|
|
And user "participant2" sees the following messages in room "group room" with 200 |
|
|
|
| room | actorType | actorId | actorDisplayName | message | messageParameters | |
|
|
|
| group room | users | participant1 | participant1-displayname | /help | [] | |