mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -06:00
DEV: introduces Chat::Thread::ListItem in styleguide (#21851)
This commit is contained in:
parent
4e99ef3952
commit
473992bd36
@ -0,0 +1,5 @@
|
||||
<StyleguideExample @title="<Chat::Thread::ListItem>">
|
||||
<Styleguide::Component>
|
||||
<Chat::Thread::ListItem @thread={{this.thread}} />
|
||||
</Styleguide::Component>
|
||||
</StyleguideExample>
|
@ -0,0 +1,9 @@
|
||||
import Component from "@glimmer/component";
|
||||
import fabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default class ChatStyleguideChatThreadListItem extends Component {
|
||||
@service currentUser;
|
||||
|
||||
thread = fabricators.thread();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<Styleguide::ChatMessage />
|
||||
<Styleguide::ChatComposer />
|
||||
<Styleguide::ChatThreadOriginalMessage />
|
||||
<Styleguide::ChatThreadListItem />
|
||||
<Styleguide::ChatComposerMessageDetails />
|
@ -11,6 +11,7 @@ import ChatChannel, {
|
||||
} from "discourse/plugins/chat/discourse/models/chat-channel";
|
||||
import ChatMessage from "discourse/plugins/chat/discourse/models/chat-message";
|
||||
import ChatThread from "discourse/plugins/chat/discourse/models/chat-thread";
|
||||
import ChatThreadPreview from "discourse/plugins/chat/discourse/models/chat-thread-preview";
|
||||
import ChatDirectMessage from "discourse/plugins/chat/discourse/models/chat-direct-message";
|
||||
import ChatMessageReaction from "discourse/plugins/chat/discourse/models/chat-message-reaction";
|
||||
import User from "discourse/models/user";
|
||||
@ -126,6 +127,14 @@ function threadFabricator(args = {}) {
|
||||
return ChatThread.create(channel, {
|
||||
id: args.id || sequence++,
|
||||
original_message: args.original_message || messageFabricator({ channel }),
|
||||
preview: args.preview || threadPreviewFabricator({ channel }),
|
||||
});
|
||||
}
|
||||
function threadPreviewFabricator(args = {}) {
|
||||
return ChatThreadPreview.create({
|
||||
last_reply_id: args.last_reply_id || sequence++,
|
||||
last_reply_created_at: args.last_reply_created_at || Date.now(),
|
||||
last_reply_excerpt: args.last_reply_excerpt || "This is a reply",
|
||||
});
|
||||
}
|
||||
|
||||
@ -163,6 +172,7 @@ export default {
|
||||
directMessageChannel: directMessageChannelFabricator,
|
||||
message: messageFabricator,
|
||||
thread: threadFabricator,
|
||||
threadPreview: threadPreviewFabricator,
|
||||
reaction: reactionFabricator,
|
||||
upload: uploadFabricator,
|
||||
category: categoryFabricator,
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
|
||||
export default class ChatThreadPreview {
|
||||
static create(channel, args = {}) {
|
||||
return new ChatThreadPreview(channel, args);
|
||||
static create(args = {}) {
|
||||
return new ChatThreadPreview(args);
|
||||
}
|
||||
|
||||
@tracked lastReplyId;
|
||||
|
Loading…
Reference in New Issue
Block a user