diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6
index b6b45b29039..f7dd557a188 100644
--- a/app/assets/javascripts/discourse/controllers/invite.js.es6
+++ b/app/assets/javascripts/discourse/controllers/invite.js.es6
@@ -23,8 +23,9 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
if (this.get('saving')) return true;
if (this.blank('email')) return true;
if (!Discourse.Utilities.emailValid(this.get('email'))) return true;
+ if (this.get('isPrivateTopic') && this.blank('groupNames')) return true;
return false;
- }.property('email', 'saving'),
+ }.property('email', 'isPrivateTopic', 'groupNames', 'saving'),
/**
The current text for the invite button
@@ -46,6 +47,13 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
return this.get('model') !== Discourse.User.current();
}.property('model'),
+ /**
+ Is Private Topic? (i.e. visible only to specific group members)
+
+ @property isPrivateTopic
+ **/
+ isPrivateTopic: Em.computed.and('invitingToTopic', 'model.category.read_restricted'),
+
/**
Instructional text for the modal.
@@ -59,6 +67,19 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
}
}.property('invitingToTopic'),
+ /**
+ Instructional text for the group selection.
+
+ @property groupInstructions
+ **/
+ groupInstructions: function() {
+ if (this.get('isPrivateTopic')) {
+ return I18n.t('topic.automatically_add_to_groups_required');
+ } else {
+ return I18n.t('topic.automatically_add_to_groups_optional');
+ }
+ }.property('isPrivateTopic'),
+
/**
The "success" text for when the invite was created.
@@ -76,6 +97,7 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
reset: function() {
this.setProperties({
email: null,
+ groupNames: null,
error: false,
saving: false,
finished: false
diff --git a/app/assets/javascripts/discourse/templates/modal/invite.js.handlebars b/app/assets/javascripts/discourse/templates/modal/invite.js.handlebars
index 772f21d9da9..8d9bfed67ac 100644
--- a/app/assets/javascripts/discourse/templates/modal/invite.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/modal/invite.js.handlebars
@@ -14,7 +14,7 @@
{{text-field value=email placeholderKey="topic.invite_reply.email_placeholder"}}
{{#if isAdmin}}
-
+
{{group-selector includeAuto=false groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
{{/if}}
{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 6d502f8982f..3ec2303f889 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -903,7 +903,8 @@ en:
success_message: 'You successfully flagged this topic.'
inviting: "Inviting..."
- automatically_add_to_groups: "This invite also includes access to these groups: (optional, admin only)"
+ automatically_add_to_groups_optional: "This invite also includes access to these groups: (optional, admin only)"
+ automatically_add_to_groups_required: "This invite also includes access to these groups: (Required, admin only)"
invite_private:
title: 'Invite to Private Message'