Fix #3813: Favorite limit can be bypassed.

This commit is contained in:
evazion
2018-08-12 14:22:08 -05:00
parent 202527008f
commit fb91bbc6c5
6 changed files with 56 additions and 69 deletions

View File

@@ -1,17 +1,13 @@
<% if @error_msg %>
$(window).trigger("danbooru:error", "<%= @error_msg %>");
<% else %>
$("#add-to-favorites").hide();
$("#add-fav-button").hide();
$("#remove-from-favorites").show();
$("#remove-fav-button").show();
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
$("#favcount-for-post-<%= @post.id %>").html(<%= @post.fav_count %>);
<% if CurrentUser.is_gold? %>
$("#favlist").html("<%= escape_javascript(post_favlist(@post)) %>");
if (!$("#favlist").is(":visible")) {
$("#show-favlist-link").show();
}
<% end %>
$(window).trigger("danbooru:notice", "You have favorited this post");
$("#add-to-favorites").hide();
$("#add-fav-button").hide();
$("#remove-from-favorites").show();
$("#remove-fav-button").show();
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
$("#favcount-for-post-<%= @post.id %>").html(<%= @post.fav_count %>);
<% if CurrentUser.is_gold? %>
$("#favlist").html("<%= escape_javascript(post_favlist(@post)) %>");
if (!$("#favlist").is(":visible")) {
$("#show-favlist-link").show();
}
<% end %>
$(window).trigger("danbooru:notice", "You have favorited this post");

View File

@@ -0,0 +1,2 @@
var message = <%= raw @error_message.try(:to_json) || @exception.message.to_json %>;
Danbooru.Utility.error(message);