diff --git a/app/models/abuse_report.rb b/app/models/abuse_report.rb index 73f99fe..07ec3c4 100644 --- a/app/models/abuse_report.rb +++ b/app/models/abuse_report.rb @@ -1,5 +1,7 @@ class AbuseReport < ActiveRecord::Base + attr_accessible :content, :reason + belongs_to :reporter, :class_name => 'Person' belongs_to :abuse_complaint has_many :reported_images, :dependent => :destroy diff --git a/app/models/task.rb b/app/models/task.rb index f12e870..dae66ea 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -57,7 +57,8 @@ class Task < ActiveRecord::Base after_create do |task| unless task.status == Task::Status::HIDDEN begin - task.send(:send_notification, :created) + # FIXME + # task.send(:send_notification, :created) rescue NotImplementedError => ex RAILS_DEFAULT_LOGGER.info ex.to_s end @@ -65,7 +66,8 @@ class Task < ActiveRecord::Base begin target_msg = task.target_notification_message if target_msg && task.target && !task.target.notification_emails.empty? - TaskMailer.deliver_target_notification(task, target_msg) + # FIXME + # TaskMailer.deliver_target_notification(task, target_msg) end rescue NotImplementedError => ex RAILS_DEFAULT_LOGGER.info ex.to_s @@ -220,7 +222,8 @@ class Task < ActiveRecord::Base self.status = Task::Status::ACTIVE save! begin - self.send(:send_notification, :activated) + # FIXME + # self.send(:send_notification, :activated) rescue NotImplementedError => ex RAILS_DEFAULT_LOGGER.info ex.to_s end @@ -228,7 +231,8 @@ class Task < ActiveRecord::Base begin target_msg = target_notification_message if target_msg && self.target && !self.target.notification_emails.empty? - TaskMailer.deliver_target_notification(self, target_msg) + # FIXME + # TaskMailer.deliver_target_notification(self, target_msg) end rescue NotImplementedError => ex RAILS_DEFAULT_LOGGER.info ex.to_s @@ -261,7 +265,8 @@ class Task < ActiveRecord::Base def send_notification(action) if sends_email? if self.requestor - TaskMailer.send("deliver_task_#{action}", self) + # FIXME + # TaskMailer.send("deliver_task_#{action}", self) end end end diff --git a/test/unit/abuse_report_test.rb b/test/unit/abuse_report_test.rb index c9f3fd6..7c81c96 100644 --- a/test/unit/abuse_report_test.rb +++ b/test/unit/abuse_report_test.rb @@ -14,8 +14,8 @@ class AbuseReportTest < ActiveSupport::TestCase abuse_report = AbuseReport.new(:reason => 'some reason') assert !abuse_report.valid? - assert abuse_report.errors.invalid?(:reporter) - assert abuse_report.errors.invalid?(:abuse_complaint) + assert abuse_report.invalid?(:reporter) + assert abuse_report.invalid?(:abuse_complaint) abuse_report.reporter = reporter abuse_report.abuse_complaint = abuse_complaint @@ -24,9 +24,15 @@ class AbuseReportTest < ActiveSupport::TestCase end should 'not allow more than one report by a user to the same complaint' do - abuse_report = AbuseReport.create!(:reporter => reporter, :abuse_complaint => abuse_complaint, :reason => 'some reason') + abuse_report = AbuseReport.new(:reason => 'some reason') + abuse_report.reporter = reporter + abuse_report.abuse_complaint = abuse_complaint + abuse_report.save! assert_raise ActiveRecord::RecordInvalid do - another_abuse = AbuseReport.create!(:reporter => reporter, :abuse_complaint => abuse_complaint, :reason => 'some reason') + another_abuse = AbuseReport.new(:reason => 'some reason') + another_abuse.reporter = reporter + another_abuse.abuse_complaint = abuse_complaint + another_abuse.save! end end end -- libgit2 0.21.2