Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-09-27 13:36:04 +0300
committerJoas Schilling <coding@schilljs.com>2019-09-27 13:36:46 +0300
commitddc8e2b04f783abd0ff51b0aca3199db0771cd2e (patch)
tree044dca467abdb86e10c2a446b1b1a3e556c7bad1 /lib/Controller
parent87e7f065763a496fa50a9615ed4e456818d8b2cb (diff)
Prepend the conversation mention only if it start with the match
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ChatController.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index 6e2ae4782..7e05cc2e5 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -426,11 +426,21 @@ class ChatController extends AEnvironmentAwareController {
$roomDisplayName = $this->room->getDisplayName($this->participant->getUser());
if (($search === '' || strpos('all', $search) !== false || stripos($roomDisplayName, $search) !== false) && $this->room->getType() !== Room::ONE_TO_ONE_CALL) {
- array_unshift($results, [
- 'id' => 'all',
- 'label' => $roomDisplayName,
- 'source' => 'calls',
- ]);
+ if ($search === '' ||
+ stripos($roomDisplayName, $search) === 0 ||
+ strpos('all', $search) === 0) {
+ array_unshift($results, [
+ 'id' => 'all',
+ 'label' => $roomDisplayName,
+ 'source' => 'calls',
+ ]);
+ } else {
+ $results[] = [
+ 'id' => 'all',
+ 'label' => $roomDisplayName,
+ 'source' => 'calls',
+ ];
+ }
}
return new DataResponse($results);