mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 17:35:43 +08:00
FIX: limit visible revisions history to last 100 (#12946)
This is done to prevent spike memory usage when the number of revisions is very large (thousands) and the post has a significant length.
This commit is contained in:
parent
8f82243ee7
commit
b0e9c6e127
@ -190,7 +190,12 @@ class PostRevisionSerializer < ApplicationSerializer
|
||||
def all_revisions
|
||||
return @all_revisions if @all_revisions
|
||||
|
||||
post_revisions = PostRevision.where(post_id: object.post_id).order(:number).to_a
|
||||
post_revisions = PostRevision
|
||||
.where(post_id: object.post_id)
|
||||
.order(number: :desc)
|
||||
.limit(99)
|
||||
.to_a
|
||||
.reverse
|
||||
|
||||
latest_modifications = {
|
||||
"raw" => [post.raw],
|
||||
|
@ -3374,7 +3374,7 @@ en:
|
||||
one: "user"
|
||||
other: "users"
|
||||
category_title: "Category"
|
||||
history: "History"
|
||||
history: "History, last 100 revisions"
|
||||
changed_by: "by %{author}"
|
||||
|
||||
raw_email:
|
||||
|
Loading…
x
Reference in New Issue
Block a user