FIX: hide chat button in user card (#29887)
when the user isn't able to receive DMs (either because they've disabled it or because they're suspended for example). Internal ref - t/142198
This commit is contained in:
parent
5bf5d13356
commit
d71016522e
|
@ -82,6 +82,8 @@ export default class CoreFabricators {
|
|||
name: args.name,
|
||||
avatar_template: "/letter_avatar_proxy/v3/letter/t/41988e/{size}.png",
|
||||
suspended_till: args.suspended_till,
|
||||
can_send_private_message_to_user:
|
||||
args.can_send_private_message_to_user ?? true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,10 @@ export default class ChatDirectMessageButton extends Component {
|
|||
@service router;
|
||||
|
||||
get shouldRender() {
|
||||
return this.chat.userCanDirectMessage && !this.args.user.suspended;
|
||||
return (
|
||||
this.chat.userCanDirectMessage &&
|
||||
this.args.user.can_send_private_message_to_user
|
||||
);
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -39,13 +39,13 @@ module(
|
|||
.doesNotExist("it doesn’t show the chat button");
|
||||
});
|
||||
|
||||
test("when displayed user is suspended", async function (assert) {
|
||||
test("when displayed user has disabled PMs / DMs", async function (assert) {
|
||||
sinon
|
||||
.stub(this.owner.lookup("service:chat"), "userCanDirectMessage")
|
||||
.value(true);
|
||||
|
||||
this.user = new CoreFabricators(getOwner(this)).user({
|
||||
suspended_till: moment().add(1, "year").toDate(),
|
||||
can_send_private_message_to_user: false,
|
||||
});
|
||||
|
||||
await render(
|
||||
|
|
Loading…
Reference in New Issue