mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: custom email message for topic invites
This commit is contained in:
@@ -74,10 +74,9 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
return this.get('isAdmin') && (Discourse.Utilities.emailValid(this.get('emailOrUsername')) || this.get('isPrivateTopic') || !this.get('invitingToTopic')) && !Discourse.SiteSettings.enable_sso && Discourse.SiteSettings.enable_local_logins && !this.get('isMessage');
|
||||
}.property('isAdmin', 'emailOrUsername', 'isPrivateTopic', 'isMessage', 'invitingToTopic'),
|
||||
|
||||
// Show Custom Message textarea? (only shown when inviting new user to forum)
|
||||
showCustomMessage: function() {
|
||||
return this.get('model') === this.currentUser;
|
||||
}.property('model'),
|
||||
return (this.get('model') === this.currentUser || Discourse.Utilities.emailValid(this.get('emailOrUsername')));
|
||||
}.property('emailOrUsername'),
|
||||
|
||||
// Instructional text for the modal.
|
||||
inviteInstructions: function() {
|
||||
@@ -228,7 +227,11 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||
showCustomMessageBox() {
|
||||
this.toggleProperty('hasCustomMessage');
|
||||
if (this.get('hasCustomMessage')) {
|
||||
this.set('customMessage', I18n.t('invite.custom_message_template'));
|
||||
if (this.get('model') === this.currentUser) {
|
||||
this.set('customMessage', I18n.t('invite.custom_message_template_forum'));
|
||||
} else {
|
||||
this.set('customMessage', I18n.t('invite.custom_message_template_topic'));
|
||||
}
|
||||
} else {
|
||||
this.set('customMessage', null);
|
||||
}
|
||||
|
||||
@@ -309,10 +309,10 @@ const Topic = RestModel.extend({
|
||||
});
|
||||
},
|
||||
|
||||
createInvite(emailOrUsername, groupNames) {
|
||||
createInvite(user, group_names, custom_message) {
|
||||
return Discourse.ajax("/t/" + this.get('id') + "/invite", {
|
||||
type: 'POST',
|
||||
data: { user: emailOrUsername, group_names: groupNames }
|
||||
data: { user, group_names, custom_message }
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user