FEATURE: Notify user when mention can't see the reply they were mentioned in

FIX: Group Mention Notifications
This commit is contained in:
cpradio
2016-11-14 22:03:16 -05:00
parent 095767bdb4
commit 824c235760
7 changed files with 100 additions and 15 deletions

View File

@ -242,11 +242,18 @@ class UsersController < ApplicationController
usernames -= groups
usernames.each(&:downcase!)
cannot_see = []
topic_id = params[:topic_id]
unless topic_id.blank?
topic = Topic.find_by(id: topic_id)
usernames.each{ |username| cannot_see.push(username) unless Guardian.new(User.find_by_username(username)).can_see?(topic) }
end
result = User.where(staged: false)
.where(username_lower: usernames)
.pluck(:username_lower)
render json: {valid: result, valid_groups: groups, mentionable_groups: mentionable_groups}
render json: {valid: result, valid_groups: groups, mentionable_groups: mentionable_groups, cannot_see: cannot_see}
end
def render_available_true