A platform for community discussion. Free, open, simple.
DEV: Minor review fixes and fix bookmark spec logging (#9045)
Martin Brennan8123538c9495
diff --git a/app/models/post.rb b/app/models/post.rbindex c0d69eac993..7e56dfa66bc 100644--- a/app/models/post.rb+++ b/app/models/post.rb@@ -918,8 +918,8 @@ class Post < ActiveRecord::Baseif SiteSetting.secure_media?Upload.where(id: upload_ids, access_control_post_id: nil- ).where.not(- id: CustomEmoji.pluck(:upload_id)+ ).where(+ 'id NOT IN (SELECT upload_id FROM custom_emojis)').update_all(access_control_post_id: self.id)diff --git a/spec/tasks/bookmarks_spec.rb b/spec/tasks/bookmarks_spec.rbindex 16fea02f982..68f8588e0ba 100644--- a/spec/tasks/bookmarks_spec.rb+++ b/spec/tasks/bookmarks_spec.rb@@ -17,8 +17,14 @@ RSpec.describe "bookmarks tasks" docreate_post_actions_and_existing_bookmarksend+ def invoke_task(args = nil)+ capture_stdout do+ Rake::Task['bookmarks:sync_to_table'].invoke(args)+ end+ end+it "migrates all PostActions" do- Rake::Task['bookmarks:sync_to_table'].invoke+ invoke_taskexpect(Bookmark.all.count).to eq(3)end@@ -26,14 +32,14 @@ RSpec.describe "bookmarks tasks" doit "does not create bookmarks that already exist in the bookmarks table for a user" doFabricate(:bookmark, user: user1, post: post1)- Rake::Task['bookmarks:sync_to_table'].invoke+ invoke_taskexpect(Bookmark.all.count).to eq(3)expect(Bookmark.where(post: post1, user: user1).count).to eq(1)endit "respects the sync_limit if provided and stops creating bookmarks at the limit (so this can be run progrssively" do- Rake::Task['bookmarks:sync_to_table'].invoke(1)+ invoke_task(1)expect(Bookmark.all.count).to eq(1)end