Commit fc127ddf by Kevin Chugh

convert flagging to one flag

parent dc5b26be
4727: Locked by 4727 at Wed Nov 28 11:21:00 -0500 2012
20566: Locked by 20566 at Sun Dec 02 07:30:57 -0500 2012
---
cursor_positions:
- :path: .gitignore
:cursor_offset: 0
:timestamp: 2012-09-21 19:42:27 -04:00
:cursor_offset: 71
:timestamp: 2012-12-02 00:17:35 -05:00
- :path: api/votes.rb
:cursor_offset: 277
:timestamp: 2012-11-20 19:17:31 -05:00
- :path: api/commentables.rb
:cursor_offset: 208
:timestamp: 2012-11-20 19:17:31 -05:00
- :path: api/comment_threads.rb
:cursor_offset: 195
:timestamp: 2012-11-20 19:17:31 -05:00
- :path: models/comment_thread.rb
:cursor_offset: 6463
:timestamp: 2012-12-02 08:32:40 -05:00
files_to_retain: 0
......@@ -2,8 +2,8 @@ put "#{APIPREFIX}/comments/:comment_id/abuse_flags" do |comment_id|
flag_as_abuse comment
end
put "#{APIPREFIX}/threads/:thread_id/abuse_flags" do |thread_id|
flag_as_abuse thread
put "#{APIPREFIX}/threads/:thread_id/abuse_unflags" do |thread_id|
un_flag_as_abuse thread
end
......@@ -14,22 +14,3 @@ end
delete "#{APIPREFIX}/comments/:thread_id/abuse_flags" do |thread_id|
undo_flag_as_abuse thread
end
put "#{APIPREFIX}/comments/:comment_id/spoiler_flags" do |comment_id|
flag_as_spoiler comment
end
put "#{APIPREFIX}/comments/:thread_id/spoiler_flags" do |thread_id|
flag_as_spoiler thread
end
delete "#{APIPREFIX}/comments/:comment_id/spoiler_flags" do |comment_id|
undo_flag_as_spoiler comment
end
delete "#{APIPREFIX}/comments/:thread_id/spoiler_flags" do |thread_id|
undo_flag_as_spoiler thread
end
......@@ -43,6 +43,13 @@ helpers do
obj.save
obj.reload.to_hash.to_json
end
def un_flag_as_abuse(obj)
raise ArgumentError, "User id is required" unless user
obj.abuse_flaggers.delete user.id
obj.save
obj.reload.to_hash.to_json
end
def undo_vote_for(obj)
raise ArgumentError, "must provide user id" unless user
......
......@@ -159,7 +159,6 @@ class CommentThread < Content
"username" => author.username,
"votes" => votes.slice(*%w[count up_count down_count point]),
"abuse_flaggers" => abuse_flaggers,
"spoiler_flaggers" => spoiler_flaggers,
"tags" => tags_array,
"type" => "thread",
"endorsed" => endorsed?)
......
......@@ -4,7 +4,6 @@ class Content
field :visible, type: Boolean, default: true
field :abuse_flaggers, type: Array, default: []
field :spoiler_flaggers, type: Array, default: []
def author_with_anonymity(attr=nil, attr_when_anonymous=nil)
if not attr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment