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

This commit is contained in:
Raphael 2010-10-05 21:05:13 -07:00
commit 582b323a7c
9 changed files with 74 additions and 8 deletions

View file

@ -116,6 +116,7 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3) selenium-webdriver (>= 0.0.3)
columnize (0.3.1)
crack (0.1.8) crack (0.1.8)
cucumber (0.9.0) cucumber (0.9.0)
builder (~> 2.1.2) builder (~> 2.1.2)
@ -151,6 +152,7 @@ GEM
i18n (0.4.1) i18n (0.4.1)
json (1.4.6) json (1.4.6)
json_pure (1.4.6) json_pure (1.4.6)
linecache (0.43)
mail (2.2.6.1) mail (2.2.6.1)
activesupport (>= 2.3.6) activesupport (>= 2.3.6)
mime-types mime-types
@ -199,6 +201,7 @@ GEM
rake (>= 0.8.4) rake (>= 0.8.4)
thor (~> 0.14.0) thor (~> 0.14.0)
rake (0.8.7) rake (0.8.7)
redgreen (1.2.2)
rest-client (1.6.1) rest-client (1.6.1)
mime-types (>= 1.16) mime-types (>= 1.16)
rspec (2.0.0.beta.22) rspec (2.0.0.beta.22)
@ -214,6 +217,11 @@ GEM
rspec-rails (2.0.0.beta.17) rspec-rails (2.0.0.beta.17)
rspec (>= 2.0.0.beta.14) rspec (>= 2.0.0.beta.14)
webrat (>= 0.7.0) webrat (>= 0.7.0)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
ruby-debug-base (0.10.3)
linecache (>= 0.3)
rubyzip (0.9.4) rubyzip (0.9.4)
selenium-webdriver (0.0.28) selenium-webdriver (0.0.28)
ffi (>= 0.6.1) ffi (>= 0.6.1)
@ -270,9 +278,11 @@ DEPENDENCIES
pubsubhubbub pubsubhubbub
rails (= 3.0.0) rails (= 3.0.0)
redfinger! redfinger!
redgreen
roxml! roxml!
rspec (>= 2.0.0.beta.17) rspec (>= 2.0.0.beta.17)
rspec-rails (= 2.0.0.beta.17) rspec-rails (= 2.0.0.beta.17)
ruby-debug
sprinkle! sprinkle!
thin thin
webmock webmock

View file

@ -21,12 +21,25 @@ class UsersController < ApplicationController
def update def update
@user = current_user @user = current_user
data = clean_hash params[:user] data = clean_hash params[:user]
prep_image_url(data) prep_image_url(data)
params[:user].delete(:password) if params[:user][:password].blank?
params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
if params[:user][:password] && params[:user][:password_confirmation]
if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
flash[:notice] = "Password Changed"
else
flash[:error] = "Password Change Failed"
end
end
@user.update_profile data @user.update_profile data
respond_with(@user, :location => root_url) redirect_to edit_user_path(@user)
end end
def public def public

View file

@ -36,7 +36,7 @@
<dl class="entity_photo"> <dl class="entity_photo">
<dt>Photo</dt> <dt>Photo</dt>
<dd> <dd>
<span class="photo"><%= @person.profile.image_url%></span> <img class="photo avatar" src="<%= @person.profile.image_url%>" width="100" height="100"/>
</dd> </dd>
</dl> </dl>
<dl class="entity_note"> <dl class="entity_note">

View file

@ -6,7 +6,7 @@
<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="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.public_url%>"/> <Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@person.public_url%>.atom"/>
<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)%>"/>
</XRD> </XRD>

View file

@ -47,6 +47,13 @@
%p %p
= p.label :last_name = p.label :last_name
= p.text_field :last_name, :value => @profile.last_name = p.text_field :last_name, :value => @profile.last_name
%p
= f.label :password
= f.text_field :password
%p
= f.label :password_confirmation
= f.text_field :password_confirmation
#submit_block #submit_block
= link_to t('.cancel'), root_path = link_to t('.cancel'), root_path

View file

@ -30,7 +30,7 @@ module Diaspora
<generator uri="http://joindiaspora.com/">Diaspora</generator> <generator uri="http://joindiaspora.com/">Diaspora</generator>
<id>#{@user.public_url}.atom</id> <id>#{@user.public_url}.atom</id>
<title>#{@user.real_name}'s Public Feed</title> <title>#{@user.real_name}'s Public Feed</title>
<subtitle>its a stream</subtitle> <subtitle>Posts from Diaspora</subtitle>
<updated>#{Time.now.xmlschema}</updated> <updated>#{Time.now.xmlschema}</updated>
<author> <author>
<name>#{@user.real_name}</name> <name>#{@user.real_name}</name>
@ -53,6 +53,7 @@ module Diaspora
<id>#{@user.public_url}</id> <id>#{@user.public_url}</id>
<title>#{@user.real_name}</title> <title>#{@user.real_name}</title>
<link rel="alternative" type="text/html" href="#{@user.public_url}"/> <link rel="alternative" type="text/html" href="#{@user.public_url}"/>
<link rel="avatar" type="image/jpeg" media:width="100" media:height="100" href="#{@user.profile.image_url}"/>
</activity:subject> </activity:subject>
XML XML
end end

View file

@ -8,6 +8,6 @@ module HCard
{:given_name => doc.css(".given_name").text, {:given_name => doc.css(".given_name").text,
:family_name => doc.css(".family_name").text, :family_name => doc.css(".family_name").text,
:url => doc.css("#pod_location").text, :url => doc.css("#pod_location").text,
:photo => doc.css(".photo")} :photo => doc.css(".photo").src}
end end
end end

View file

@ -34,8 +34,8 @@ class MessageHandler
http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT
http.callback {process} http.callback {process}
when :hub_publish when :hub_publish
http = EventMachine::PubSubHubbub.new(query.destination).publish :timeout => TIMEOUT http = EventMachine::PubSubHubbub.new(query.destination).publish query.body, :timeout => TIMEOUT
http.callback {process; Rails.logger.debug(http.response)} http.callback {process}
else else
raise "message is not a type I know!" raise "message is not a type I know!"
end end

View file

@ -27,7 +27,42 @@ describe UsersController do
@user.person.profile.image_url.should == image_url @user.person.profile.image_url.should == image_url
end end
end
context 'should allow the user to update their password' do
it 'should change a users password ' do
old_password = @user.encrypted_password
put("update", :id => @user.id, "user"=> {"password" => "foobaz", 'password_confirmation' => "foobaz","profile"=>
{"image_url" => "",
"last_name" => @user.person.profile.last_name,
"first_name" => @user.person.profile.first_name}})
@user.reload
@user.encrypted_password.should_not == old_password
end
it 'should not change a password if they do not match' do
old_password = @user.encrypted_password
put("update", :id => @user.id, "user"=> {"password" => "foobarz", 'password_confirmation' => "not_the_same","profile"=>
{"image_url" => "",
"last_name" => @user.person.profile.last_name,
"first_name" => @user.person.profile.first_name}})
@user.reload
@user.encrypted_password.should == old_password
end
it 'should not update if the password fields are left blank' do
old_password = @user.encrypted_password
put("update", :id => @user.id, "user"=> {"password" => "", 'password_confirmation' => "","profile"=>
{"image_url" => "",
"last_name" => @user.person.profile.last_name,
"first_name" => @user.person.profile.first_name}})
@user.reload
@user.encrypted_password.should == old_password
end
end end
end end
end end