diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2015-08-12 22:39:58 +0300 |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2015-08-13 00:02:33 +0300 |
commit | 95f8f7c729a3a14ca6408ac050eb7bef6bb6fec4 (patch) | |
tree | a6704cd9812cf06af256033dd7b64d23ae05f0d1 | |
parent | cd579cb2ff45f3fc1513bb6ea74b53a2229276ae (diff) |
api: add 'system', 'upvote', and 'downvote' fields to note queries
This reverts commit 4c586dc7c217b3e43956919fa752a8fa4e16acb9.
-rw-r--r-- | app/models/note.rb | 4 | ||||
-rw-r--r-- | doc/api/notes.md | 10 | ||||
-rw-r--r-- | lib/api/entities.rb | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index a99d428b02d..913a8c00337 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -360,6 +360,10 @@ class Note < ActiveRecord::Base create_new_cross_references!(project, author) end + def system? + read_attribute(:system) + end + def editable? !read_attribute(:system) end diff --git a/doc/api/notes.md b/doc/api/notes.md index ee2f9fa0eac..c683cb883d4 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -31,7 +31,10 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "created_at": "2013-10-02T09:22:45Z" + "created_at": "2013-10-02T09:22:45Z", + "system": true, + "upvote": false, + "downvote": false }, { "id": 305, @@ -45,7 +48,10 @@ Parameters: "state": "active", "created_at": "2013-09-30T13:46:01Z" }, - "created_at": "2013-10-02T09:56:03Z" + "created_at": "2013-10-02T09:56:03Z", + "system": false, + "upvote": false, + "downvote": false } ] ``` diff --git a/lib/api/entities.rb b/lib/api/entities.rb index b5556682449..09d231af41b 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -205,6 +205,9 @@ module API expose :attachment_identifier, as: :attachment expose :author, using: Entities::UserBasic expose :created_at + expose :system?, as: :system + expose :upvote?, as: :upvote + expose :downvote?, as: :downvote end class MRNote < Grape::Entity |