FIX: Show chat channel info on reviewable items (#19260)

`reviewable.chat_channel` is a plain javascript object from the server's JSON response. We need to turn it into a true `ChatChannel` object before passing to `<ChatChannelTitle>`

This commit also converts `<ReviewableChatMessage>` to a Glimmer component
This commit is contained in:
David Taylor 2022-11-30 14:08:30 +00:00 committed by GitHub
parent 6969e9da7e
commit 105f500693
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 7 deletions

View File

@ -0,0 +1,13 @@
import Component from "@glimmer/component";
import { inject as service } from "@ember/service";
export default class ReviewableChatMessage extends Component {
@service store;
get chatChannel() {
return this.store.createRecord(
"chat-channel",
this.args.reviewable.chat_channel
);
}
}

View File

@ -1,21 +1,21 @@
<div class="flagged-post-header">
<LinkTo @route="chat.channel" @models={{array this.reviewable.chat_channel.id this.reviewable.chat_channel.title}} @query={{hash messageId=this.reviewable.target_id}}>
<ChatChannelTitle @channel={{this.reviewable.chat_channel}} />
<LinkTo @route="chat.channel" @models={{array this.chatChannel.id this.chatChannel.title}} @query={{hash messageId=@reviewable.target_id}}>
<ChatChannelTitle @channel={{this.chatChannel}} />
</LinkTo>
</div>
<div class="post-contents-wrapper">
<ReviewableCreatedBy @user={{this.reviewable.target_created_by}} @tagName="" />
<ReviewableCreatedBy @user={{@reviewable.target_created_by}} @tagName="" />
<div class="post-contents">
<ReviewablePostHeader @reviewable={{this.reviewable}} @createdBy={{this.reviewable.target_created_by}} @tagName="" />
<ReviewablePostHeader @reviewable={{@reviewable}} @createdBy={{@reviewable.target_created_by}} @tagName="" />
<div class="post-body">
{{html-safe (or this.reviewable.payload.message_cooked this.reviewable.cooked)}}
{{html-safe (or @reviewable.payload.message_cooked @reviewable.cooked)}}
</div>
{{#if this.reviewable.payload.transcript_topic_id}}
{{#if @reviewable.payload.transcript_topic_id}}
<div class="transcript">
<LinkTo @route="topic" @models={{array "-" this.reviewable.payload.transcript_topic_id}} class="btn btn-small">
<LinkTo @route="topic" @models={{array "-" @reviewable.payload.transcript_topic_id}} class="btn btn-small">
{{i18n "review.transcript.view"}}
</LinkTo>
</div>