diff --git a/README.md b/README.md index 0cbe5a459..85e52b7c8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ The privacy aware, personally controlled, do-it-all, open source social network. **DISCLAIMER: THIS IS PRE-ALPHA SOFTWARE AND SHOULD BE TREATED ACCORDINGLY.** -These instructions are for machines running [Ubuntu](http://www.ubuntu.com/) or Mac OS X. +These instructions are for machines running [Ubuntu](http://www.ubuntu.com/) or Mac OS X. We are developing Diaspora for the latest and greatest browsers, so please update your Firefox, Chrome or Safari to the latest and greatest. ## Preparing your system In order to run Diaspora, you will need to download the following dependencies (specific instructions follow): diff --git a/app/models/person.rb b/app/models/person.rb index 836a810ec..6cc255e8b 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -11,13 +11,13 @@ class Person include Encryptor::Public xml_accessor :_id - xml_accessor :email + xml_accessor :diaspora_handle xml_accessor :url xml_accessor :profile, :as => Profile xml_reader :exported_key key :url, String - key :email, String, :unique => true + key :diaspora_handle, String, :unique => true key :serialized_key, String key :owner_id, ObjectId @@ -30,13 +30,21 @@ class Person before_destroy :remove_all_traces before_validation :clean_url - validates_presence_of :email, :url, :profile, :serialized_key + after_create :ensure_diaspora_handle + validates_presence_of :url, :profile, :serialized_key validates_format_of :url, :with => /^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix + def ensure_diaspora_handle + if self.owner? + self.diaspora_handle = self.owner.diaspora_handle + self.save + end + end + def self.search(query) - Person.all('$where' => "function() { return this.email.match(/^#{query}/i) || + Person.all('$where' => "function() { return this.diaspora_handle.match(/^#{query}/i) || this.profile.first_name.match(/^#{query}/i) || this.profile.last_name.match(/^#{query}/i); }") end @@ -79,7 +87,8 @@ class Person end def self.by_webfinger( identifier ) - local_person = Person.first(:email => identifier.gsub('acct:', '')) + local_person = Person.first(:diaspora_handle => identifier.gsub('acct:', '')) + if local_person local_person elsif !identifier.include?("localhost") @@ -102,7 +111,7 @@ class Person guid = profile.links.select{|x| x.rel == 'http://joindiaspora.com/guid'}.first.href new_person.id = guid - new_person.email = identifier + new_person.diaspora_handle = identifier hcard = HCard.find profile.hcard.first[:href] @@ -124,7 +133,7 @@ class Person :person => { :id => self.id, :name => self.real_name, - :email => self.email, + :diaspora_handle => self.diaspora_handle, :url => self.url, :exported_key => exported_key } diff --git a/app/models/user.rb b/app/models/user.rb index 65b1bac9c..533e23720 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -285,7 +285,7 @@ else ###Helpers############ def self.instantiate!( opts = {} ) - opts[:person][:email] = opts[:email] + opts[:person][:diaspora_handle] = opts[:email] opts[:person][:serialized_key] = generate_key User.create!( opts) end @@ -314,7 +314,7 @@ else def setup_person self.person.serialized_key ||= User.generate_key.export - self.person.email ||= email + #self.person.diaspora_handle ||= self.diaspora_handle self.person.save! end diff --git a/app/views/people/index.html.haml b/app/views/people/index.html.haml index 88dfef672..b495aef30 100644 --- a/app/views/people/index.html.haml +++ b/app/views/people/index.html.haml @@ -18,7 +18,7 @@ %table %tr %th real name - %th email + %th diaspora handle %th url - for person in @people %tr @@ -27,7 +27,7 @@ - else %td= person.real_name - %td= person.email + %td= person.diaspora_handle %td= person.url -if current_user.friends.include? person @@ -46,5 +46,5 @@ %td = form_for Request.new do |f| = f.select(:aspect_id, @aspects_dropdown_array) - = f.hidden_field :destination_url, :value => person.email + = f.hidden_field :destination_url, :value => person.diaspora_handle = f.submit "add friend" diff --git a/app/views/people/new.html.haml b/app/views/people/new.html.haml index 933c26778..66d70882a 100644 --- a/app/views/people/new.html.haml +++ b/app/views/people/new.html.haml @@ -8,9 +8,9 @@ = form_for @person do |f| = f.error_messages %p - = f.label :email + = f.label :diaspora_handle %br - = f.text_field :email + = f.text_field :diaspora_handle %p = f.label :url %br diff --git a/app/views/publics/webfinger.erb b/app/views/publics/webfinger.erb index f695c4c97..47b76e6e6 100644 --- a/app/views/publics/webfinger.erb +++ b/app/views/publics/webfinger.erb @@ -1,6 +1,6 @@ - acct:<%=@person.email%> + acct:<%=@person.diaspora_handle%> "<%= @person.url %>" diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 3756060e8..ce0b822a7 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -32,7 +32,7 @@ - else You don't have any photos! Go to the - = link_to "albums", albums_path + = link_to "albums", albums_path(:aspect => 'all') page to upload some. =will_paginate @photos diff --git a/db/seeds/backer.rb b/db/seeds/backer.rb index 48da28143..152b8113a 100644 --- a/db/seeds/backer.rb +++ b/db/seeds/backer.rb @@ -25,7 +25,7 @@ def create :username => username, :password => "#{username+backer_info[backer_number]['pin'].to_s}", :person => Person.new( - :email => "#{username}@#{username}.joindiaspora.com", + :diaspora_handle => "#{username}@#{username}.joindiaspora.com", :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/user/#{username}.jpg"), :url=> "http://#{username}.joindiaspora.com/") diff --git a/db/seeds/dev.rb b/db/seeds/dev.rb index 41543e012..b7b655952 100644 --- a/db/seeds/dev.rb +++ b/db/seeds/dev.rb @@ -13,7 +13,7 @@ user = User.instantiate!( :email => "tom@tom.joindiaspora.com", :username => "tom", :password => "evankorth", :person => Person.new( - :email => "tom@tom.joindiaspora.com", + :diaspora_handle => "tom@tom.joindiaspora.com", :url => url, :profile => Profile.new( :first_name => "Alexander", :last_name => "Hamiltom" )) ) @@ -22,7 +22,7 @@ user.person.save! user2 = User.instantiate!( :email => "korth@tom.joindiaspora.com", :username => "korth", :password => "evankorth", - :person => Person.new( :email => "korth@tom.joindiaspora.com", + :person => Person.new( :diaspora_handle => "korth@tom.joindiaspora.com", :url => url, :profile => Profile.new( :first_name => "Evan", :last_name => "Korth"))) diff --git a/db/seeds/tom.rb b/db/seeds/tom.rb index 18d22565e..bc8ef8cfb 100644 --- a/db/seeds/tom.rb +++ b/db/seeds/tom.rb @@ -13,7 +13,7 @@ user = User.instantiate!( :email => "tom@tom.joindiaspora.com", :username => "tom", :password => "evankorth", :person => { - :email => "tom@tom.joindiaspora.com", + :diaspora_handle => "tom@tom.joindiaspora.com", :url => remote_url, :profile => { :first_name => "Alexander", :last_name => "Hamiltom", :image_url => "http://tom.joindiaspora.com/images/user/tom.jpg"}} @@ -23,7 +23,7 @@ user.person.save! user2 = User.instantiate!( :email => "korth@tom.joindiaspora.com", :password => "evankorth", :username => "korth", - :person => { :email => "korth@tom.joindiaspora.com", + :person => { :diaspora_handle => "korth@tom.joindiaspora.com", :url => remote_url, :profile => { :first_name => "Evan", :last_name => "Korth", diff --git a/lib/salmon/salmon.rb b/lib/salmon/salmon.rb index 8b01fd787..ea25b9f9d 100644 --- a/lib/salmon/salmon.rb +++ b/lib/salmon/salmon.rb @@ -82,7 +82,7 @@ module Salmon #{@author.real_name} - acct:#{@author.owner.diaspora_handle} + acct:#{@author.diaspora_handle} #{@magic_sig.to_xml} diff --git a/spec/controllers/publics_controller_spec.rb b/spec/controllers/publics_controller_spec.rb index a49aaf6f4..ab7d5a602 100644 --- a/spec/controllers/publics_controller_spec.rb +++ b/spec/controllers/publics_controller_spec.rb @@ -60,7 +60,7 @@ describe PublicsController do end it 'should add the pending request to the right user if the target person does not exist locally' do - Person.should_receive(:by_webfinger).with(@user2.person.email).and_return(@user2.person) + Person.should_receive(:by_webfinger).with(@user2.person.diaspora_handle).and_return(@user2.person) @user2.person.delete @user2.delete post :receive, :id => @user.person.id, :xml => @xml diff --git a/spec/factories.rb b/spec/factories.rb index f9a958509..157398d73 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -15,7 +15,7 @@ Factory.define :profile do |p| end Factory.define :person do |p| - p.sequence(:email) {|n| "bob-person-#{n}@aol.com"} + p.sequence(:diaspora_handle) {|n| "bob-person-#{n}@aol.com"} p.sequence(:url) {|n| "http://google-#{n}.com/"} p.profile Factory.create(:profile) diff --git a/spec/fixtures/msg.xml.clear.asc b/spec/fixtures/msg.xml.clear.asc index e80a6a26f..cf14e109b 100644 --- a/spec/fixtures/msg.xml.clear.asc +++ b/spec/fixtures/msg.xml.clear.asc @@ -5,7 +5,7 @@ Hash: SHA1 jimmy's 1 whales <_id>4c3b7cf9312f91367f000004 - bob1@aol.com + bob1@aol.com http://www.example.com/ <_id>4c3b7c64312f913664000005 0264242496D4B585297BF236BEEFE6DEBE3407AA diff --git a/spec/lib/diaspora_parser_spec.rb b/spec/lib/diaspora_parser_spec.rb index d4cf63442..5fa064958 100644 --- a/spec/lib/diaspora_parser_spec.rb +++ b/spec/lib/diaspora_parser_spec.rb @@ -15,7 +15,7 @@ describe Diaspora::Parser do before do @user = Factory.create(:user, :email => "bob@aol.com") @aspect = @user.aspect(:name => 'spies') - @person = Factory.create(:person_with_private_key, :email => "bill@gates.com") + @person = Factory.create(:person_with_private_key, :diaspora_handle => "bill@gates.com") @user2 = Factory.create(:user) end @@ -25,7 +25,7 @@ describe Diaspora::Parser do end it 'should be able to correctly handle comments with person in db' do - person = Factory.create(:person, :email => "test@testing.com") + person = Factory.create(:person, :diaspora_handle => "test@testing.com") post = Factory.create(:status_message, :person => @user.person) comment = Factory.build(:comment, :post => post, :person => person, :text => "Freedom!") xml = comment.to_diaspora_xml @@ -49,7 +49,7 @@ describe Diaspora::Parser do parsed_person = Diaspora::Parser::parse_or_find_person_from_xml(xml) parsed_person.save.should be true - parsed_person.email.should == commenter.person.email + parsed_person.diaspora_handle.should == commenter.person.diaspora_handle parsed_person.profile.should_not be_nil end diff --git a/spec/lib/salmon_salmon_spec.rb b/spec/lib/salmon_salmon_spec.rb index 63f7d5cb4..2ff5abd9f 100644 --- a/spec/lib/salmon_salmon_spec.rb +++ b/spec/lib/salmon_salmon_spec.rb @@ -35,8 +35,9 @@ describe Salmon do @parsed_salmon.data.should == xml end - it 'should parse out the author email' do - @parsed_salmon.author_email.should == @user.diaspora_handle + it 'should parse out the authors diaspora_handle' do + @parsed_salmon.author_email.should == @user.person.diaspora_handle + end it 'should reference a local author' do diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index 05bb0a716..98f1c3b73 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -15,8 +15,8 @@ describe Person do @aspect2 = @user2.aspect(:name => "Abscence of Babes") end - it 'should not allow two people with the same email' do - person_two = Factory.build(:person, :url => @person.email) + it 'should not allow two people with the same diaspora_handle' do + person_two = Factory.build(:person, :url => @person.diaspora_handle) person_two.valid?.should == false end @@ -147,10 +147,10 @@ describe Person do people.include?(@friend_three).should == false end - it 'should search by email exactly' do + it 'should search by diaspora_handle exactly' do stub_success("tom@tom.joindiaspora.com") - Person.by_webfinger(@friend_one.email).should == @friend_one + Person.by_webfinger(@friend_one.diaspora_handle).should == @friend_one end it 'should create a stub for a remote user' do diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 2cb428a94..9fe37b98e 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -18,7 +18,7 @@ describe Post do end it 'should serialize to xml with its person' do - @message.to_xml.to_s.include?(@user.person.email).should == true + @message.to_xml.to_s.include?(@user.person.diaspora_handle).should == true end end diff --git a/spec/models/request_spec.rb b/spec/models/request_spec.rb index f8f38c9f2..1b9328c96 100644 --- a/spec/models/request_spec.rb +++ b/spec/models/request_spec.rb @@ -24,14 +24,14 @@ describe Request do xml = request.to_xml.to_s - xml.include?(@user.person.email).should be true + xml.include?(@user.person.diaspora_handle).should be true xml.include?(@user.url).should be true xml.include?(@user.profile.first_name).should be true xml.include?(@user.profile.last_name).should be true end it 'should allow me to see only friend requests sent to me' do - remote_person = Factory.build(:person, :email => "robert@grimm.com", :url => "http://king.com/") + remote_person = Factory.build(:person, :diaspora_handle => "robert@grimm.com", :url => "http://king.com/") Request.instantiate(:into => @aspect.id, :from => @user.person, :to => remote_person.receive_url).save Request.instantiate(:into => @aspect.id, :from => @user.person, :to => remote_person.receive_url).save diff --git a/spec/user_encryption_spec.rb b/spec/user_encryption_spec.rb index 70cdb5683..08e69e561 100644 --- a/spec/user_encryption_spec.rb +++ b/spec/user_encryption_spec.rb @@ -16,12 +16,12 @@ describe 'user encryption' do @person = Factory.create(:person_with_private_key, :profile => Profile.new(:first_name => 'Remote', :last_name => 'Friend'), - :email => 'somewhere@else.com', + :diaspora_handle => 'somewhere@else.com', :url => 'http://distant-example.com/') @person2 = Factory.create(:person_with_private_key, :profile => Profile.new(:first_name => 'Second', :last_name => 'Friend'), - :email => 'elsewhere@else.com', + :diaspora_handle => 'elsewhere@else.com', :url => 'http://distanter-example.com/') end