mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 19:38:32 +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.get('saving')) return true;
|
||||||
if (this.blank('email')) return true;
|
if (this.blank('email')) return true;
|
||||||
if (!Discourse.Utilities.emailValid(this.get('email'))) return true;
|
if (!Discourse.Utilities.emailValid(this.get('email'))) return true;
|
||||||
|
if (this.get('isPrivateTopic') && this.blank('groupNames')) return true;
|
||||||
return false;
|
return false;
|
||||||
}.property('email', 'saving'),
|
}.property('email', 'isPrivateTopic', 'groupNames', 'saving'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The current text for the invite button
|
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();
|
return this.get('model') !== Discourse.User.current();
|
||||||
}.property('model'),
|
}.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.
|
Instructional text for the modal.
|
||||||
|
|
||||||
|
@ -59,6 +69,19 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||||
}
|
}
|
||||||
}.property('invitingToTopic'),
|
}.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.
|
The "success" text for when the invite was created.
|
||||||
|
|
||||||
|
@ -76,6 +99,7 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
||||||
reset: function() {
|
reset: function() {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
email: null,
|
email: null,
|
||||||
|
groupNames: null,
|
||||||
error: false,
|
error: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
finished: false
|
finished: false
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{{text-field value=email placeholderKey="topic.invite_reply.email_placeholder"}}
|
{{text-field value=email placeholderKey="topic.invite_reply.email_placeholder"}}
|
||||||
|
|
||||||
{{#if isAdmin}}
|
{{#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"}}
|
{{group-selector includeAuto=false groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -902,7 +902,8 @@ en:
|
||||||
success_message: 'You successfully flagged this topic.'
|
success_message: 'You successfully flagged this topic.'
|
||||||
|
|
||||||
inviting: "Inviting..."
|
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:
|
invite_private:
|
||||||
title: 'Invite to Private Message'
|
title: 'Invite to Private Message'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user