mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:57:36 +08:00
FEATURE: group name is required for private topic invite
This commit is contained in:
parent
b3316b9f68
commit
e7e823129e
|
@ -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,15 @@ 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: function() {
|
||||
return this.get('invitingToTopic') && this.get('model.category.read_restricted');
|
||||
}.property('model'),
|
||||
|
||||
/**
|
||||
Instructional text for the modal.
|
||||
|
||||
|
@ -59,6 +69,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 +99,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}}
|
||||
|
|
|
@ -902,7 +902,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