From 58d496e1461bb8d711cc6cef0b3cb5280d45365b Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg <maxwell@joindiaspora.com> Date: Sat, 15 Oct 2011 22:11:23 -0700 Subject: [PATCH] MS SM WIP --- .travis.yml | 1 - config/routes.rb | 1 + lib/stream/base.rb | 2 +- spec/lib/stream/base_spec.rb | 8 ++++---- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index d43ddbb426..0b826c315b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ branches: only: - 'master' - rvm: - 1.8.7 - ree diff --git a/config/routes.rb b/config/routes.rb index 0c3e44237a..f0abaf08cb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -168,6 +168,7 @@ Diaspora::Application.routes.draw do namespace :api do namespace :v0 do get "/users/:username" => 'users#show', :as => 'user' + get "/tags/:name" => 'tags#show', :as => 'tag' end end diff --git a/lib/stream/base.rb b/lib/stream/base.rb index 81f78e39e4..5717ea3297 100644 --- a/lib/stream/base.rb +++ b/lib/stream/base.rb @@ -120,7 +120,7 @@ class Stream::Base def post_is_from_contact?(post) @can_comment_cache ||= {} @can_comment_cache[post.id] ||= contacts_in_stream.find{|contact| contact.person_id == post.author.id}.present? - @can_comment_cache[post.id] ||= user.person.id == post.author.id + @can_comment_cache[post.id] ||= (user.person.id == post.author.id) @can_comment_cache[post.id] end end diff --git a/spec/lib/stream/base_spec.rb b/spec/lib/stream/base_spec.rb index f901a8d2b1..182627708f 100644 --- a/spec/lib/stream/base_spec.rb +++ b/spec/lib/stream/base_spec.rb @@ -11,22 +11,22 @@ describe Stream::Base do @stream.stub(:people).and_return([bob.person, eve.person, @person]) end - it 'returns true if user is a contact of the post author' do + it 'allows me to comment on my local contacts post' do post = Factory(:status_message, :author => bob.person) @stream.can_comment?(post).should be_true end - it 'returns true if a user is the author of the post' do + it 'allows me to comment on my own post' do post = Factory(:status_message, :author => alice.person) @stream.can_comment?(post).should be_true end - it 'returns true if the author of the post is local' do + it 'allows me to comment on any local public post' do post = Factory(:status_message, :author => eve.person) @stream.can_comment?(post).should be_true end - it 'returns true if person is remote and is a contact' do + it 'allows me to comment on a remote contacts post' do Contact.create!(:user => @stream.user, :person => @person) post = Factory(:status_message, :author => @person) @stream.can_comment?(post).should be_true -- GitLab