Fix #4318: Flags and appeals should reload page.

This commit is contained in:
evazion
2020-03-03 22:38:43 -06:00
parent 266e4054b0
commit 95e11e0ffc
4 changed files with 4 additions and 14 deletions

View File

@@ -21,6 +21,7 @@ class PostAppealsController < ApplicationController
def create
@post_appeal = PostAppeal.create(post_appeal_params.merge(creator: CurrentUser.user))
flash[:notice] = @post_appeal.errors.none? ? "Post appealed" : @post_appeal.errors.full_messages.join("; ")
respond_with(@post_appeal)
end

View File

@@ -21,6 +21,7 @@ class PostFlagsController < ApplicationController
def create
@post_flag = PostFlag.create(post_flag_params.merge(creator: CurrentUser.user))
flash[:notice] = @post_flag.errors.none? ? "Post flagged" : @post_flag.errors.full_messages.join("; ")
respond_with(@post_flag)
end

View File

@@ -1,6 +1 @@
var errors = "<%= j @post_appeal.errors.full_messages.join("; ") %>";
if (errors.length > 0) {
Danbooru.error(errors);
} else {
Danbooru.notice("Post appealed");
}
location.reload();

View File

@@ -1,8 +1 @@
var errors = <%= @post_flag.errors.full_messages.to_json.html_safe %>;
if (errors.length > 0) {
Danbooru.error(errors.join("; "));
} else {
Danbooru.notice("Post flagged");
$("a#approve").show();
$("a#disapprove").show();
}
location.reload();