FIX: Hide PM tags if the site setting is disabled (#10089)

* FIX: Hide PM tags if the site setting is disabled

* Apply code suggestions
This commit is contained in:
Bianca Nenciu
2020-06-22 16:48:24 +03:00
committed by GitHub
parent aff9bfd5bc
commit 685646540a
5 changed files with 73 additions and 8 deletions

View File

@ -144,6 +144,10 @@ class ListController < ApplicationController
def self.generate_message_route(action)
define_method("#{action}") do
if action == :private_messages_tag && !guardian.can_tag_pms?
raise Discourse::NotFound
end
list_opts = build_topic_list_options
target_user = fetch_user_from_params({ include_inactive: current_user.try(:staff?) }, [:user_stat, :user_option])
guardian.ensure_can_see_private_messages!(target_user.id)