mirror of
https://github.com/discourse/discourse.git
synced 2024-12-19 05:45:59 +08:00
FIX: Correctly display group unread indicator in gjs (#30302)
This commit is contained in:
parent
03bb43f746
commit
e03121c55b
|
@ -26,12 +26,8 @@ export default class UnreadIndicator extends Component {
|
|||
return `/private-messages/unread-indicator/${this.args.topic.id}`;
|
||||
}
|
||||
|
||||
get isUnread() {
|
||||
return typeof this.args.topic.get("unread_by_group_member") !== "undefined";
|
||||
}
|
||||
|
||||
<template>
|
||||
{{~#if this.isUnread~}}
|
||||
{{~#if @topic.unread_by_group_member~}}
|
||||
<span
|
||||
title={{i18n "topic.unread_indicator"}}
|
||||
class="badge badge-notification unread-indicator"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { render } from "@ember/test-helpers";
|
||||
import { module, test } from "qunit";
|
||||
import TopicListItem from "discourse/components/topic-list/item";
|
||||
import TopicList from "discourse/components/topic-list/list";
|
||||
import HbrTopicListItem from "discourse/components/topic-list-item";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
|
@ -58,4 +59,28 @@ module("Integration | Component | topic-list-item", function (hooks) {
|
|||
.dom(".topic-list-item[data-topic-id='1235']")
|
||||
.doesNotHaveClass("bar");
|
||||
});
|
||||
|
||||
test("shows unread-by-group-member indicator", async function (assert) {
|
||||
const store = this.owner.lookup("service:store");
|
||||
const topics = [
|
||||
store.createRecord("topic", { id: 1234 }),
|
||||
store.createRecord("topic", {
|
||||
id: 1235,
|
||||
unread_by_group_member: true,
|
||||
}),
|
||||
store.createRecord("topic", {
|
||||
id: 1236,
|
||||
unread_by_group_member: false,
|
||||
}),
|
||||
];
|
||||
|
||||
await render(<template><TopicList @topics={{topics}} /></template>);
|
||||
|
||||
assert
|
||||
.dom(".badge.badge-notification.unread-indicator")
|
||||
.exists({ count: 1 });
|
||||
assert
|
||||
.dom(".topic-list-item[data-topic-id='1235'] .unread-indicator")
|
||||
.exists();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user