mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Add endpoint to check if a group can be mentioned by user.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class GroupsController < ApplicationController
|
||||
|
||||
before_filter :ensure_logged_in, only: [:set_notifications]
|
||||
before_filter :ensure_logged_in, only: [:set_notifications, :mentionable]
|
||||
skip_before_filter :preload_json, :check_xhr, only: [:posts_feed, :mentions_feed]
|
||||
|
||||
def show
|
||||
@@ -120,6 +120,16 @@ class GroupsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def mentionable
|
||||
group = find_group(:name)
|
||||
|
||||
if group
|
||||
render json: { mentionable: Group.mentionable(current_user).where(id: group.id).present? }
|
||||
else
|
||||
raise Discourse::InvalidAccess.new
|
||||
end
|
||||
end
|
||||
|
||||
def remove_member
|
||||
group = Group.find(params[:id])
|
||||
guardian.ensure_can_edit!(group)
|
||||
|
||||
Reference in New Issue
Block a user