MS SM WIP
This commit is contained in:
parent
e1aa709c85
commit
58d496e146
4 changed files with 6 additions and 6 deletions
|
|
@ -2,7 +2,6 @@ branches:
|
|||
only:
|
||||
- 'master'
|
||||
|
||||
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- ree
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue