FIX: Disable request membership button if user does not have sufficient trust level.

This commit is contained in:
Guo Xiang Tan 2017-06-02 16:06:25 +09:00
parent 5b0e8d3b0b
commit 5f441a2614
4 changed files with 21 additions and 1 deletions

View File

@ -17,6 +17,22 @@ export default Ember.Component.extend({
}
},
@computed
disableRequestMembership() {
if (this.currentUser) {
return this.currentUser.trust_level < this.siteSettings.min_trust_to_send_messages;
} else {
return false;
}
},
@computed("disableRequestMembership")
requestMembershipButtonTitle(disableRequestMembership) {
if (disableRequestMembership) {
return "groups.request_membership_pm.disabled";
}
},
_showLoginModal() {
this.sendAction('showLogin');
$.cookie('destination_url', window.location.href);

View File

@ -25,7 +25,9 @@
{{d-button action="requestMembership"
class="group-index-request"
icon="envelope"
label="groups.request"}}
label="groups.request"
title=requestMembershipButtonTitle
disabled=disableRequestMembership}}
{{/if}}
{{else}}
{{yield}}

View File

@ -410,6 +410,7 @@ en:
request_membership_pm:
title: "Membership Request"
body: "I would like to apply for membership in @%{groupName}."
disabled: "Insufficient trust level to request for group membership"
name_placeholder: "Group name, no spaces, same as username rule"
public: "Allow users to join/leave the group freely (Requires group to be visible)"
empty:

View File

@ -821,6 +821,7 @@ trust:
min_trust_to_send_messages:
default: 1
enum: 'TrustLevelSetting'
client: true
tl1_requires_topics_entered: 5
tl1_requires_read_posts:
default: 30