Merge pull request #2445 from techAPJ/invitation-patch

Consider User trust level while showing Invites tab
This commit is contained in:
Jeff Atwood 2014-06-15 03:15:34 -07:00
commit 258c353307
4 changed files with 82 additions and 66 deletions

View file

@ -27,6 +27,15 @@ export default Discourse.ObjectController.extend({
(this.get('userActionType') === Discourse.UserAction.TYPES.messages_received); (this.get('userActionType') === Discourse.UserAction.TYPES.messages_received);
}.property('userActionType'), }.property('userActionType'),
/**
Can the currently logged in user invite users to the site
@property canInviteToForum
**/
canInviteToForum: function() {
return Discourse.User.currentProp('can_invite_to_forum');
}.property(),
privateMessagesActive: Em.computed.equal('pmView', 'index'), privateMessagesActive: Em.computed.equal('pmView', 'index'),
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'), privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread') privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread')

View file

@ -1,11 +1,10 @@
<section class='user-content'> {{#if canInviteToForum}}
<section class='user-content'>
<h2>{{i18n user.invited.title}}</h2> <h2>{{i18n user.invited.title}}</h2>
<div class="pull-right"> <div class="pull-right">
{{#if canInviteToForum}}
<button {{action showInvite}} class='btn'>{{i18n user.invited.create}}</button> <button {{action showInvite}} class='btn'>{{i18n user.invited.create}}</button>
{{/if}}
{{#if canBulkInvite}} {{#if canBulkInvite}}
{{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}} {{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
{{/if}} {{/if}}
@ -69,7 +68,12 @@
{{/if}} {{/if}}
{{else}} {{else}}
{{{i18n user.invited.none}}} {{#if canBulkInvite}}
{{{i18n user.invited.bulk_invite.none}}}
{{else}}
{{i18n user.invited.none}}
{{/if}}
{{/if}} {{/if}}
</section> </section>
{{/if}}

View file

@ -134,7 +134,9 @@
{{#link-to 'preferences' class="btn right"}}<i class='fa fa-cog'></i>{{i18n user.preferences}}{{/link-to}} {{#link-to 'preferences' class="btn right"}}<i class='fa fa-cog'></i>{{i18n user.preferences}}{{/link-to}}
{{/if}} {{/if}}
{{#if canInviteToForum}}
{{#link-to 'user.invited' class="btn right"}}<i class='fa fa-envelope-o'></i>{{i18n user.invited.title}}{{/link-to}} {{#link-to 'user.invited' class="btn right"}}<i class='fa fa-envelope-o'></i>{{i18n user.invited.title}}{{/link-to}}
{{/if}}
</section> </section>
</section> </section>

View file

@ -402,7 +402,7 @@ en:
search: "type to search invites..." search: "type to search invites..."
title: "Invites" title: "Invites"
user: "Invited User" user: "Invited User"
none: "You haven't invited anyone here yet. You can send individual invites, or invite a bunch of people at once by <a href='https://meta.discourse.org/t/send-bulk-invites/16468'>uploading a bulk invite file</a>." none: "You haven't invited anyone here yet."
truncated: "Showing the first {{count}} invites." truncated: "Showing the first {{count}} invites."
redeemed: "Redeemed Invites" redeemed: "Redeemed Invites"
redeemed_at: "Redeemed" redeemed_at: "Redeemed"
@ -417,6 +417,7 @@ en:
account_age_days: "Account age in days" account_age_days: "Account age in days"
create: "Send an Invite" create: "Send an Invite"
bulk_invite: bulk_invite:
none: "You haven't invited anyone here yet. You can send individual invites, or invite a bunch of people at once by <a href='https://meta.discourse.org/t/send-bulk-invites/16468'>uploading a bulk invite file</a>."
text: "Bulk Invite from File" text: "Bulk Invite from File"
uploading: "UPLOADING" uploading: "UPLOADING"
success: "File uploaded successfully, you will be notified shortly with progress." success: "File uploaded successfully, you will be notified shortly with progress."