Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
Raphael 2010-08-24 15:49:04 -07:00
commit 10bd40d1a2
9 changed files with 30 additions and 13 deletions

View file

@ -37,8 +37,6 @@ def warzombie
def zombiefriendaccept def zombiefriendaccept
render :nothing => true render :nothing => true
set_profile_photo
Request.all.each{|r| Request.all.each{|r|
current_user.accept_and_respond(r.id, current_user.groups.first.id) current_user.accept_and_respond(r.id, current_user.groups.first.id)
} }
@ -58,13 +56,25 @@ def warzombie
end end
def set_profile_photo def set_profile_photo
render :nothing => true
album = current_user.post(:album, :name => "Profile Photos") album = current_user.post(:album, :name => "Profile Photos")
backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i backer_number = YAML.load_file(Rails.root.join('config','backer_number.yml'))[:seed_number].to_i
username = backer_info[backer_number]['username'].gsub(/ /,'').downcase username = backer_info[backer_number]['username'].gsub(/ /,'').downcase
photo = current_user.post(:photo, :album_id => album.id,
:user_file => "public/images/users/#{username}.jpg")
current_user.update_profile(:image_url => photo.url) @fixture_name = File.dirname(__FILE__) + "/../../public/images/user/#{username}.jpg"
photo = Photo.new(:person => current_user.person, :album => album)
photo.image.store! File.open(@fixture_name)
photo.save
photo.reload
current_user.raw_visible_posts << photo
current_user.save
current_user.update_profile(:image_url => photo.url(:thumb_medium))
current_user.save
end end
end end

View file

@ -14,6 +14,7 @@ class PeopleController < ApplicationController
def show def show
@person = current_user.visible_person_by_id(params[:id]) @person = current_user.visible_person_by_id(params[:id])
@profile = @person.profile @profile = @person.profile
@person_groups = current_user.groups_with_person(@person)
@posts = Post.where(:person_id => @person.id, :_id.in => current_user.visible_post_ids).paginate :page => params[:page], :order => 'created_at DESC' @posts = Post.where(:person_id => @person.id, :_id.in => current_user.visible_post_ids).paginate :page => params[:page], :order => 'created_at DESC'

View file

@ -8,7 +8,7 @@ class User
key :friend_ids, Array key :friend_ids, Array
key :pending_request_ids, Array key :pending_request_ids, Array
key :visible_post_ids, Array key :_post_ids, Array
one :person, :class_name => 'Person', :foreign_key => :owner_id one :person, :class_name => 'Person', :foreign_key => :owner_id
@ -219,7 +219,7 @@ class User
end end
def groups_with_person person def groups_with_person person
id = ensure_bson person.id id = ensure_bson person.object_id
groups.select {|group| group.person_ids.include? id} groups.select {|group| group.person_ids.include? id}
end end

View file

@ -6,7 +6,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

View file

@ -6,7 +6,6 @@
%h1 %h1
= @person.real_name = @person.real_name
- unless @person.id == current_user.person.id - unless @person.id == current_user.person.id
.right .right
= link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button" = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button"
@ -16,6 +15,8 @@
%i= "last seen: #{how_long_ago(@posts.first)}" %i= "last seen: #{how_long_ago(@posts.first)}"
%li %li
%i= "friends since: #{how_long_ago(@person)}" %i= "friends since: #{how_long_ago(@person)}"
%li
="groups: #{@person_groups}"
%li %li
url: url:
= @person.url = @person.url
@ -31,7 +32,7 @@
%h3= "stream - #{@post_count} item(s)" %h3= "stream - #{@post_count} item(s)"
%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
= will_paginate @posts = will_paginate @posts
- else - else
%h3 no posts to display! %h3 no posts to display!

View file

@ -8,7 +8,10 @@
= link_to post.album.name, object_path(post.album) = link_to post.album.name, object_path(post.album)
%br %br
= link_to (image_tag post.url(:thumb_large)), object_path(post)
= render "albums/album", :post => post.album
= link_to (image_tag post.url(:thumb_medium)), object_path(post)
%div.time %div.time
= link_to(how_long_ago(post), photo_path(post)) = link_to(how_long_ago(post), photo_path(post))

View file

@ -12,6 +12,7 @@ Diaspora::Application.routes.draw do
match 'zombiefriends', :to => "dev_utilities#zombiefriends" match 'zombiefriends', :to => "dev_utilities#zombiefriends"
match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept" match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept"
match 'set_backer_number', :to => "dev_utilities#set_backer_number" match 'set_backer_number', :to => "dev_utilities#set_backer_number"
match 'set_profile_photo', :to => "dev_utilities#set_profile_photo"
#routes for devise, not really sure you will need to mess with this in the future, lets put default, #routes for devise, not really sure you will need to mess with this in the future, lets put default,
#non mutable stuff in anohter file #non mutable stuff in anohter file

View file

@ -20,7 +20,7 @@ def create
:person => Person.new( :person => Person.new(
:email => "#{username}@#{username}.joindiaspora.com", :email => "#{username}@#{username}.joindiaspora.com",
:profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name'], :profile => Profile.new( :first_name => backer_info[backer_number]['given_name'], :last_name => backer_info[backer_number]['family_name'],
:image_url => "http://#{username}.joindiaspora.com/images/users/#{username}.jpg"), :image_url => "http://#{username}.joindiaspora.com/images/user/#{username}.jpg"),
:url=> "http://#{username}.joindiaspora.com/") :url=> "http://#{username}.joindiaspora.com/")
) )
user.person.save user.person.save

View file

@ -185,6 +185,7 @@ h1
:weight 200 :weight 200
:color #999 :color #999
h3 h3
:position relativex :position relativex
:font :font