mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 02:11:08 -06:00
work in progress, will finalize soon
This commit is contained in:
parent
2162e3bbb5
commit
5e23a0681d
@ -248,8 +248,13 @@ SQL
|
||||
builder.exec
|
||||
end
|
||||
|
||||
def self.synchronize_favorites
|
||||
|
||||
end
|
||||
|
||||
def self.ensure_consistency!
|
||||
self.synchronize_target_topic_ids
|
||||
self.synchronize_favorites
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -261,7 +261,23 @@ describe UserAction do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ensure_consistency!' do
|
||||
describe 'synchronize_favorites' do
|
||||
pending 'corrects out of sync favs' do
|
||||
post = Fabricate(:post)
|
||||
post.topic.toggle_star(post.user, true)
|
||||
|
||||
action1 = UserAction.log_action!(
|
||||
action_type: UserAction::STAR,
|
||||
user_id: post.user.id,
|
||||
acting_user_id: post.user.id,
|
||||
target_topic_id: -1,
|
||||
target_post_id: post.id,
|
||||
)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
describe 'synchronize_target_topic_ids' do
|
||||
it 'correct target_topic_id' do
|
||||
post = Fabricate(:post)
|
||||
|
||||
@ -281,11 +297,10 @@ describe UserAction do
|
||||
target_post_id: post.id,
|
||||
)
|
||||
|
||||
UserAction.ensure_consistency!
|
||||
UserAction.synchronize_target_topic_ids
|
||||
|
||||
action.reload
|
||||
action.target_topic_id.should == post.topic_id
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user