Skip to content

Commit

Permalink
Merge pull request #5212 from nextcloud/bugfix/5199/replace-all-messa…
Browse files Browse the repository at this point in the history
…ge-parameters

Replace all message parameters and not only the last one
  • Loading branch information
PVince81 authored Feb 20, 2021
2 parents 7c45728 + 86207af commit ce8d788
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Search/MessageSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ protected function commentToSearchResultEntry(Room $room, IUser $user, IComment
$messageStr = $message->getMessage();
$search = $replace = [];
foreach ($message->getMessageParameters() as $key => $parameter) {
$search = '{' . $key . '}';
$search[] = '{' . $key . '}';
if ($parameter['type'] === 'user') {
$replace = '@' . $parameter['name'];
$replace[] = '@' . $parameter['name'];
} else {
$replace = $parameter['name'];
$replace[] = $parameter['name'];
}
}
$messageStr = str_replace($search, $replace, $messageStr);
Expand Down

0 comments on commit ce8d788

Please sign in to comment.