votes: fix bug with tag scripting in show score mode.

Fix a bug where scores would disappear when applying tag scripts in show
scores mode.
This commit is contained in:
evazion
2021-11-28 01:26:09 -06:00
parent 9591fa1302
commit 59f8320d91
2 changed files with 5 additions and 2 deletions

View File

@@ -409,7 +409,10 @@ Post.update = async function(post_id, mode, params) {
Post.pending_update_count += 1;
Post.show_pending_update_notice()
await $.ajax({ type: "PUT", url: `/posts/${post_id}.js?mode=${mode}`, data: params });
let urlParams = new URLSearchParams(window.location.search);
let view = urlParams.get("view");
await $.ajax({ type: "PUT", url: `/posts/${post_id}.js?mode=${mode}&view=${view}`, data: params });
Post.pending_update_count -= 1;
Post.show_pending_update_notice();

View File

@@ -1,6 +1,6 @@
<% if @post.valid? %>
var $post = $("#post_<%= @post.id %>");
var $new_post = $("<%= j post_preview(@post, show_deleted: true) %>");
var $new_post = $("<%= j post_preview(@post, show_deleted: true, show_votes: params[:view] == "score") %>");
Danbooru.Blacklist.apply_post($new_post.get(0));
$("#post_<%= @post.id %>").replaceWith($new_post);
<% if params[:mode] == "quick-edit" %>