Fix #4318: Flags and appeals should reload page.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user