FIX: Base topic details message on current category and tag tracking state (#12937)

The user may have changed their category or tag tracking settings since a topic was tracked/watched based on those settings in the past. In that case we need to alter the reason message we show them otherwise it is very confusing for the end user to be told they are tracking a topic because of a category, when they are no longer tracking that category.

For example: "You will see a count of new replies because you are tracking this category." becomes: "You will see a count of new replies because you were tracking this category in the past."

To do this, it was necessary to add tag and category tracking info to current user serializer. I improved the serializer code so it only does 3 SQL queries instead of 9 to get the tracking information for tags and categories for the current user.
This commit is contained in:
Martin Brennan
2021-05-06 09:14:07 +10:00
committed by GitHub
parent c792c2b5fe
commit 72648dd576
14 changed files with 530 additions and 64 deletions
+3
View File
@@ -2595,12 +2595,15 @@ en:
reasons:
mailing_list_mode: "You have mailing list mode enabled, so you will be notified of replies to this topic via email."
"3_10": "You will receive notifications because you are watching a tag on this topic."
"3_10_stale": "You will receive notifications because you were watching a tag on this topic in the past."
"3_6": "You will receive notifications because you are watching this category."
"3_6_stale": "You will receive notifications because you were watching this category in the past."
"3_5": "You will receive notifications because you started watching this topic automatically."
"3_2": "You will receive notifications because you are watching this topic."
"3_1": "You will receive notifications because you created this topic."
"3": "You will receive notifications because you are watching this topic."
"2_8": "You will see a count of new replies because you are tracking this category."
"2_8_stale": "You will see a count of new replies because you were tracking this category in the past."
"2_4": "You will see a count of new replies because you posted a reply to this topic."
"2_2": "You will see a count of new replies because you are tracking this topic."
"2": 'You will see a count of new replies because you <a href="%{basePath}/u/%{username}/preferences/notifications">read this topic</a>.'