[Git][noosfero/noosfero][master] 2 commits: Update API to handle AbuseComplaint task

Victor Costa gitlab at mg.gitlab.com
Wed Nov 16 19:25:18 BRST 2016


Victor Costa pushed to branch master at Noosfero / noosfero


Commits:
1af159a0 by Marcelo Júnior at 2016-11-16T17:58:25-03:00
Update API to handle AbuseComplaint task

- - - - -
567689be by Victor Costa at 2016-11-16T21:25:15+00:00
Merge branch 'task-abuse-complaint' into 'master'

Update API to handle AbuseComplaint task

See merge request !1045
- - - - -


2 changed files:

- app/api/entities.rb
- app/api/helpers.rb


Changes:

=====================================
app/api/entities.rb
=====================================
--- a/app/api/entities.rb
+++ b/app/api/entities.rb
@@ -335,5 +335,16 @@ module Api
       expose :name
       expose :key
     end
+
+    class AbuseReport < Entity
+      expose :id
+      expose :reporter, using: Person
+      expose :reason
+      expose :created_at
+    end
+
+    class AbuseComplaint < Task
+      expose :abuse_reports, using: AbuseReport
+    end
   end
 end


=====================================
app/api/helpers.rb
=====================================
--- a/app/api/helpers.rb
+++ b/app/api/helpers.rb
@@ -178,6 +178,11 @@ module Api
     def present_task(asset, method_or_relation = 'tasks')
       task = find_task(asset, method_or_relation, params[:id])
       present_partial task, :with => Entities::Task
+      if task.kind_of?(AbuseComplaint)
+        present_partial task, :with => Entities::AbuseComplaint
+      else
+        present_partial task, :with => Entities::Task
+      end
     end
 
     def present_tasks_for_asset(asset, method_or_relation = 'tasks')



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/b92c269b5ec58791faae7347a73c16c1c6023dc6...567689bee8c1af3d898e2bdea231a09b0e15300f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20161116/f61e3d83/attachment-0001.html>


More information about the Noosfero-dev mailing list