Edit-Flow
Edit-Flow copied to clipboard
editorial-comments.js - fix “no one will be notified” message logic
Note: Noticed this while working on #506 and they work on the exact same area of the code, so it may be tricky to merge them both. You could easily update this patch to include the changes from #506 if it makes it easier for you.
PROBLEM:
- When no one will be notified of an Editorial Comment the "No one will be notified" message should of course show in the space where there would otherwise be a list of usernames
- Right now, most of the time, the message is missing, and NOTHING shows
- The reason is that the message currently only shows when exactly zero users are subscribed, but the post author is ALWAYS subscribed. So if the post author is writing a comment when they are the only subscriber the message doesn't show, leaving an empty space.
- This is an obvious bug. If there’s no usernames to show, then the “no one will be notified” message should show instead.
SPECIFIC CAUSE IN THE CODE:
The JS checks for “no subscribers” BEFORE removing the one’s who won’t be notified (due to being the comment author, not having permission to edit the post, or not having an email), so the current author's presence on the list stops the message from being shown, then it doesn’t check again after running the filter and removing current author.
SOLUTION:
- In the JS, we run our logic that removes people from the list if they won’t be notified BEFORE we check if there are subscribers (and exit if there are none).
NOTES:
- I’m very embarrassed I didn’t notice this before, but testing these things gets very abstract, and apparently no one else spotted it either 🤷🏻♀️
Ah, makes sense - nice catch. I tested and this does resolve the issue.
FWIW I just tested this with 0.9.6 and it still works and is still a really obvious way to make that field work better.
FWIW if anyone is still working on EF, this is still a great thing to fix!