Skip to content

AO3-7358 Fix 500 error when sending item_added_notification for bookmark of deleted work#5804

Open
Smuzzy-waiii wants to merge 1 commit into
otwcode:masterfrom
Smuzzy-waiii:AO3-7358-fix-item_added_notification-for-bookmark-of-deleted-work
Open

AO3-7358 Fix 500 error when sending item_added_notification for bookmark of deleted work#5804
Smuzzy-waiii wants to merge 1 commit into
otwcode:masterfrom
Smuzzy-waiii:AO3-7358-fix-item_added_notification-for-bookmark-of-deleted-work

Conversation

@Smuzzy-waiii
Copy link
Copy Markdown

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7358

Purpose

Fix 500 error sending item_added_notification for bookmark of deleted work
The mail tries to reference .title of @creation.bookmarkable which errors out when @creation.bookmarkable is deleted. Updated the mail text to explicitly handle this case

Credit

Smaran Jawalkar (he/him)

…of deleted work

Fix 500 error sending item_added_notification for bookmark of deleted work

The mail tries to reference .title of @creation.bookmarkable which errors out when @creation.bookmarkable is deleted. Updated the mail text to explicitly handle this case
@Smuzzy-waiii
Copy link
Copy Markdown
Author

With my changes, the email will look like:
image

i.e the mail body is:

USER posted a new bookmark to your collection, COLLECTION:
Bookmark of deleted item

Please do let me know if the original intention of the ticket was to replace the entire mail body with "Bookmark of deleted item"

@Smuzzy-waiii Smuzzy-waiii marked this pull request as ready for review May 11, 2026 21:16
@Smuzzy-waiii
Copy link
Copy Markdown
Author

@Bilka2 I don't have Jira perms yet, could you please set the ticket to In-Review/In-Progress? 😄

Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 left a comment

Choose a reason for hiding this comment

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

Could you add a test for this change?

The rest of my comments are just style nitpicks, nice work!

<i><b><%= style_link(@creation.title.html_safe, work_url(@creation)) %></b></i>
<% else %>
<% if @creation.bookmarkable == nil %>
Bookmark of deleted item
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Normally, we'd prefer to internationalise text. But since that would significantly complicate the pull request, it's good to keep it like this for now. Just wanted to note it for the future

That said, could you indent this and the other line inside the else one step?

<% if @creation.is_a?(Work) %>
<i><b><%= style_link(@creation.title.html_safe, work_url(@creation)) %></b></i>
<% else %>
<% if @creation.bookmarkable == nil %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another style nitpick: Could you check unless @creation.bookmarkable instead?



<%= @creation.is_a?(Work) ? @creation.pseuds.length > 0 ? pseuds : @creation.authors_to_sort_on : pseuds %> posted a <%= @creation.is_a?(Work) ? @creation.backdate ? "backdated " : "new " : "new " %> <%= @creation.is_a?(Work) ? "work" : "bookmark" %> to your collection, "<%= @collection.name %>" (<%= collection_url(@collection) %>:
<%= @creation.is_a?(Work) ? @creation.pseuds.length > 0 ? pseuds : @creation.authors_to_sort_on : pseuds %> posted a <%= @creation.is_a?(Work) ? @creation.backdate ? "backdated " : "new " : "new " %> <%= @creation.is_a?(Work) ? "work" : "bookmark" %> to your collection, "<%= @collection.name %>" (<%= collection_url(@collection) %>):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work spotting that missing parenthesis!

@Bilka2 Bilka2 changed the title AO3-7358 Fix: 500 error sending item_added_notification for bookmark of deleted work AO3-7358 Fix 500 error when sending item_added_notification for bookmark of deleted work May 25, 2026
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.

3 participants