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);
}.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'),
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
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>
<div class="pull-right">
{{#if canInviteToForum}}
<button {{action showInvite}} class='btn'>{{i18n user.invited.create}}</button>
{{/if}}
{{#if canBulkInvite}}
{{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
{{/if}}
@ -69,7 +68,12 @@
{{/if}}
{{else}}
{{{i18n user.invited.none}}}
{{#if canBulkInvite}}
{{{i18n user.invited.bulk_invite.none}}}
{{else}}
{{i18n user.invited.none}}
{{/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}}
{{/if}}
{{#if canInviteToForum}}
{{#link-to 'user.invited' class="btn right"}}<i class='fa fa-envelope-o'></i>{{i18n user.invited.title}}{{/link-to}}
{{/if}}
</section>
</section>

View file

@ -402,7 +402,7 @@ en:
search: "type to search invites..."
title: "Invites"
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."
redeemed: "Redeemed Invites"
redeemed_at: "Redeemed"
@ -417,6 +417,7 @@ en:
account_age_days: "Account age in days"
create: "Send an 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"
uploading: "UPLOADING"
success: "File uploaded successfully, you will be notified shortly with progress."