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
1354120149
Comment /home/kevin/mitx_all/cs_comments_service/models/comment.rb class Comment
CommentThread /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb class CommentThread
RE_CHAR /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb RE_CHAR =
RE_ENDCHAR /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb RE_ENDCHAR =
RE_ENDONLYCHAR /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb RE_ENDONLYCHAR =
RE_HEADCHAR /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb RE_HEADCHAR =
RE_TAG /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb RE_TAG =
RE_WORD /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb RE_WORD =
activity_overall /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def activity_overall;
activity_since /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def activity_since(from_time=nil)
activity_this_month /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def activity_this_month;
activity_this_week /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def activity_this_week;
activity_today /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def activity_today;
commentable /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def commentable
destroy_subscriptions /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def destroy_subscriptions
endorsed? /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def endorsed?
hash_tree /home/kevin/mitx_all/cs_comments_service/models/comment.rb def self.hash_tree(nodes)
new_dumb_thread /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def self.new_dumb_thread(options={})
perform_search /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def self.perform_search(params, options={})
root_comments /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def root_comments
search_result_to_hash /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def self.search_result_to_hash(result, params={})
set_last_activity_at /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def set_last_activity_at
set_thread_last_activity_at /home/kevin/mitx_all/cs_comments_service/models/comment.rb def set_thread_last_activity_at
subscribers /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def subscribers
subscriptions /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def subscriptions
tag_name_valid? /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def self.tag_name_valid?(tag)
tag_names_unique /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def tag_names_unique
tag_names_valid /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def tag_names_valid
to_hash /home/kevin/mitx_all/cs_comments_service/models/comment.rb def to_hash(params={})
to_hash /home/kevin/mitx_all/cs_comments_service/models/comment_thread.rb def to_hash(params={})
1354462766
Comment /Users/kevinchugh/mitx_all/cs_comments_service/models/comment.rb class Comment
CommentThread /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb class CommentThread
Content /Users/kevinchugh/mitx_all/cs_comments_service/models/content.rb class Content
DELETE /api/v1/threads/:thread_id /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "DELETE /api/v1/threads/:thread_id" do
GET /api/v1/threads/:thread_id /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "GET /api/v1/threads/:thread_id" do
GET /api/v1/threads/tags /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "GET /api/v1/threads/tags" do
GET /api/v1/threads/tags/autocomplete /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "GET /api/v1/threads/tags/autocomplete" do
POST /api/v1/threads/:thread_id/comments /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "POST /api/v1/threads/:thread_id/comments" do
PUT /api/v1/threads/:thread_id /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "PUT /api/v1/threads/:thread_id" do
RE_CHAR /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb RE_CHAR =
RE_ENDCHAR /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb RE_ENDCHAR =
RE_ENDONLYCHAR /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb RE_ENDONLYCHAR =
RE_HEADCHAR /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb RE_HEADCHAR =
RE_TAG /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb RE_TAG =
RE_WORD /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb RE_WORD =
abuse /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb describe "abuse" do
activity_overall /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def activity_overall;
activity_since /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def activity_since(from_time=nil)
activity_this_month /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def activity_this_month;
activity_this_week /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def activity_this_week;
activity_today /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def activity_today;
allows anonymous comment /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "allows anonymous comment" do
app /Users/kevinchugh/mitx_all/cs_comments_service/spec/spec_helper.rb def app
app /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "app" do
app /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb describe "app" do
author_contents_only /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def author_contents_only(contents, author_id)
author_with_anonymity /Users/kevinchugh/mitx_all/cs_comments_service/models/content.rb def author_with_anonymity(attr=nil, attr_when_anonymous=nil)
bool_anonymous /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def bool_anonymous
bool_anonymous_to_peers /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def bool_anonymous_to_peers
bool_auto_subscribe /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def bool_auto_subscribe
bool_complete /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def bool_complete
bool_mark_as_read /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def bool_mark_as_read
bool_recursive /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def bool_recursive
comment /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def comment
comment threads /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb describe "comment threads" do
commentable /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def commentable
commentable /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def commentable
create a comment to the comment thread /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "create a comment to the comment thread" do
create or update the abuse_flags on the comment /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "create or update the abuse_flags on the comment" do
create or update the abuse_flags on the thread /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "create or update the abuse_flags on the thread" do
create_comment_flag /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb def create_comment_flag(comment_id, user_id)
create_comment_thread /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb def create_comment_thread(tags)
create_flag /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb def create_flag(put_command, user_id)
create_test_user /Users/kevinchugh/mitx_all/cs_comments_service/spec/spec_helper.rb def create_test_user(id)
create_thread_flag /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb def create_thread_flag(thread_id, user_id)
delete the comment thread and its comments /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "delete the comment thread and its comments" do
destroy_subscriptions /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def destroy_subscriptions
endorsed? /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def endorsed?
flag a comment as abusive /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb describe "flag a comment as abusive" do
flag a thread as abusive /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb describe "flag a thread as abusive" do
flag_as_abuse /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def flag_as_abuse(obj)
get all tags used in threads /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "get all tags used in threads" do
get information of a single comment thread /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "get information of a single comment thread" do
get information of a single comment thread with its comments /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "get information of a single comment thread with its comments" do
get information of a single comment thread with its tags /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "get information of a single comment thread with its tags" do
handle_paged_threads_query /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def handle_paged_threads_query(paged_comment_threads)
handle_threads_query /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def handle_threads_query(comment_threads)
has a correct hash /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "has a correct hash" do
has a correct hash /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "has a correct hash" do
hash_tree /Users/kevinchugh/mitx_all/cs_comments_service/models/comment.rb def self.hash_tree(nodes)
init_with_subscriptions /Users/kevinchugh/mitx_all/cs_comments_service/spec/spec_helper.rb def init_with_subscriptions
init_without_subscriptions /Users/kevinchugh/mitx_all/cs_comments_service/spec/spec_helper.rb def init_without_subscriptions
new_dumb_thread /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def self.new_dumb_thread(options={})
parse /Users/kevinchugh/mitx_all/cs_comments_service/spec/spec_helper.rb def parse(text)
perform_search /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def self.perform_search(params, options={})
returns 400 when the comment does not exist /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "returns 400 when the comment does not exist" do
returns 400 when the thread does not exist /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "returns 400 when the thread does not exist" do
returns 400 when the thread does not exist /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "returns 400 when the thread does not exist" do
returns 400 when the thread does not exist /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "returns 400 when the thread does not exist" do
returns 400 when the thread does not exist /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "returns 400 when the thread does not exist" do
returns 400 when the thread does not exist /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "returns 400 when the thread does not exist" do
returns 400 when user_id is not provided /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "returns 400 when user_id is not provided" do
returns 400 when user_id is not provided /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/abuse_spec.rb it "returns 400 when user_id is not provided" do
returns autocomplete results /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "returns autocomplete results" do
returns error when body or course_id does not exist, or when body is blank /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "returns error when body or course_id does not exist, or when body is blank" do
root_comments /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def root_comments
search_result_to_hash /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def self.search_result_to_hash(result, params={})
set_last_activity_at /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def set_last_activity_at
set_thread_last_activity_at /Users/kevinchugh/mitx_all/cs_comments_service/models/comment.rb def set_thread_last_activity_at
source /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def source
subscribers /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def subscribers
subscriptions /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def subscriptions
tag_name_valid? /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def self.tag_name_valid?(tag)
tag_names_unique /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def tag_names_unique
tag_names_valid /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def tag_names_valid
thread /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def thread
to_hash /Users/kevinchugh/mitx_all/cs_comments_service/models/comment.rb def to_hash(params={})
to_hash /Users/kevinchugh/mitx_all/cs_comments_service/models/comment_thread.rb def to_hash(params={})
un_flag_as_abuse /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def un_flag_as_abuse(obj)
undo_vote_for /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def undo_vote_for(obj)
update information of comment thread /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "update information of comment thread" do
updates tag of comment thread /Users/kevinchugh/mitx_all/cs_comments_service/spec/api/comment_thread_spec.rb it "updates tag of comment thread" do
user /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def user
value_to_boolean /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def value_to_boolean(value)
vote_for /Users/kevinchugh/mitx_all/cs_comments_service/lib/helpers.rb def vote_for(obj)
......@@ -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