diff --git a/app/models/post.rb b/app/models/post.rb index 437a62f4d..d75f8ea46 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1383,7 +1383,7 @@ class Post < ActiveRecord::Base end def notify_pubsub - return unless Danbooru.config.google_api_project + #return unless Danbooru.config.google_api_project PostUpdate.insert(id) end diff --git a/app/models/post_update.rb b/app/models/post_update.rb index 46c89c5ff..c755b06b1 100644 --- a/app/models/post_update.rb +++ b/app/models/post_update.rb @@ -1,11 +1,10 @@ class PostUpdate def self.insert(post_id) ActiveRecord::Base.execute_sql("insert into post_updates (post_id) values (?)", post_id) - rescue ActiveRecord::RecordNotUnique end def self.get - ActiveRecord::Base.select_values_sql("delete from post_updates returning post_id") + ActiveRecord::Base.select_values_sql("delete from post_updates returning post_id").uniq end def self.push diff --git a/app/views/posts/partials/index/_search_count.html.erb b/app/views/posts/partials/index/_search_count.html.erb index 764be7932..0acd8a60c 100644 --- a/app/views/posts/partials/index/_search_count.html.erb +++ b/app/views/posts/partials/index/_search_count.html.erb @@ -3,7 +3,9 @@ $.post("<%= Danbooru.config.report_server %>/hits", { key: "<%= key %>", value: "<%= value %>", - uid: <%= CurrentUser.user.id.to_s %>, + <% if CurrentUser.user.is_platinum? %> + uid: <%= CurrentUser.user.id %>, + <% end %> sig: "<%= sig %>" }); }); diff --git a/db/migrate/20160822230752_remove_uniqueness_constraint_on_post_updates.rb b/db/migrate/20160822230752_remove_uniqueness_constraint_on_post_updates.rb new file mode 100644 index 000000000..7e52d8d46 --- /dev/null +++ b/db/migrate/20160822230752_remove_uniqueness_constraint_on_post_updates.rb @@ -0,0 +1,8 @@ +class RemoveUniquenessConstraintOnPostUpdates < ActiveRecord::Migration + def up + execute "alter table post_updates drop constraint unique_post_id" + end + + def down + end +end diff --git a/db/structure.sql b/db/structure.sql index 013293abe..0cb17e044 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4759,14 +4759,6 @@ ALTER TABLE ONLY transaction_log_items ADD CONSTRAINT transaction_log_items_pkey PRIMARY KEY (id); --- --- Name: unique_post_id; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY post_updates - ADD CONSTRAINT unique_post_id UNIQUE (post_id); - - -- -- Name: uploads_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -7410,3 +7402,5 @@ INSERT INTO schema_migrations (version) VALUES ('20160526174848'); INSERT INTO schema_migrations (version) VALUES ('20160820003534'); +INSERT INTO schema_migrations (version) VALUES ('20160822230752'); +