From b9bc536a79549940938ac3ffa7d6239c3f48c993 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 18 Sep 2017 11:11:29 -0700 Subject: [PATCH 1/4] force s3 backup on post replacements if md5 doesn't change (ref #3290) --- app/models/post_replacement.rb | 2 ++ script/fixes/049_spam_1.rb | 14 -------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/app/models/post_replacement.rb b/app/models/post_replacement.rb index 133c63865..3ce7b5aac 100644 --- a/app/models/post_replacement.rb +++ b/app/models/post_replacement.rb @@ -57,6 +57,8 @@ class PostReplacement < ApplicationRecord if md5_changed post.comments.create!({creator: User.system, body: comment_replacement_message, do_not_bump_post: true}, without_protection: true) ModAction.log(modaction_replacement_message) + else + post.queue_backup end post.save! diff --git a/script/fixes/049_spam_1.rb b/script/fixes/049_spam_1.rb index b74f9c743..69038881c 100644 --- a/script/fixes/049_spam_1.rb +++ b/script/fixes/049_spam_1.rb @@ -32,20 +32,6 @@ end new_new_spammers = Set.new(Dmail.where("from_id >= ? and title in (?) and from_id not in (?)", MIN_USER_ID, BAD_TITLES, (spammers + new_spammers).to_a).pluck(:from_id)) combined_spammers = spammers + new_spammers + new_new_spammers -User.without_timeout do - combined_spammers.each do |uid| - user = User.find(uid) - tag_change_count = PostArchive.where(updater_id: uid).count - vote_count = PostVote.where(user_id: uid).count - comment_count = Comment.where(creator_id: uid).count - dmail_count = Dmail.where(from_id: uid).count - - if tag_change_count + vote_count + comment_count > 0 - puts "#{user.name},#{uid},#{tag_change_count},#{vote_count},#{comment_count},#{dmail_count}" - end - end -end - combined_spammers.each do |uid| unless Ban.where(user_id: uid).exists? Ban.create(duration: 10000, reason: "Spam (automated ref f6147ace)", user_id: uid) From 49109de1c51f13fc638c3ac120006e25b050cb1f Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 18 Sep 2017 11:48:47 -0700 Subject: [PATCH 2/4] update dtext gem --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index dfbc6dd26..cb7c1bcd5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,9 +15,9 @@ GIT GIT remote: https://github.com/r888888888/dtext_rb.git - revision: d93eace454647413a617cf9969f760806f88cc2f + revision: cde341011c0b7ceddcd0123c88bd67e1cdd9743c specs: - dtext_rb (1.5.1) + dtext_rb (1.6.0) nokogiri (~> 1.6) GIT From ffb212c616921536855931b8560d88707f082cf5 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 18 Sep 2017 15:00:39 -0700 Subject: [PATCH 3/4] remove extraneous links from post/show --- app/assets/javascripts/posts.js | 6 ------ app/views/posts/partials/show/_options.html.erb | 8 +++----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index db73d22aa..f83703933 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -179,12 +179,6 @@ } Danbooru.Post.initialize_links = function() { - $("#side-edit-link").click(function(e) { - $("#post-edit-link").trigger("click"); - $("#post_tag_string").trigger("focus"); - e.preventDefault(); - }); - $("#copy-notes").click(function(e) { var current_post_id = $("meta[name=post-id]").attr("content"); var other_post_id = parseInt(prompt("Enter the ID of the post to copy all notes to:"), 10); diff --git a/app/views/posts/partials/show/_options.html.erb b/app/views/posts/partials/show/_options.html.erb index c6f2d150e..4dd1f90d4 100644 --- a/app/views/posts/partials/show/_options.html.erb +++ b/app/views/posts/partials/show/_options.html.erb @@ -2,19 +2,17 @@
  • <%= link_to "Resize to window", "#", :id => "image-resize-to-window-link" %>
  • <%= link_to "Favorite", favorites_path(:post_id => post.id), :remote => true, :method => :post, :id => "add-to-favorites", :title => "Shortcut is F" %>
  • <%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %>
  • -
  • <%= link_to "Edit", "#", :id => "side-edit-link" %>
  • <%= link_to_if post.visible?, "Download", post.file_url, :download => post.presenter.humanized_essential_tag_string + " - " + post.file_name %>
  • -
  • <%= link_to "Random post", random_posts_path(:tags => params[:tags]), :id => "random-post" %>
  • <%= link_to "Add to pool", "#", :id => "pool" %>
  • <% if post.is_note_locked? %>
  • Note locked
  • <% else %> -
  • <%= link_to "Add notes", "#", :id => "translate", :title => "Shortcut is N" %>
  • +
  • <%= link_to "Add note", "#", :id => "translate", :title => "Shortcut is N" %>
  • <% end %> <% if CurrentUser.is_builder? && post.has_notes? %> -
  • <%= link_to "Copy all notes", "#", :id => "copy-notes" %>
  • +
  • <%= link_to "Copy notes", "#", :id => "copy-notes" %>
  • <% end %> -
  • <%= link_to "Add artist commentary", "#", :id => "add-commentary" %>
  • +
  • <%= link_to "Add commentary", "#", :id => "add-commentary" %>
  • <%= link_to "Add to favorite group", "#", :id => "open-favgroup-dialog-link" %>
  • <%= link_to "Find similar", iqdb_queries_path(:post_id => post.id), :method => :post, :remote => true %>
  • From 71c38208388cd8eb5d1b34dc8ce1a9deb84d4283 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Mon, 18 Sep 2017 15:24:54 -0700 Subject: [PATCH 4/4] tweak css --- app/assets/stylesheets/specific/posts.scss | 1 + .../stylesheets/specific/z_responsive.scss | 41 ++++++++++++------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/specific/posts.scss b/app/assets/stylesheets/specific/posts.scss index b4b57be01..93d15ba01 100644 --- a/app/assets/stylesheets/specific/posts.scss +++ b/app/assets/stylesheets/specific/posts.scss @@ -229,6 +229,7 @@ div#c-posts { .fav-buttons { font-size: 14pt; text-align: center; + margin: 0.5em 0; input[type=submit] { padding: 0.2em 0.75em; diff --git a/app/assets/stylesheets/specific/z_responsive.scss b/app/assets/stylesheets/specific/z_responsive.scss index 7e1cd20f5..682e0d6df 100644 --- a/app/assets/stylesheets/specific/z_responsive.scss +++ b/app/assets/stylesheets/specific/z_responsive.scss @@ -55,8 +55,24 @@ } form { - input[type=text], input[type=submit], select { - font-size: 1.5em; + input[type=text] { + vertical-align: top; + font-size: 24pt; + border: 1px solid #c5c5c5; + } + + textarea { + vertical-align: top; + border: 1px solid #c5c5c5; + } + + input[type=submit] { + font-size: 160%; + } + + input[type=submit].tiny { + font-size: 120%; + vertical-align: top; } } @@ -70,17 +86,17 @@ } div.paginator { - font-size: 20pt; + font-size: 24pt; font-weight: bold; - text-align: left; + text-align: center; width: 100%; padding: 0; margin: 0; margin-top: 1em; li { - width: 30vw; display: inline-block; + margin: 0 0.25em; a, span { margin: 0; @@ -104,27 +120,24 @@ article.post-preview { margin: 0.5vw; - width: 32vw; - height: 32vw; + width: 48.5vw; + height: 48.5vw; text-align: center; vertical-align: middle; display: inline-block; a { - width: 32vw; + width: 48.5vw; display: block; margin: 0 auto; } img { - object-fit: cover; - width: 32vw; - height: 32vw; + object-fit: contain; + width: 48.5vw; + height: 48.5vw; margin: 0 auto; border: none !important; } - img.cropped-true { - object-fit: cover; - } &[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=mp4]:before, &[data-file-ext=zip]:before { left: 0.5vw; @include animated-icon;