Skip to content

fix(activity): keep the subject identifier when parsing events - #8631

Open
tcarrondo wants to merge 1 commit into
nextcloud:mainfrom
tcarrondo:fix/activity-keep-subject-identifier
Open

tcarrondo wants to merge 1 commit into
nextcloud:mainfrom
tcarrondo:fix/activity-keep-subject-identifier

Conversation

@tcarrondo

Copy link
Copy Markdown

Summary

DeckProvider::setSubjects() ended with $event->setSubject($subject, $parameters), which replaced the stored identifier (e.g. label_assign) with the translated sentence. When an activity becomes a notification, the activity app's NotificationGenerator passes $event->getSubject() to INotification::setSubject(). That rejects subjects longer than 64 characters, so the notification is logged as "Failed to format activity notification" and dropped.

On an instance with Deck 1.19.1 and Nextcloud 35.0.2 (English), these subjects are over the limit and their notifications never reached the user:

subject length
label_assign 80
card_update_description 78
card_update_done 70
card_update_stackId 67
card_update_unarchive 66

That came to 402 errors in 10 days for a single shared board. Translations are often longer, so more subjects can fail in other languages.

The override came in with e5fe19c (2018, "Fix missing information in activity emails"). Today the activity emails (MailQueueHandler, DigestSender) and the API only use the rich and parsed subjects. In the activity app, getSubject() is only used when storing the event, before parsing, and in log messages. Within Deck, getIcon() and the parseParamFor* helpers read the identifier before setSubjects() runs.

Checked on that instance by loading the patched DeckProvider and running the activity app's own formatting for one activity of each type: the five subjects above now produce the notification, and the types that already worked are unchanged.

The two parse tests now also assert that the subject is still the identifier after parsing.

TODO

  • Backport to the supported stable branches

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Documentation (manuals or wiki) has been updated or is not required

🤖 AI (if applicable)

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

🤖 Generated with Claude Code

setSubjects() replaced the event subject (e.g. label_assign) with the
translated sentence. The activity app passes that subject to
INotification::setSubject(), which rejects more than 64 characters, so
the notifications for moving a card, adding a label, adding a
description, marking as done and unarchiving were dropped with "Failed
to format activity notification". The emails use the rich and parsed
subjects since then, so the override is no longer needed.

Fixes nextcloud#8591

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tiago Carrondo <tiago@carrondo.pt>
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

This branch has not been deployed

No deployments
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.

DeckProvider::setSubjects() overwrites IEvent subject with translated sentence → InvalidValueException, Deck bell notifications silently dropped

1 participant