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.start_date}'
|
||||||
AND pr.created_at <= '#{report.end_date}'
|
AND pr.created_at <= '#{report.end_date}'
|
||||||
ORDER BY pr.created_at DESC
|
ORDER BY pr.created_at DESC
|
||||||
LIMIT 20
|
LIMIT #{report.limit || 20}
|
||||||
)
|
)
|
||||||
SELECT pr.editor_id,
|
SELECT pr.editor_id,
|
||||||
pr.editor_username,
|
pr.editor_username,
|
||||||
|
@ -83,9 +83,12 @@ Report.add_report('post_edits') do |report|
|
||||||
sql += <<~SQL
|
sql += <<~SQL
|
||||||
JOIN topics t
|
JOIN topics t
|
||||||
ON t.id = p.topic_id
|
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
|
SQL
|
||||||
|
else
|
||||||
|
sql += "WHERE p.user_id != editor_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
result = category_filter ? DB.query(sql, category_filter, category_filter) : DB.query(sql)
|
result = category_filter ? DB.query(sql, category_filter, category_filter) : DB.query(sql)
|
||||||
|
|
||||||
result.each do |r|
|
result.each do |r|
|
||||||
|
|
|
@ -544,6 +544,7 @@ describe Report do
|
||||||
before do
|
before do
|
||||||
freeze_time
|
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')
|
post.revise(editor, raw: 'updated body', edit_reason: 'not cool')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue