FIX: Add test to confirm updating category works.
Also replaces a missing translation key that 99.9% of users would never see.
This commit is contained in:
parent
7869a10d18
commit
da0e37512a
|
@ -4452,6 +4452,8 @@ en:
|
||||||
title: "Delete Spammer"
|
title: "Delete Spammer"
|
||||||
description: "Remove the user and all their posts and topics."
|
description: "Remove the user and all their posts and topics."
|
||||||
confirm: "Are you sure you want to delete all that user's posts, topics, and block their IP and email addresses?"
|
confirm: "Are you sure you want to delete all that user's posts, topics, and block their IP and email addresses?"
|
||||||
|
delete_single:
|
||||||
|
title: "Delete"
|
||||||
delete:
|
delete:
|
||||||
title: "Delete..."
|
title: "Delete..."
|
||||||
delete_and_ignore:
|
delete_and_ignore:
|
||||||
|
|
|
@ -15,6 +15,7 @@ class Reviewable < ActiveRecord::Base
|
||||||
{
|
{
|
||||||
approve: Action.new(:approve, 'thumbs-up', 'reviewables.actions.approve.title'),
|
approve: Action.new(:approve, 'thumbs-up', 'reviewables.actions.approve.title'),
|
||||||
reject: Action.new(:reject, 'thumbs-down', 'reviewables.actions.reject.title'),
|
reject: Action.new(:reject, 'thumbs-down', 'reviewables.actions.reject.title'),
|
||||||
|
delete: Action.new(:delete, 'trash-alt', 'reviewables.actions.delete_single.title')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,17 @@ RSpec.describe Reviewable, type: :model do
|
||||||
expect(reviewable.category).to eq(post.topic.category)
|
expect(reviewable.category).to eq(post.topic.category)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "will update the category if the topic category changes" do
|
||||||
|
post = Fabricate(:post)
|
||||||
|
moderator = Fabricate(:moderator)
|
||||||
|
reviewable = PostActionCreator.spam(moderator, post).reviewable
|
||||||
|
expect(reviewable.category).to eq(post.topic.category)
|
||||||
|
new_cat = Fabricate(:category)
|
||||||
|
PostRevisor.new(post).revise!(moderator, category_id: new_cat.id)
|
||||||
|
expect(post.topic.reload.category).to eq(new_cat)
|
||||||
|
expect(reviewable.reload.category).to eq(new_cat)
|
||||||
|
end
|
||||||
|
|
||||||
it "can create multiple objects with a NULL target" do
|
it "can create multiple objects with a NULL target" do
|
||||||
r0 = ReviewableQueuedPost.needs_review!(created_by: admin, payload: { raw: 'hello world I am a post' })
|
r0 = ReviewableQueuedPost.needs_review!(created_by: admin, payload: { raw: 'hello world I am a post' })
|
||||||
expect(r0).to be_present
|
expect(r0).to be_present
|
||||||
|
|
Loading…
Reference in New Issue