UX: inform staff users that new users will be auto-approved on invite (#11062)

When `must_approve_users` is enabled then staff users assume that all
users will have to be approved manually. But in case of invite we
auto-approve users if they are invited by users. This commit adds an
info on the bottom of invite modal informing staff users that new users
will be auto-approved as soon as they accept invite.
This commit is contained in:
Arpit Jalan 2020-10-30 08:41:14 +05:30 committed by GitHub
parent cc74c3f9ab
commit 8f7f5204db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 6 deletions

View File

@ -1,7 +1,7 @@
import I18n from "I18n";
import Component from "@ember/component";
import Group from "discourse/models/group";
import { alias, readOnly } from "@ember/object/computed";
import { and, readOnly } from "@ember/object/computed";
import { action } from "@ember/object";
import discourseComputed from "discourse-common/utils/decorators";
import Invite from "discourse/models/invite";
@ -10,13 +10,12 @@ export default Component.extend({
inviteModel: readOnly("panel.model.inviteModel"),
userInvitedShow: readOnly("panel.model.userInvitedShow"),
isStaff: readOnly("currentUser.staff"),
isAdmin: readOnly("currentUser.admin"),
maxRedemptionAllowed: 5,
inviteExpiresAt: moment().add(1, "month").format("YYYY-MM-DD"),
groupIds: null,
allGroups: null,
isAdmin: alias("currentUser.admin"),
init() {
this._super(...arguments);
this.setDefaultSelectedGroups();
@ -52,6 +51,8 @@ export default Component.extend({
);
},
showApprovalMessage: and("isStaff", "siteSettings.must_approve_users"),
reset() {
this.setProperties({
maxRedemptionAllowed: 5,

View File

@ -2,7 +2,7 @@ import I18n from "I18n";
import discourseComputed from "discourse-common/utils/decorators";
import { isEmpty } from "@ember/utils";
import EmberObject, { action } from "@ember/object";
import { alias, and, equal } from "@ember/object/computed";
import { alias, and, equal, readOnly } from "@ember/object/computed";
import Component from "@ember/component";
import { emailValid } from "discourse/lib/utilities";
import Group from "discourse/models/group";
@ -17,6 +17,8 @@ export default Component.extend({
inviteModel: alias("panel.model.inviteModel"),
userInvitedShow: alias("panel.model.userInvitedShow"),
isStaff: readOnly("currentUser.staff"),
isAdmin: readOnly("currentUser.admin"),
// If this isn't defined, it will proxy to the user topic on the preferences
// page which is wrong.
@ -26,8 +28,6 @@ export default Component.extend({
inviteIcon: "envelope",
invitingExistingUserToTopic: false,
isAdmin: alias("currentUser.admin"),
init() {
this._super(...arguments);
this.setDefaultSelectedGroups();
@ -288,6 +288,8 @@ export default Component.extend({
: "topic.invite_reply.username_placeholder";
},
showApprovalMessage: and("isStaff", "siteSettings.must_approve_users"),
customMessagePlaceholder: i18n("invite.custom_message_placeholder"),
// Reset the modal to allow a new user to be invited.

View File

@ -41,6 +41,11 @@
}}
</div>
{{#if showApprovalMessage}}
<label class="instructions approval-notice">
{{i18n "invite.approval_not_required"}}
</label>
{{/if}}
{{/if}}
</div>

View File

@ -76,6 +76,12 @@
</div>
{{/if}}
{{/if}}
{{#if showApprovalMessage}}
<label class="instructions approval-notice">
{{i18n "invite.approval_not_required"}}
</label>
{{/if}}
</div>
<div class="footer">

View File

@ -94,6 +94,10 @@
margin-bottom: 8px;
}
.instructions.approval-notice {
color: var(--secondary-medium);
}
.email-or-username-input {
width: 100%;
}

View File

@ -3484,6 +3484,7 @@ en:
invite:
custom_message: "Make your invite a little bit more personal by writing a <a href>custom message</a>."
custom_message_placeholder: "Enter your custom message"
approval_not_required: "User will be auto-approved as soon as they will accept this invite."
custom_message_template_forum: "Hey, you should join this forum!"
custom_message_template_topic: "Hey, I thought you might enjoy this topic!"