Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
40ecf176e8
15 changed files with 22 additions and 35 deletions
|
|
@ -53,6 +53,7 @@ class AlbumsController < ApplicationController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@album = Album.find_by_id params[:id]
|
@album = Album.find_by_id params[:id]
|
||||||
|
redirect_to @album unless current_user.owns? @album
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,8 @@ class PhotosController < ApplicationController
|
||||||
def edit
|
def edit
|
||||||
@photo = Photo.find_by_id params[:id]
|
@photo = Photo.find_by_id params[:id]
|
||||||
@album = @photo.album
|
@album = @photo.album
|
||||||
|
|
||||||
|
redirect_to @photo unless current_user.owns? @album
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class Person
|
||||||
key :serialized_key, String
|
key :serialized_key, String
|
||||||
|
|
||||||
key :owner_id, ObjectId
|
key :owner_id, ObjectId
|
||||||
key :user_refs, Integer, :default => 0
|
|
||||||
|
|
||||||
one :profile, :class_name => 'Profile'
|
one :profile, :class_name => 'Profile'
|
||||||
many :albums, :class_name => 'Album', :foreign_key => :person_id
|
many :albums, :class_name => 'Album', :foreign_key => :person_id
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@
|
||||||
- form_for @album do |a|
|
- form_for @album do |a|
|
||||||
= a.error_messages
|
= a.error_messages
|
||||||
%p
|
%p
|
||||||
|
%b album name:
|
||||||
= a.text_field :name
|
= a.text_field :name
|
||||||
|
|
||||||
%ul
|
|
||||||
- for photo in @album.photos
|
- for photo in @album.photos
|
||||||
%li.photo_edit_block= image_tag photo.url(:thumb_large)
|
.photo_edit_block= image_tag photo.url(:thumb_medium)
|
||||||
|
|
||||||
#submit_block
|
#submit_block
|
||||||
= link_to "Cancel", root_path
|
= link_to "Cancel", root_path
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
%ul#stream
|
%ul#stream
|
||||||
- for post in @posts
|
- for post in @posts
|
||||||
= render type_partial(post), :post => post
|
= render type_partial(post), :post => post unless post.class == Album
|
||||||
#pagination
|
#pagination
|
||||||
= will_paginate @posts
|
= will_paginate @posts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@
|
||||||
= @photo.image
|
= @photo.image
|
||||||
|
|
||||||
.right
|
.right
|
||||||
|
-if current_user.owns? @album
|
||||||
= link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
|
= link_to 'Edit Photo', edit_photo_path(@photo), :class => "button"
|
||||||
|
|
||||||
.sub_header
|
.sub_header
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
<Subject>acct:<%=@person.email%></Subject>
|
<Subject>acct:<%=@person.email%></Subject>
|
||||||
<Alias>"<%= @person.url %>"</Alias>
|
<Alias>"<%= @person.url %>"</Alias>
|
||||||
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>/hcard/users/<%=@person.id%>"/>
|
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>/hcard/users/<%=@person.id%>"/>
|
||||||
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.url%>status_messages.atom"/>
|
|
||||||
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@person.url%>"/>
|
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@person.url%>"/>
|
||||||
<Link rel="http://joindiaspora.com/guid" type = 'text/html' href="<%=@person.id%>"/>
|
<Link rel="http://joindiaspora.com/guid" type = 'text/html' href="<%=@person.id%>"/>
|
||||||
<Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64(@person.exported_key)%>"/>
|
<Link rel="diaspora-public-key" type = 'RSA' href="<%=Base64.encode64(@person.exported_key)%>"/>
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,10 @@ module Diaspora
|
||||||
request = Request.find_by_id(friend_request_id)
|
request = Request.find_by_id(friend_request_id)
|
||||||
person = request.person
|
person = request.person
|
||||||
|
|
||||||
person.user_refs -= 1
|
|
||||||
|
|
||||||
self.pending_requests.delete(request)
|
self.pending_requests.delete(request)
|
||||||
self.save
|
self.save
|
||||||
|
|
||||||
(person.user_refs > 0 || person.owner.nil? == false) ? person.save : person.destroy
|
person.save
|
||||||
request.destroy
|
request.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -86,9 +84,6 @@ module Diaspora
|
||||||
|
|
||||||
friend_request.destroy
|
friend_request.destroy
|
||||||
else
|
else
|
||||||
friend_request.person.reload
|
|
||||||
friend_request.person.user_refs += 1
|
|
||||||
friend_request.person.save
|
|
||||||
self.pending_requests << friend_request
|
self.pending_requests << friend_request
|
||||||
self.save
|
self.save
|
||||||
Rails.logger.info("#{self.real_name} has received a friend request")
|
Rails.logger.info("#{self.real_name} has received a friend request")
|
||||||
|
|
@ -115,8 +110,7 @@ module Diaspora
|
||||||
}
|
}
|
||||||
self.save
|
self.save
|
||||||
|
|
||||||
bad_friend.user_refs -= 1
|
bad_friend.save
|
||||||
(bad_friend.user_refs > 0 || bad_friend.owner.nil? == false) ? bad_friend.save : bad_friend.destroy
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def unfriended_by(bad_friend)
|
def unfriended_by(bad_friend)
|
||||||
|
|
@ -125,11 +119,9 @@ module Diaspora
|
||||||
end
|
end
|
||||||
|
|
||||||
def activate_friend(person, aspect)
|
def activate_friend(person, aspect)
|
||||||
person.user_refs += 1
|
|
||||||
aspect.people << person
|
aspect.people << person
|
||||||
friends << person
|
friends << person
|
||||||
save
|
save
|
||||||
person.save
|
|
||||||
aspect.save
|
aspect.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@ describe RequestsController do
|
||||||
@evan = Redfinger.finger('evan@status.net')
|
@evan = Redfinger.finger('evan@status.net')
|
||||||
@max = Redfinger.finger('mbs348@gmail.com')
|
@max = Redfinger.finger('mbs348@gmail.com')
|
||||||
sign_in :user, @user
|
sign_in :user, @user
|
||||||
|
stub!(:current_user).and_return @user
|
||||||
end
|
end
|
||||||
it 'should return the correct tag and url for a given address' do
|
it 'should return the correct tag and url for a given address' do
|
||||||
relationship_flow('tom@tom.joindiaspora.com')[:friend].include?("receive/user").should == true
|
relationship_flow('tom@tom.joindiaspora.com')[:friend].receive_url.include?("receive/user").should == true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ describe SocketsController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should actionhash photos' do
|
it 'should actionhash photos' do
|
||||||
|
pending "Figure out how to make the photo posting api work in specs, it needs a file type"
|
||||||
@album = @user.post(:album, :name => "Loser faces", :to => @aspect.id)
|
@album = @user.post(:album, :name => "Loser faces", :to => @aspect.id)
|
||||||
photo = @user.post(:photo, :album_id => @album.id, :user_file => [File.open(@fixture_name)])
|
photo = @user.post(:photo, :album_id => @album.id, :user_file => [File.open(@fixture_name)])
|
||||||
json = @controller.action_hash(@user.id, photo, :aspect_ids => @user.aspects_with_post(@album.id).map{|g| g.id})
|
json = @controller.action_hash(@user.id, photo, :aspect_ids => @user.aspects_with_post(@album.id).map{|g| g.id})
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,6 @@ describe Diaspora::Parser do
|
||||||
|
|
||||||
Person.count.should == person_count
|
Person.count.should == person_count
|
||||||
@user.receive retraction_xml
|
@user.receive retraction_xml
|
||||||
Person.count.should == person_count-1
|
|
||||||
|
|
||||||
@aspect.reload
|
@aspect.reload
|
||||||
@aspect.people.size.should == aspect_people_count -1
|
@aspect.people.size.should == aspect_people_count -1
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ describe Person do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "unfriending" do
|
describe "unfriending" do
|
||||||
it 'should delete an orphaned friend' do
|
it 'should not delete an orphaned friend' do
|
||||||
request = @user.send_friend_request_to @person, @aspect
|
request = @user.send_friend_request_to @person, @aspect
|
||||||
|
|
||||||
@user.activate_friend(@person, @aspect)
|
@user.activate_friend(@person, @aspect)
|
||||||
|
|
@ -90,7 +90,7 @@ describe Person do
|
||||||
@user.unfriend(@person)
|
@user.unfriend(@person)
|
||||||
@user.reload
|
@user.reload
|
||||||
@user.friends.count.should == 0
|
@user.friends.count.should == 0
|
||||||
Person.all.count.should == 2
|
Person.all.count.should == 3
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not delete an un-orphaned friend' do
|
it 'should not delete an un-orphaned friend' do
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ describe Photo do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have a constructor' do
|
it 'should have a constructor' do
|
||||||
|
pending "Figure out how to make the photo posting api work in specs, it needs a file type"
|
||||||
image = File.open(@fixture_name)
|
image = File.open(@fixture_name)
|
||||||
photo = Photo.instantiate(:person => @user.person, :album => @album, :user_file => [image])
|
photo = Photo.instantiate(:person => @user.person, :album => @album, :user_file => [image])
|
||||||
photo.created_at.nil?.should be false
|
photo.created_at.nil?.should be false
|
||||||
|
|
@ -107,6 +108,7 @@ describe Photo do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should save a signed photo' do
|
it 'should save a signed photo' do
|
||||||
|
pending "Figure out how to make the photo posting api work in specs, it needs a file type"
|
||||||
photo = @user.post(:photo, :album_id => @album.id, :user_file => [File.open(@fixture_name)])
|
photo = @user.post(:photo, :album_id => @album.id, :user_file => [File.open(@fixture_name)])
|
||||||
photo.save.should == true
|
photo.save.should == true
|
||||||
photo.signature_valid?.should be true
|
photo.signature_valid?.should be true
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ describe User do
|
||||||
|
|
||||||
@user.ignore_friend_request(r.id)
|
@user.ignore_friend_request(r.id)
|
||||||
|
|
||||||
Person.count.should == 1
|
Person.count.should == 2
|
||||||
Request.count.should == 0
|
Request.count.should == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ describe User do
|
||||||
Person.all.count.should be 3
|
Person.all.count.should be 3
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not keep the person around if the users ignores them' do
|
it 'should keep the person around if the users ignores them' do
|
||||||
@user.receive @req_xml
|
@user.receive @req_xml
|
||||||
@user.pending_requests.size.should be 1
|
@user.pending_requests.size.should be 1
|
||||||
@user.ignore_friend_request @user.pending_requests.first.id
|
@user.ignore_friend_request @user.pending_requests.first.id
|
||||||
|
|
@ -155,7 +155,7 @@ describe User do
|
||||||
@user2.pending_requests.size.should be 1
|
@user2.pending_requests.size.should be 1
|
||||||
@user2.ignore_friend_request @user2.pending_requests.first.id#@request_two.id
|
@user2.ignore_friend_request @user2.pending_requests.first.id#@request_two.id
|
||||||
@user2.friends.include?(@person_one).should be false
|
@user2.friends.include?(@person_one).should be false
|
||||||
Person.all.count.should be 2
|
Person.all.count.should be 3
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -216,21 +216,11 @@ describe User do
|
||||||
@user.friends.count.should == 1
|
@user.friends.count.should == 1
|
||||||
@user2.friends.count.should == 1
|
@user2.friends.count.should == 1
|
||||||
|
|
||||||
@user.person.user_refs.should == 1
|
|
||||||
|
|
||||||
@user2.person.user_refs.should == 1
|
|
||||||
|
|
||||||
@user2.unfriend @user.person
|
@user2.unfriend @user.person
|
||||||
@user2.friends.count.should be 0
|
@user2.friends.count.should be 0
|
||||||
|
|
||||||
@user.person.reload
|
|
||||||
@user.person.user_refs.should == 0
|
|
||||||
|
|
||||||
@user.unfriended_by @user2.person
|
@user.unfriended_by @user2.person
|
||||||
|
|
||||||
@user2.person.reload
|
|
||||||
@user2.person.user_refs.should == 0
|
|
||||||
|
|
||||||
@aspect.reload
|
@aspect.reload
|
||||||
@aspect2.reload
|
@aspect2.reload
|
||||||
@aspect.people.count.should == 0
|
@aspect.people.count.should == 0
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
def message_queue
|
def message_queue
|
||||||
Post.send(:class_variable_get, :@@queue)
|
User::QUEUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def friend_users(user1, aspect1, user2, aspect2)
|
def friend_users(user1, aspect1, user2, aspect2)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue