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