Skip to content

fix(comments): Don't return mentions in markdown code (by default)#58974

Merged
nickvergessen merged 1 commit intomasterfrom
bugfix/noid/dont-count-mentions-in-markdown-code
Mar 16, 2026
Merged

fix(comments): Don't return mentions in markdown code (by default)#58974
nickvergessen merged 1 commit intomasterfrom
bugfix/noid/dont-count-mentions-in-markdown-code

Conversation

@nickvergessen
Copy link
Member

  • Companion to fix(chat): Don't mention in markdown code spreed#17355
  • The above PR already takes care of not rendering the mentions when showing the message, but notifications are still done atm
  • I made the option opt-out, as most known consumers of comments have markdown comments

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI
    • The regex of preg_replace was AI assisted

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen nickvergessen added this to the Nextcloud 34 milestone Mar 16, 2026
@nickvergessen nickvergessen self-assigned this Mar 16, 2026
@nickvergessen nickvergessen requested review from a team as code owners March 16, 2026 10:52
@nickvergessen nickvergessen requested review from Altahrim, ArtificialOwl, icewind1991 and sorbaugh and removed request for a team March 16, 2026 10:52
$message = preg_replace('/`[^`\n]*`/', '', $message);
}

$ok = preg_match_all("/\B(?<![^a-z0-9_\-@\.\'\s])@(\"(guest|email)\/[a-f0-9]+\"|\"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@\.\' \/:]+\"|\"[a-z0-9_\-@\.\' ]+\"|[a-z0-9_\-@\.\']+)/i", $message, $mentions);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change in this line was from $this->getMessage() to $message, it is otherwise unchanged.

@nickvergessen nickvergessen requested review from miaulalala and removed request for a team March 16, 2026 10:54
@nickvergessen nickvergessen merged commit c826288 into master Mar 16, 2026
170 of 174 checks passed
@nickvergessen nickvergessen deleted the bugfix/noid/dont-count-mentions-in-markdown-code branch March 16, 2026 14:33
@nickvergessen
Copy link
Member Author

/backport to stable33

@backportbot
Copy link

backportbot bot commented Mar 16, 2026

The backport to stable33 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable33
git pull origin stable33

# Create the new backport branch
git checkout -b backport/58974/stable33

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 11959a13

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/58974/stable33

Error: Failed to push branch backport/58974/stable33: remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/nextcloud/server.git/'


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@SystemKeeper
Copy link
Contributor

To keep in mind: This does not work for non-closed backticks, which should be auto-closed according to the specs.

@Antreesy
Copy link
Contributor

which should be auto-closed according to the specs.

Right, vue-library also includes a check for ``` or end-of-line to define a fenced code block (but not the inline code, iirc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants