From ac617544b89135626bd08685ae7ffb0b11c57932 Mon Sep 17 00:00:00 2001 From: Toks Date: Mon, 16 Nov 2015 10:25:33 -0500 Subject: [PATCH] fix #2540 --- app/models/post_appeal.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/models/post_appeal.rb b/app/models/post_appeal.rb index 26081ade6..11d85515b 100644 --- a/app/models/post_appeal.rb +++ b/app/models/post_appeal.rb @@ -72,6 +72,10 @@ class PostAppeal < ActiveRecord::Base !post.is_deleted? && !post.is_flagged? end + def is_resolved + resolved? + end + def validate_creator_is_not_limited if appeal_count_for_creator >= Danbooru.config.max_appeals_per_day errors[:creator] << "can appeal at most #{Danbooru.config.max_appeals_per_day} post a day" @@ -98,4 +102,23 @@ class PostAppeal < ActiveRecord::Base def appeal_count_for_creator PostAppeal.for_user(creator_id).recent.count end + + def serializable_hash(options = {}) + options ||= {} + options[:except] ||= [] + options[:except] += hidden_attributes + unless options[:builder] + options[:methods] ||= [] + options[:methods] += [:is_resolved] + end + hash = super(options) + hash + end + + def to_xml(options = {}, &block) + options ||= {} + options[:methods] ||= [] + options[:methods] += [:is_resolved] + super(options, &block) + end end