Canapin
(Coin-coin le Canapin)
4 Febbraio 2023, 10:52pm
4
Ciao Proje DEV!
Stai usando Topic List Excerpts ?
Credo che tu abbia bisogno di un plugin se vuoi sovrascriverlo per mantenere le interruzioni di riga.
Penso che questo sia ciò che dovrebbe essere sovrascritto: discourse/app/controllers/topics_controller.rb at main · discourse/discourse · GitHub
Più specificamente, questa riga:
if post_ids.length > 100
render_json_error("Requested a chunk that is too big")
return
end
@topic = Topic.with_deleted.where(id: params[:topic_id]).first
guardian.ensure_can_see!(@topic)
@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, :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),
}
Non ho provato, ma questo potrebbe essere utile a questo scopo: Override existing Discourse methods in plugins
Sarei felice di dare un’occhiata, ma al momento non ho un’installazione di sviluppo (e sono scarso a programmare, quindi spero che qualcuno più esperto avrà una risposta più adatta).