From 6ebfb0ea369d943ca6926272f73f65bb600cb6b8 Mon Sep 17 00:00:00 2001 From: Juan David Martinez Date: Thu, 14 Dec 2023 12:23:37 -0500 Subject: [PATCH] added proper title with link to ReviewablePostVotingComments --- .../reviewable_post_voting_comments_serializer.rb | 2 +- .../components/reviewable-post-voting-comment.hbs | 14 +++++--------- .../components/reviewable-post-voting-comment.js | 13 +++++++------ lib/post_voting/comment_review_queue.rb | 1 + 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/app/serializers/reviewable_post_voting_comments_serializer.rb b/app/serializers/reviewable_post_voting_comments_serializer.rb index 92bd8623..7e0d32f6 100644 --- a/app/serializers/reviewable_post_voting_comments_serializer.rb +++ b/app/serializers/reviewable_post_voting_comments_serializer.rb @@ -3,7 +3,7 @@ require_dependency "reviewable_serializer" class ReviewablePostVotingCommentSerializer < ReviewableSerializer - target_attributes :cooked, :raw, :comment_cooked + target_attributes :cooked, :raw, :comment_cooked, :post_id payload_attributes :comment_cooked, :transcript_topic_id, :cooked, :raw, :created_by attributes :target_id, :comment_cooked diff --git a/assets/javascripts/discourse/components/reviewable-post-voting-comment.hbs b/assets/javascripts/discourse/components/reviewable-post-voting-comment.hbs index bd6ebb88..71cff198 100644 --- a/assets/javascripts/discourse/components/reviewable-post-voting-comment.hbs +++ b/assets/javascripts/discourse/components/reviewable-post-voting-comment.hbs @@ -1,12 +1,8 @@ -
- +
+ {{html-safe + @reviewable.topic.fancyTitle + }} + {{category-badge @reviewable.category}}
diff --git a/assets/javascripts/discourse/components/reviewable-post-voting-comment.js b/assets/javascripts/discourse/components/reviewable-post-voting-comment.js index 5d42f151..0fd0c97e 100644 --- a/assets/javascripts/discourse/components/reviewable-post-voting-comment.js +++ b/assets/javascripts/discourse/components/reviewable-post-voting-comment.js @@ -1,14 +1,15 @@ import Component from "@glimmer/component"; -import { cached } from "@glimmer/tracking"; +import { tracked } from "@glimmer/tracking"; import { inject as service } from "@ember/service"; -import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel"; export default class ReviewableChatMessage extends Component { @service store; - @service chatChannelsManager; + @tracked post; - @cached - get chatChannel() { - return ChatChannel.create(this.args.reviewable.chat_channel); + constructor() { + super(...arguments); + this.store.find("post", this.args.reviewable.post_id).then((post) => { + this.post = post; + }); } } diff --git a/lib/post_voting/comment_review_queue.rb b/lib/post_voting/comment_review_queue.rb index e1673a4f..9181ea58 100644 --- a/lib/post_voting/comment_review_queue.rb +++ b/lib/post_voting/comment_review_queue.rb @@ -39,6 +39,7 @@ def flag_comment(comment, guardian, flag_type_id, opts = {}) target: comment, reviewable_by_moderator: true, potential_spam: flag_type_id == ReviewableScore.types[:spam], + topic: comment.post.topic, payload: payload, ) reviewable.update(target_created_by: comment.user)