From 95e11e0ffcf63aa6d05053c7f767aa5ab358a042 Mon Sep 17 00:00:00 2001 From: evazion Date: Tue, 3 Mar 2020 22:38:43 -0600 Subject: [PATCH] Fix #4318: Flags and appeals should reload page. --- app/controllers/post_appeals_controller.rb | 1 + app/controllers/post_flags_controller.rb | 1 + app/views/post_appeals/create.js.erb | 7 +------ app/views/post_flags/create.js.erb | 9 +-------- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/app/controllers/post_appeals_controller.rb b/app/controllers/post_appeals_controller.rb index e78606ab4..46e79a0a9 100644 --- a/app/controllers/post_appeals_controller.rb +++ b/app/controllers/post_appeals_controller.rb @@ -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 diff --git a/app/controllers/post_flags_controller.rb b/app/controllers/post_flags_controller.rb index 9b999f27f..9fe07d0d2 100644 --- a/app/controllers/post_flags_controller.rb +++ b/app/controllers/post_flags_controller.rb @@ -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 diff --git a/app/views/post_appeals/create.js.erb b/app/views/post_appeals/create.js.erb index 938c5705a..345366b9b 100644 --- a/app/views/post_appeals/create.js.erb +++ b/app/views/post_appeals/create.js.erb @@ -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(); diff --git a/app/views/post_flags/create.js.erb b/app/views/post_flags/create.js.erb index 5e5f9b804..345366b9b 100644 --- a/app/views/post_flags/create.js.erb +++ b/app/views/post_flags/create.js.erb @@ -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();