FEATURE: Add site setting to disable group directory.
This commit is contained in:
parent
c531f4ded5
commit
8551d821a0
|
@ -103,7 +103,9 @@ export default createWidget('hamburger-menu', {
|
||||||
links.push({ route: 'users', className: 'user-directory-link', label: 'directory.title' });
|
links.push({ route: 'users', className: 'user-directory-link', label: 'directory.title' });
|
||||||
}
|
}
|
||||||
|
|
||||||
links.push({ route: 'groups', className: 'groups-link', label: 'groups.index.title' });
|
if (!this.siteSettings.show_group_directory) {
|
||||||
|
links.push({ route: 'groups', className: 'groups-link', label: 'groups.index.title' });
|
||||||
|
}
|
||||||
|
|
||||||
if (this.siteSettings.tagging_enabled) {
|
if (this.siteSettings.tagging_enabled) {
|
||||||
links.push({ route: 'tags', label: 'tagging.tags' });
|
links.push({ route: 'tags', label: 'tagging.tags' });
|
||||||
|
|
|
@ -11,6 +11,10 @@ class GroupsController < ApplicationController
|
||||||
skip_before_filter :preload_json, :check_xhr, only: [:posts_feed, :mentions_feed]
|
skip_before_filter :preload_json, :check_xhr, only: [:posts_feed, :mentions_feed]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
unless SiteSetting.enable_group_directory?
|
||||||
|
raise Discourse::InvalidAccess.new(:enable_group_directory)
|
||||||
|
end
|
||||||
|
|
||||||
page_size = 30
|
page_size = 30
|
||||||
page = params[:page]&.to_i || 0
|
page = params[:page]&.to_i || 0
|
||||||
|
|
||||||
|
|
|
@ -1315,6 +1315,7 @@ en:
|
||||||
public_user_custom_fields: "A whitelist of custom fields for a user that can be shown publicly."
|
public_user_custom_fields: "A whitelist of custom fields for a user that can be shown publicly."
|
||||||
staff_user_custom_fields: "A whitelist of custom fields for a user that can be shown to staff."
|
staff_user_custom_fields: "A whitelist of custom fields for a user that can be shown to staff."
|
||||||
enable_user_directory: "Provide a directory of users for browsing"
|
enable_user_directory: "Provide a directory of users for browsing"
|
||||||
|
enable_group_directory: "Provide a directory of groups for browsing"
|
||||||
allow_anonymous_posting: "Allow users to switch to anonymous mode"
|
allow_anonymous_posting: "Allow users to switch to anonymous mode"
|
||||||
anonymous_posting_min_trust_level: "Minimum trust level required to enable anonymous posting"
|
anonymous_posting_min_trust_level: "Minimum trust level required to enable anonymous posting"
|
||||||
anonymous_account_duration_minutes: "To protect anonymity create a new anonymous account every N minutes for each user. Example: if set to 600, as soon as 600 minutes elapse from last post AND user switches to anon, a new anonymous account is created."
|
anonymous_account_duration_minutes: "To protect anonymity create a new anonymous account every N minutes for each user. Example: if set to 600, as soon as 600 minutes elapse from last post AND user switches to anon, a new anonymous account is created."
|
||||||
|
|
|
@ -411,6 +411,11 @@ users:
|
||||||
default: false
|
default: false
|
||||||
client: true
|
client: true
|
||||||
|
|
||||||
|
groups:
|
||||||
|
enable_group_directory:
|
||||||
|
client: true
|
||||||
|
default: true
|
||||||
|
|
||||||
posting:
|
posting:
|
||||||
min_post_length:
|
min_post_length:
|
||||||
client: true
|
client: true
|
||||||
|
|
|
@ -14,6 +14,15 @@ describe "Groups" do
|
||||||
group.update_attributes!(automatic: true, visible: true)
|
group.update_attributes!(automatic: true, visible: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when group directory is disabled' do
|
||||||
|
site_setting(:enable_group_directory, false)
|
||||||
|
|
||||||
|
it 'should deny access' do
|
||||||
|
get "/groups.json"
|
||||||
|
expect(response).to be_forbidden
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'should return the right response' do
|
it 'should return the right response' do
|
||||||
get "/groups.json"
|
get "/groups.json"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue