Files
danbooru/app/views/posts/partials/show/_options.html.erb
evazion df44937c57 post regenerations: replace PostRegeneration model with mod actions.
* Remove the PostRegeneration model. Instead just use a mod action
  to log when a post is regenerated.

* Change it so that IQDB is also updated when the image samples are
  regenerated. This is necessary because when the images samples are
  regenerated, the thumbnail may change, which means IQDB needs to be
  updated too. This can happen when regenerating old images with
  transparent backgrounds where the transparency was flattened to black
  instead of white in the thumbnail.

* Only display one "Regenerate image" option in the post sidebar, to
  regenerate both the images and IQDB. Regenerating IQDB only can be
  done through the API. Having two options in the sidebar is too much
  clutter, and it's too confusing for Mods who don't know the difference
  between an IQDB-only regeneration and a full image regeneration.

* Add a confirm prompt to the "Regenerate image" link.
2021-01-04 21:35:43 -06:00

94 lines
5.1 KiB
Plaintext

<ul>
<% if policy(post).visible? %>
<li id="post-option-resize-to-window">
<%= link_to "Resize to window", "#", class: "image-resize-to-window-link", "data-shortcut": "z" %>
</li>
<% end %>
<% if policy(post).visible? && post.has_large? && !post.is_ugoira? %>
<li id="post-option-view-large">
<%= link_to "View smaller", post.tagged_large_file_url, class: "image-view-large-link" %>
</li>
<li id="post-option-view-original">
<%= link_to "View original", post.tagged_file_url, class: "image-view-original-link" %>
</li>
<% end %>
<li id="post-option-find-similar">
<%= link_to "Find similar", iqdb_queries_path(post_id: post.id) %>
</li>
<% if policy(post).visible? %>
<li id="post-option-download">
<%= link_to "Download", post.tagged_file_url + "?download=1", download: post.presenter.filename_for_download %>
</li>
<% end %>
<% if policy(Favorite).create? %>
<li id="post-option-add-to-favorites">
<%= link_to "Favorite", favorites_path(post_id: post.id), remote: true, method: :post, id: "add-to-favorites", "data-shortcut": "f", style: ("display: none;" if @post.favorited_by?(CurrentUser.user)) %>
</li>
<li id="post-option-remove-from-favorites">
<%= link_to "Unfavorite", favorite_path(post), remote: true, method: :delete, id: "remove-from-favorites", "data-shortcut": "shift+f", "data-shortcut-when": ":visible", style: ("display: none;" if !@post.favorited_by?(CurrentUser.user)) %>
</li>
<% end %>
<% if policy(post).update? %>
<li id="post-option-edit"><%= link_to "Edit", "#edit", id: "side-edit-link" %></li>
<li id="post-option-add-to-pool"><%= link_to "Add to pool", "#", id: "pool" %></li>
<li id="post-option-add-note">
<% if post.is_note_locked? %>
<span id="note-locked-notice">Note locked</span>
<% else %>
<%= link_to "Add note", "#", id: "translate", "data-shortcut": "n" %>
<% end %>
</li>
<% if post.has_notes? %>
<li id="post-option-copy-notes"><%= link_to "Copy notes", "#", id: "copy-notes" %></li>
<% end %>
<li id="post-option-add-commentary"><%= link_to "Add commentary", "#", id: "add-commentary" %></li>
<% end %>
<% if policy(FavoriteGroup).create? %>
<li id="post-option-add-fav-group"><%= link_to "Add to fav group", "#", id: "open-favgroup-dialog-link", "data-shortcut": "g" %></li>
<% end %>
<% if post.is_status_locked? %>
<li id="post-option-status-locked">Status locked</li>
<% else %>
<% if post.is_active? && policy(PostFlag).create? %>
<li id="post-option-flag"><%= link_to "Flag", new_post_flag_path(post_flag: { post_id: post.id }), remote: true %></li>
<% elsif post.is_appealable? && policy(PostAppeal).create? %>
<li id="post-option-appeal"><%= link_to "Appeal", new_post_appeal_path(post_appeal: { post_id: post.id }), remote: true %></li>
<% end %>
<% if policy(PostApproval).create? %>
<% if post.is_approvable? %>
<li id="post-option-approve"><%= link_to (post.is_deleted? ? "Undelete" : "Approve"), post_approvals_path(post_id: post.id), remote: true, method: :post, "data-shortcut": "shift+o", "data-confirm": "Are you sure you want to approve this post?" %></li>
<li id="post-option-disapprove"><%= link_to "Hide from queue", post_disapprovals_path(post_disapproval: { post_id: post.id, reason: "disinterest" }), remote: true, method: :post %></li>
<% end %>
<% if post.is_deleted? && policy(post).move_favorites? %>
<li id="post-option-move-favorites"><%= link_to "Move favorites", confirm_move_favorites_moderator_post_post_path(post_id: post.id) %></li>
<% end %>
<% if !post.is_deleted? && policy(post).delete? %>
<li id="post-option-delete"><%= link_to "Delete", post, method: :delete, remote: true %></li>
<% end %>
<% if policy(post).unban? %>
<li id="post-option-unban"><%= link_to "Unban", unban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to unban this post?" %></li>
<% elsif policy(post).ban? %>
<li id="post-option-ban"><%= link_to "Ban", ban_moderator_post_post_path(post), method: :post, "data-confirm": "Are you sure you want to ban this post?" %></li>
<% end %>
<% if policy(post).expunge? %>
<li id="post-option-expunge"><%= link_to "Expunge", expunge_moderator_post_post_path(post_id: post.id), remote: true, method: :post, "data-confirm": "This will permanently delete this post (meaning the file will be deleted). Are you sure you want to delete this post?" %></li>
<% end %>
<% end %>
<% if policy(PostReplacement).create? %>
<li id="post-option-replace-image"><%= link_to "Replace image", new_post_replacement_path(post_id: post.id), remote: true %></li>
<% end %>
<% end %>
<% if policy(post).regenerate? %>
<li id="post-option-regenerate-preview"><%= link_to "Regenerate image", post_regenerations_path(post_id: post.id, category: "resizes"), remote: true, method: :post, "data-confirm": "This will regenerate the posts's thumbnail images. Are you sure?" %></li>
<% end %>
</ul>