mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
FIX: Missing excerpt for post small actions in topic timeline. (#14547)
This commit is contained in:

committed by
GitHub

parent
79e55ec3f0
commit
d0595127cc
@ -262,14 +262,21 @@ class TopicsController < ApplicationController
|
||||
@posts = Post.where(hidden: false, deleted_at: nil, topic_id: @topic.id)
|
||||
.where('posts.id in (?)', post_ids)
|
||||
.joins("LEFT JOIN users u on u.id = posts.user_id")
|
||||
.pluck(:id, :cooked, :username)
|
||||
.map do |post_id, cooked, username|
|
||||
{
|
||||
post_id: post_id,
|
||||
username: username,
|
||||
excerpt: PrettyText.excerpt(cooked, 800, keep_emoji_images: true)
|
||||
}
|
||||
end
|
||||
.pluck(:id, :cooked, :username, :action_code, :created_at)
|
||||
.map do |post_id, cooked, username, action_code, created_at|
|
||||
attrs = {
|
||||
post_id: post_id,
|
||||
username: username,
|
||||
excerpt: PrettyText.excerpt(cooked, 800, keep_emoji_images: true),
|
||||
}
|
||||
|
||||
if action_code
|
||||
attrs[:action_code] = action_code
|
||||
attrs[:created_at] = created_at
|
||||
end
|
||||
|
||||
attrs
|
||||
end
|
||||
|
||||
render json: @posts.to_json
|
||||
end
|
||||
|
Reference in New Issue
Block a user