mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
db consistency check for mismatching topic_ids in user_actions
fix up post mover so it remaps user actions as well move specs for post mover into post_mover_spec
This commit is contained in:
@@ -9,7 +9,6 @@ describe UserAction do
|
||||
it { should validate_presence_of :action_type }
|
||||
it { should validate_presence_of :user_id }
|
||||
|
||||
|
||||
describe 'lists' do
|
||||
|
||||
let(:public_post) { Fabricate(:post) }
|
||||
@@ -257,4 +256,26 @@ describe UserAction do
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ensure_consistency!' do
|
||||
it 'correct target_topic_id' do
|
||||
post = Fabricate(:post)
|
||||
|
||||
action = UserAction.log_action!(
|
||||
action_type: UserAction::NEW_PRIVATE_MESSAGE,
|
||||
user_id: post.user.id,
|
||||
acting_user_id: post.user.id,
|
||||
target_topic_id: -1,
|
||||
target_post_id: post.id,
|
||||
)
|
||||
|
||||
action.reload
|
||||
action.target_topic_id.should == -1
|
||||
|
||||
UserAction.ensure_consistency!
|
||||
action.reload
|
||||
action.target_topic_id.should == post.topic_id
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user