FIX: Arrive at topic must be hidden when `must_approve_users` (#18504)

This commit is contained in:
Keegan George 2022-10-06 12:04:26 -07:00 committed by GitHub
parent 73e9875a1d
commit 70d0892ac9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -182,6 +182,14 @@ export default Controller.extend(
return staff || groups.any((g) => g.owner);
},
@discourseComputed("currentUser.staff")
canArriveAtTopic(staff) {
if (staff && !this.siteSettings.must_approve_users) {
return true;
}
return false;
},
@discourseComputed
timeShortcuts() {
const timezone = this.currentUser.timezone;

View File

@ -59,7 +59,7 @@
</div>
{{/if}}
{{#if this.currentUser.staff}}
{{#if this.canArriveAtTopic}}
<div class="input-group invite-to-topic">
<label for="invite-topic">{{d-icon "hand-point-right"}}{{i18n "user.invited.invite.invite_to_topic"}}</label>
<TopicChooser @value={{this.buffered.topicId}} @content={{this.topics}} @onChange={{action "onChangeTopic"}} @options={{hash

View File

@ -229,3 +229,17 @@ acceptance(
});
}
);
acceptance(
"Invites - Create Invite on Site with must_approve_users Setting",
function (needs) {
needs.user();
needs.settings({ must_approve_users: true });
test("hides `Arrive at Topic` field on sites with `must_approve_users`", async function (assert) {
await visit("/u/eviltrout/invited/pending");
await click(".user-invite-buttons .btn:first-child");
assert.ok(!exists(".invite-to-topic"));
});
}
);