Clean up notifications if a user can't see a topic

This commit is contained in:
Robin Ward
2014-05-26 13:26:28 -04:00
parent b45e9081ca
commit b1d2aba0f3
2 changed files with 14 additions and 0 deletions

View File

@ -61,6 +61,14 @@ class TopicsController < ApplicationController
perform_show_response
canonical_url absolute_without_cdn(@topic_view.canonical_path)
rescue Discourse::InvalidAccess => ex
if current_user
# If the user can't see the topic, clean up notifications for it.
Notification.remove_for(current_user.id, params[:topic_id])
end
raise ex
end
def wordpress