mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
UX: hide chat button on user card when suspended (#20292)
This commit is contained in:
@ -4,6 +4,7 @@ import { render } from "@ember/test-helpers";
|
||||
import { module, test } from "qunit";
|
||||
import sinon from "sinon";
|
||||
import { exists } from "discourse/tests/helpers/qunit-helpers";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
module("Discourse Chat | Component | user-card-chat-button", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
@ -30,4 +31,21 @@ module("Discourse Chat | Component | user-card-chat-button", function (hooks) {
|
||||
"it doesn’t show the chat button"
|
||||
);
|
||||
});
|
||||
|
||||
test("when displayed user is suspended", async function (assert) {
|
||||
sinon
|
||||
.stub(this.owner.lookup("service:chat"), "userCanDirectMessage")
|
||||
.value(true);
|
||||
|
||||
this.user = User.create({
|
||||
suspended_till: moment().add(1, "year").toDate(),
|
||||
});
|
||||
|
||||
await render(hbs`<UserCardChatButton @user={{user}}/>`);
|
||||
|
||||
assert.false(
|
||||
exists(".user-card-chat-btn"),
|
||||
"it doesn’t show the chat button"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user