mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 22:26:26 +08:00
Merge pull request #2563 from techAPJ/patch-2
FEATURE: group name is required for private topic invite
This commit is contained in:
commit
c004ad1d51
|
@ -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
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
{{text-field value=email placeholderKey="topic.invite_reply.email_placeholder"}}
|
||||
|
||||
{{#if isAdmin}}
|
||||
<label>{{i18n topic.automatically_add_to_groups}}</label>
|
||||
<label>{{{groupInstructions}}}</label>
|
||||
{{group-selector includeAuto=false groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
|
|
@ -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: (<b>Required</b>, admin only)"
|
||||
|
||||
invite_private:
|
||||
title: 'Invite to Private Message'
|
||||
|
|
Loading…
Reference in New Issue
Block a user