FIX: Do not show self edits in Post Edits report. (#7510)
This commit is contained in:
parent
ea3004ef11
commit
8dfb15a2e5
|
@ -56,7 +56,7 @@ Report.add_report('post_edits') do |report|
|
|||
AND pr.created_at >= '#{report.start_date}'
|
||||
AND pr.created_at <= '#{report.end_date}'
|
||||
ORDER BY pr.created_at DESC
|
||||
LIMIT 20
|
||||
LIMIT #{report.limit || 20}
|
||||
)
|
||||
SELECT pr.editor_id,
|
||||
pr.editor_username,
|
||||
|
@ -83,9 +83,12 @@ Report.add_report('post_edits') do |report|
|
|||
sql += <<~SQL
|
||||
JOIN topics t
|
||||
ON t.id = p.topic_id
|
||||
WHERE t.category_id = ? OR t.category_id IN (SELECT id FROM categories WHERE categories.parent_category_id = ?)
|
||||
WHERE p.user_id != editor_id AND t.category_id = ? OR t.category_id IN (SELECT id FROM categories WHERE categories.parent_category_id = ?)
|
||||
SQL
|
||||
else
|
||||
sql += "WHERE p.user_id != editor_id"
|
||||
end
|
||||
|
||||
result = category_filter ? DB.query(sql, category_filter, category_filter) : DB.query(sql)
|
||||
|
||||
result.each do |r|
|
||||
|
|
|
@ -544,6 +544,7 @@ describe Report do
|
|||
before do
|
||||
freeze_time
|
||||
|
||||
post.revise(post.user, { raw: 'updated body by author', edit_reason: 'not cool' }, force_new_version: true)
|
||||
post.revise(editor, raw: 'updated body', edit_reason: 'not cool')
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue