diff options
author | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2023-06-29 10:32:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-29 10:32:08 +0200 |
commit | fc3ac4d97428d7a4b00a48bd72d1945a646d39b8 (patch) | |
tree | ed295848aa5598ad277602a516f388c7818b1faf /apps/comments | |
parent | f43c24b0b13bb40761bad46cd6cb87ba8e3b681b (diff) | |
parent | 7e33e5973065d6a206514d071ff96c24a6300361 (diff) | |
download | nextcloud-server-fc3ac4d97428d7a4b00a48bd72d1945a646d39b8.tar.gz nextcloud-server-fc3ac4d97428d7a4b00a48bd72d1945a646d39b8.zip |
Merge pull request #38605 from fsamapoor/replace_strpos_calls_in_comments_app
Refactors "strpos" calls in /apps/comments
Diffstat (limited to 'apps/comments')
-rw-r--r-- | apps/comments/lib/Activity/Provider.php | 2 | ||||
-rw-r--r-- | apps/comments/lib/Notification/Notifier.php | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php index 727f6d66b50..7ec22c68c16 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -182,7 +182,7 @@ class Provider implements IProvider { } $message = str_replace('@"' . $mention['id'] . '"', '{mention' . $mentionCount . '}', $message); - if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) { + if (!str_contains($mention['id'], ' ') && !str_starts_with($mention['id'], 'guest/')) { $message = str_replace('@' . $mention['id'], '{mention' . $mentionCount . '}', $message); } diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php index 59f1ad5da5f..aa3f9ba6824 100644 --- a/apps/comments/lib/Notification/Notifier.php +++ b/apps/comments/lib/Notification/Notifier.php @@ -118,7 +118,7 @@ class Notifier implements INotifier { $node = $nodes[0]; $path = rtrim($node->getPath(), '/'); - if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) { + if (str_starts_with($path, '/' . $notification->getUser() . '/files/')) { // Remove /user/files/... $fullPath = $path; [,,, $path] = explode('/', $fullPath, 4); @@ -182,7 +182,7 @@ class Notifier implements INotifier { // index of the mentions of that type. $mentionParameterId = 'mention-' . $mention['type'] . $mentionTypeCount[$mention['type']]; $message = str_replace('@"' . $mention['id'] . '"', '{' . $mentionParameterId . '}', $message); - if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) { + if (!str_contains($mention['id'], ' ') && !str_starts_with($mention['id'], 'guest/')) { $message = str_replace('@' . $mention['id'], '{' . $mentionParameterId . '}', $message); } |