aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-06-29 10:32:08 +0200
committerGitHub <noreply@github.com>2023-06-29 10:32:08 +0200
commitfc3ac4d97428d7a4b00a48bd72d1945a646d39b8 (patch)
treeed295848aa5598ad277602a516f388c7818b1faf /apps/comments
parentf43c24b0b13bb40761bad46cd6cb87ba8e3b681b (diff)
parent7e33e5973065d6a206514d071ff96c24a6300361 (diff)
downloadnextcloud-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.php2
-rw-r--r--apps/comments/lib/Notification/Notifier.php4
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);
}