- new "show-footer" mixins - converted most of the routes to ES6 - FIX: handling of "indexStream" in user pages There will now be a footer on all the following pages - /exception - /about - /latest - /new - /unread - /starred - /top - /categories - /c/:category - /c/:category/l/latest - /c/:category/l/new - /c/:category/l/unread - /c/:category/l/top - /t/:topic/:id - /groups/:name/members - /user/activity - /user/activity/topics - /user/activity/posts - /user/activity/replies - /user/activity/likes-given - /user/activity/likes-received - /user/activity/bookmarks - /user/activity/starred - /user/badges - /user/notifications - /user/flagged-posts - /user/deleted-posts - /user/private-messages - /user/private-messages/mine - /user/private-messages/unread - /user/invited - /user/:username/preferences - /faq (static pages) - /badges - /badges/:id/:badge
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
|
import ObjectController from 'discourse/controllers/object';
|
|
|
|
export default ObjectController.extend(ModalFunctionality, {
|
|
modalClass: 'invite',
|
|
|
|
isAdmin: function(){
|
|
return Discourse.User.currentProp("admin");
|
|
}.property(),
|
|
|
|
onShow: function(){
|
|
this.set('controllers.modal.modalClass', 'invite-modal');
|
|
this.set('emailOrUsername', '');
|
|
},
|
|
|
|
disabled: function() {
|
|
if (this.get('saving')) return true;
|
|
return this.blank('emailOrUsername');
|
|
}.property('emailOrUsername', 'saving'),
|
|
|
|
buttonTitle: function() {
|
|
if (this.get('saving')) return I18n.t('topic.inviting');
|
|
return I18n.t('topic.invite_private.action');
|
|
}.property('saving'),
|
|
|
|
actions: {
|
|
invite: function() {
|
|
if (this.get('disabled')) return;
|
|
|
|
var self = this;
|
|
this.setProperties({saving: true, error: false});
|
|
|
|
// Invite the user to the private message
|
|
this.get('model').createInvite(this.get('emailOrUsername')).then(function(result) {
|
|
self.setProperties({saving: true, finished: true});
|
|
|
|
if(result && result.user) {
|
|
self.get('model.details.allowed_users').pushObject(result.user);
|
|
}
|
|
}).catch(function() {
|
|
self.setProperties({error: true, saving: false});
|
|
});
|
|
return false;
|
|
}
|
|
}
|
|
|
|
});
|