FEATURE: Allow turning off the plugin from settings

This commit is contained in:
Rafael dos Santos Silva 2017-06-05 19:45:33 -03:00
parent 1b895a9917
commit c16bf207c7
15 changed files with 8 additions and 2 deletions

View File

@ -17,7 +17,7 @@ function initialize(api, container) {
_createContent() { _createContent() {
this._super(); this._super();
if (!this.get('currentUser.staff')) { if (!this.get('currentUser.staff') || !siteSettings.assign_enabled) {
return; return;
} }
const content = this.get('content'); const content = this.get('content');
@ -75,7 +75,7 @@ function initialize(api, container) {
}); });
if (currentUser && currentUser.get("staff")) { if (currentUser && currentUser.get("staff") && siteSettings.assign_enabled) {
api.addUserMenuGlyph({ api.addUserMenuGlyph({
label: 'discourse_assign.assigned', label: 'discourse_assign.assigned',
className: 'assigned', className: 'assigned',

View File

@ -1,5 +1,6 @@
en: en:
site_settings: site_settings:
assign_enabled: "Enable the assign plugin"
assigns_public: "Allow general public to see topic assignments" assigns_public: "Allow general public to see topic assignments"
assigns_user_url_path: "Path to users assigned topics (use: {username} to substitute username)" assigns_user_url_path: "Path to users assigned topics (use: {username} to substitute username)"
assigns_by_staff_mention: "If a staff member mentions another staff member, topic is automatically assigned" assigns_by_staff_mention: "If a staff member mentions another staff member, topic is automatically assigned"

View File

@ -1,4 +1,7 @@
plugins: plugins:
assign_enabled:
default: false
client: true
assigns_by_staff_mention: false assigns_by_staff_mention: false
unassign_creates_tracking_post: true unassign_creates_tracking_post: true
assigns_public: false assigns_public: false

View File

@ -3,6 +3,8 @@
# version: 0.1 # version: 0.1
# authors: Sam Saffron # authors: Sam Saffron
enabled_site_setting :assign_enabled
register_asset 'stylesheets/assigns.scss' register_asset 'stylesheets/assigns.scss'
after_initialize do after_initialize do