mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: post revision history wasn't showing tags correctly
This commit is contained in:
parent
17b1179103
commit
be338892ec
2 changed files with 9 additions and 5 deletions
|
@ -22,7 +22,8 @@ class PostRevisionSerializer < ApplicationSerializer
|
||||||
:edit_reason,
|
:edit_reason,
|
||||||
:body_changes,
|
:body_changes,
|
||||||
:title_changes,
|
:title_changes,
|
||||||
:user_changes
|
:user_changes,
|
||||||
|
:tags_changes
|
||||||
|
|
||||||
|
|
||||||
# Creates a field called field_name_changes with previous and
|
# Creates a field called field_name_changes with previous and
|
||||||
|
@ -41,7 +42,6 @@ class PostRevisionSerializer < ApplicationSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
add_compared_field :wiki
|
add_compared_field :wiki
|
||||||
add_compared_field :tags
|
|
||||||
|
|
||||||
def previous_hidden
|
def previous_hidden
|
||||||
previous["hidden"]
|
previous["hidden"]
|
||||||
|
@ -150,8 +150,12 @@ class PostRevisionSerializer < ApplicationSerializer
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tags_changes
|
||||||
|
{ previous: previous["tags"], current: current["tags"] }
|
||||||
|
end
|
||||||
|
|
||||||
def include_tags_changes?
|
def include_tags_changes?
|
||||||
SiteSetting.tagging_enabled
|
SiteSetting.tagging_enabled && previous["tags"] != current["tags"]
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
@ -190,7 +194,7 @@ class PostRevisionSerializer < ApplicationSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
if SiteSetting.tagging_enabled
|
if SiteSetting.tagging_enabled
|
||||||
latest_modifications["tags"] = post.topic.tags.map(&:name)
|
latest_modifications["tags"] = [post.topic.tags.map(&:name)]
|
||||||
end
|
end
|
||||||
|
|
||||||
post_revisions << PostRevision.new(
|
post_revisions << PostRevision.new(
|
||||||
|
|
|
@ -80,7 +80,7 @@ class PostRevisor
|
||||||
tc.check_result(false)
|
tc.check_result(false)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
tc.record_change('tags', prev_tags, tags)
|
tc.record_change('tags', prev_tags, tags) unless prev_tags.sort == tags.sort
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue