FIX: invite accepted notification should link to invited user profile
This commit is contained in:
parent
2052ceca95
commit
066824e545
|
@ -30,9 +30,9 @@ export default Ember.Component.extend({
|
|||
}
|
||||
|
||||
if (it.get('notification_type') === INVITED_TYPE) {
|
||||
return Discourse.getURL('/my/invited');
|
||||
return Discourse.getURL('/users/' + it.get('data.display_username'));
|
||||
}
|
||||
}.property("notification.data.{badge_id,badge_name}", "model.slug", "model.topic_id", "model.post_number"),
|
||||
}.property("notification.data.{badge_id,badge_name,display_username}", "model.slug", "model.topic_id", "model.post_number"),
|
||||
|
||||
description: function() {
|
||||
const badgeName = this.get("notification.data.badge_name");
|
||||
|
|
|
@ -14,7 +14,7 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
}.property(),
|
||||
|
||||
disabled: function() {
|
||||
if (this.get('saving')) return true;
|
||||
if (this.get('model.saving')) return true;
|
||||
if (this.blank('emailOrUsername')) return true;
|
||||
const emailOrUsername = this.get('emailOrUsername').trim();
|
||||
// when inviting to forum, email must be valid
|
||||
|
@ -22,14 +22,14 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
// normal users (not admin) can't invite users to private topic via email
|
||||
if (!this.get('isAdmin') && this.get('isPrivateTopic') && Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
// when invting to private topic via email, group name must be specified
|
||||
if (this.get('isPrivateTopic') && this.blank('groupNames') && Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
if (this.get('isPrivateTopic') && this.blank('model.groupNames') && Discourse.Utilities.emailValid(emailOrUsername)) return true;
|
||||
if (this.get('model.details.can_invite_to')) return false;
|
||||
return false;
|
||||
}.property('isAdmin', 'emailOrUsername', 'invitingToTopic', 'isPrivateTopic', 'groupNames', 'saving'),
|
||||
}.property('isAdmin', 'emailOrUsername', 'invitingToTopic', 'isPrivateTopic', 'model.groupNames', 'model.saving'),
|
||||
|
||||
buttonTitle: function() {
|
||||
return this.get('saving') ? I18n.t('topic.inviting') : I18n.t('topic.invite_reply.action');
|
||||
}.property('saving'),
|
||||
return this.get('model.saving') ? I18n.t('topic.inviting') : I18n.t('topic.invite_reply.action');
|
||||
}.property('model.saving'),
|
||||
|
||||
// We are inviting to a topic if the model isn't the current user.
|
||||
// The current user would mean we are inviting to the forum in general.
|
||||
|
@ -117,8 +117,8 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
|
||||
// Reset the modal to allow a new user to be invited.
|
||||
reset() {
|
||||
this.setProperties({
|
||||
emailOrUsername: null,
|
||||
this.set('emailOrUsername', null);
|
||||
this.get('model').setProperties({
|
||||
groupNames: null,
|
||||
error: false,
|
||||
saving: false,
|
||||
|
@ -131,13 +131,14 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
createInvite() {
|
||||
if (this.get('disabled')) { return; }
|
||||
|
||||
const groupNames = this.get('groupNames'),
|
||||
userInvitedController = this.get('controllers.user-invited-show');
|
||||
const groupNames = this.get('model.groupNames'),
|
||||
userInvitedController = this.get('controllers.user-invited-show'),
|
||||
model = this.get('model');
|
||||
|
||||
this.setProperties({ saving: true, error: false });
|
||||
model.setProperties({ saving: true, error: false });
|
||||
|
||||
return this.get('model').createInvite(this.get('emailOrUsername').trim(), groupNames).then(result => {
|
||||
this.setProperties({ saving: false, finished: true });
|
||||
model.setProperties({ saving: false, finished: true });
|
||||
if (!this.get('invitingToTopic')) {
|
||||
Discourse.Invite.findInvitedBy(this.currentUser, userInvitedController.get('filter')).then(invite_model => {
|
||||
userInvitedController.set('model', invite_model);
|
||||
|
@ -146,7 +147,7 @@ export default ObjectController.extend(Presence, ModalFunctionality, {
|
|||
} else if (this.get('isMessage') && result && result.user) {
|
||||
this.get('model.details.allowed_users').pushObject(result.user);
|
||||
}
|
||||
}).catch(() => this.setProperties({ saving: false, error: true }));
|
||||
}).catch(() => model.setProperties({ saving: false, error: true }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<div class="modal-body invite-modal">
|
||||
{{#if error}}
|
||||
{{#if model.error}}
|
||||
<div class="alert alert-error">
|
||||
<button class="close" data-dismiss="alert">×</button>
|
||||
{{errorMessage}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if finished}}
|
||||
{{#if model.finished}}
|
||||
{{{successMessage}}}
|
||||
{{else}}
|
||||
<label>{{inviteInstructions}}</label>
|
||||
|
@ -20,12 +20,12 @@
|
|||
{{/if}}
|
||||
{{#if showGroups}}
|
||||
<label>{{{groupInstructions}}}</label>
|
||||
{{group-selector groupFinder=groupFinder groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
|
||||
{{group-selector groupFinder=groupFinder groupNames=model.groupNames placeholderKey="topic.invite_private.group_name"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{{#if finished}}
|
||||
{{#if model.finished}}
|
||||
{{d-button class="btn-primary" action="closeModal" label="close"}}
|
||||
{{else}}
|
||||
<button class='btn btn-primary' {{bind-attr disabled="disabled"}} {{action "createInvite"}}>{{fa-icon "user-plus"}}{{buttonTitle}}</button>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<section class='user-content'>
|
||||
<h2>{{i18n 'user.invited.title'}}</h2>
|
||||
|
||||
{{#if can_see_invite_details}}
|
||||
{{#if model.can_see_invite_details}}
|
||||
<div class='user-invite-controls'>
|
||||
<div class='span15'>
|
||||
<ul class="nav nav-pills">
|
||||
|
@ -32,7 +32,7 @@
|
|||
{{#if inviteRedeemed}}
|
||||
<th>{{i18n 'user.invited.user'}}</th>
|
||||
<th>{{i18n 'user.invited.redeemed_at'}}</th>
|
||||
{{#if can_see_invite_details}}
|
||||
{{#if model.can_see_invite_details}}
|
||||
<th>{{i18n 'user.last_seen'}}</th>
|
||||
<th>{{i18n 'user.invited.topics_entered'}}</th>
|
||||
<th>{{i18n 'user.invited.posts_read_count'}}</th>
|
||||
|
@ -51,7 +51,7 @@
|
|||
{{#link-to 'user' invite.user}}{{invite.user.username}}{{/link-to}}
|
||||
</td>
|
||||
<td>{{format-date invite.redeemed_at}}</td>
|
||||
{{#if can_see_invite_details}}
|
||||
{{#if model.can_see_invite_details}}
|
||||
<td>{{format-date invite.user.last_seen_at}}</td>
|
||||
<td>{{number invite.user.topics_entered}}</td>
|
||||
<td>{{number invite.user.posts_read_count}}</td>
|
||||
|
|
Loading…
Reference in New Issue