Person#real_name -> Person#name

This commit is contained in:
danielvincent 2010-11-30 13:01:53 -08:00
parent 7bce44ef28
commit 828635def9
30 changed files with 63 additions and 63 deletions

View file

@ -96,7 +96,7 @@ module ApplicationHelper
end end
def person_image_tag(person) def person_image_tag(person)
image_tag image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id image_tag image_or_default(person), :class => "avatar", :alt => person.name, :title => person.name, "data-person_id" => person.id
end end
def image_or_default(person) def image_or_default(person)

View file

@ -12,8 +12,8 @@ class Notifier < ActionMailer::Base
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
mail(:to => "#{@receiver.real_name} <#{@receiver.email}>", mail(:to => "#{@receiver.name} <#{@receiver.email}>",
:subject => I18n.t('notifier.new_request.subject', :from => @sender.real_name), :host => APP_CONFIG[:terse_pod_url]) :subject => I18n.t('notifier.new_request.subject', :from => @sender.name), :host => APP_CONFIG[:terse_pod_url])
end end
def request_accepted(recipient_id, sender_id, aspect_id) def request_accepted(recipient_id, sender_id, aspect_id)
@ -25,8 +25,8 @@ class Notifier < ActionMailer::Base
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
mail(:to => "#{@receiver.real_name} <#{@receiver.email}>", mail(:to => "#{@receiver.name} <#{@receiver.email}>",
:subject => I18n.t('notifier.request_accepted.subject', :name => @sender.real_name), :host => APP_CONFIG[:terse_pod_url]) :subject => I18n.t('notifier.request_accepted.subject', :name => @sender.name), :host => APP_CONFIG[:terse_pod_url])
end end
private private

View file

@ -67,12 +67,12 @@ class Person
return p return p
end end
def real_name def name
@real_name ||= if profile.first_name.nil? || profile.first_name.empty? @name ||= if profile.first_name.nil? || profile.first_name.empty?
self.diaspora_handle self.diaspora_handle
else else
"#{profile.first_name.to_s} #{profile.last_name.to_s}" "#{profile.first_name.to_s} #{profile.last_name.to_s}"
end end
end end
def owns?(post) def owns?(post)
@ -143,10 +143,10 @@ class Person
{ {
:person => { :person => {
:id => self.id, :id => self.id,
:name => self.real_name, :name => self.name,
:diaspora_handle => self.diaspora_handle,
:url => self.url, :url => self.url,
:exported_key => exported_key :exported_key => exported_key,
:diaspora_handle => self.diaspora_handle
} }
} }
end end

View file

@ -4,7 +4,7 @@
.span-24.last .span-24.last
%h2{:style => "position:relative;"} %h2{:style => "position:relative;"}
= current_user.real_name = current_user.name
.right{:style=>"top:0"} .right{:style=>"top:0"}
%span.description %span.description
= link_to current_user.diaspora_handle, person_path(current_user.person) = link_to current_user.diaspora_handle, person_path(current_user.person)

View file

@ -5,10 +5,10 @@
- person = hash[:person] - person = hash[:person]
%li.comment{:data=>{:guid=>comment.id}} %li.comment{:data=>{:guid=>comment.id}}
%a{:href => "/people/#{person.id}"} %a{:href => "/people/#{person.id}"}
%img{:src => image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id} %img{:src => image_or_default(person), :class => "avatar", :alt => person.name, :title => person.name, "data-person_id" => person.id}
.content .content
.from .from
%a{:href => "/people/#{person.id}"}=person.real_name %a{:href => "/people/#{person.id}"}=person.name
= markdownify(comment.text, :youtube_maps => comment[:youtube_titles]) = markdownify(comment.text, :youtube_maps => comment[:youtube_titles])
%div.time %div.time
= comment.created_at ? "#{time_ago_in_words(comment.created_at)} #{t('ago')}" : time_ago_in_words(Time.now) = comment.created_at ? "#{time_ago_in_words(comment.created_at)} #{t('ago')}" : time_ago_in_words(Time.now)

View file

@ -1,11 +1,11 @@
%p %p
- if @invs.count == 1 - if @invs.count == 1
= t('.has_invited_you', :name => @invs.first.from.real_name + " (#{@invs.first.from.diaspora_handle})") = t('.has_invited_you', :name => @invs.first.from.name + " (#{@invs.first.from.diaspora_handle})")
- else - else
= t('.have_invited_you', :names => (@invs.map{|inv| inv.from.real_name + " (#{inv.from.diaspora_handle})"}.join(","))) = t('.have_invited_you', :names => (@invs.map{|inv| inv.from.name + " (#{inv.from.diaspora_handle})"}.join(",")))
= t('.accept_at', :url => root_url) = t('.accept_at', :url => root_url)
- @invs.each do |inv| - @invs.each do |inv|
- if inv.message - if inv.message
= "#{inv.from.real_name}:" = "#{inv.from.name}:"
= "\"#{inv.message}\"" = "\"#{inv.message}\""
%p %p

View file

@ -26,7 +26,7 @@
.avatar .avatar
= owner_image_tag = owner_image_tag
= link_to current_user.real_name, '#' = link_to current_user.name, '#'
%li= link_to t('.view_profile'), current_user.person %li= link_to t('.view_profile'), current_user.person
%li= link_to t('.edit_profile'), edit_person_path(current_user.person) %li= link_to t('.edit_profile'), edit_person_path(current_user.person)
%li= link_to t('.account_settings'), edit_user_path(current_user) %li= link_to t('.account_settings'), edit_user_path(current_user)

View file

@ -9,7 +9,7 @@
%title %title
- if current_user - if current_user
= "#{current_user.real_name} | DIASPORA*" = "#{current_user.name} | DIASPORA*"
- else - else
DIASPORA* DIASPORA*
@ -69,7 +69,7 @@
- if current_user - if current_user
%link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "Public Diaspora Feed for #{current_user.real_name}"} %link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "Public Diaspora Feed for #{current_user.name}"}
%body %body
-unless @landing_page -unless @landing_page

View file

@ -6,7 +6,7 @@
%html{:lang => I18n.locale.to_s} %html{:lang => I18n.locale.to_s}
%head %head
%title %title
= "#{current_user.real_name} | diaspora" if current_user = "#{current_user.name} | diaspora" if current_user
%meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/ %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
@ -25,7 +25,7 @@
%div{:data => {:role => 'header', :nobackbtn => 'true'}} %div{:data => {:role => 'header', :nobackbtn => 'true'}}
%h1 %h1
= person_image_tag (current_user.person) = person_image_tag (current_user.person)
= current_user.real_name = current_user.name
= select_tag "aspect_picker", aspect_select_options(@aspects, @aspect) = select_tag "aspect_picker", aspect_select_options(@aspects, @aspect)
= yield = yield

View file

@ -1,7 +1,7 @@
%p %p
= t('notifier.hello', :name => @receiver.email) = t('notifier.hello', :name => @receiver.email)
%p %p
= "#{@sender.real_name} (#{@sender.diaspora_handle})" = "#{@sender.name} (#{@sender.diaspora_handle})"
= t('.just_sent_you') = t('.just_sent_you')
= t('.try_it_out') = t('.try_it_out')
%br %br

View file

@ -1,5 +1,5 @@
= t('notifier.hello', :name => @receiver.profile.first_name) = t('notifier.hello', :name => @receiver.profile.first_name)
= "#{@sender.real_name} (#{@sender.diaspora_handle})" = "#{@sender.name} (#{@sender.diaspora_handle})"
= t('notifier.new_request.just_sent_you') = t('notifier.new_request.just_sent_you')
= t('notifier.new_request.try_it_out') = t('notifier.new_request.try_it_out')

View file

@ -1,7 +1,7 @@
%p %p
= t('notifier.hello', :name => @receiver.profile.first_name) = t('notifier.hello', :name => @receiver.profile.first_name)
%p %p
= "#{@sender.real_name} (#{@sender.diaspora_handle})" = "#{@sender.name} (#{@sender.diaspora_handle})"
= t('.accepted') = t('.accepted')
= link_to @aspect.name, aspect_url(@aspect) = link_to @aspect.name, aspect_url(@aspect)
= t('.aspect') = t('.aspect')

View file

@ -1,5 +1,5 @@
= t('notifier.hello', :name => @receiver.profile.first_name) = t('notifier.hello', :name => @receiver.profile.first_name)
= "#{@sender.real_name} (#{@sender.diaspora_handle})" = "#{@sender.name} (#{@sender.diaspora_handle})"
= t('notifier.request_accepted.accepted') = t('notifier.request_accepted.accepted')
= "#{@aspect.name} #{t('notifier.request_accepted.aspect')}\n" = "#{@aspect.name} #{t('notifier.request_accepted.aspect')}\n"
= "#{aspect_url(@aspect)}" = "#{aspect_url(@aspect)}"

View file

@ -8,7 +8,7 @@
.content .content
%span.from %span.from
= link_to person.real_name, person_path(person) = link_to person.name, person_path(person)
.right{:style=>"display:inline;"} .right{:style=>"display:inline;"}
- if person.id == current_user.person.id - if person.id == current_user.person.id

View file

@ -9,7 +9,7 @@
$(this).closest('li').fadeOut(200); $(this).closest('li').fadeOut(200);
}); });
$('.delete').bind('ajax:failure', function() { $('.delete').bind('ajax:failure', function() {
alert("#{t('.cannot_remove', :name => person.real_name)}"); alert("#{t('.cannot_remove', :name => person.name)}");
}); });
}); });
@ -29,7 +29,7 @@
- for aspect in @aspects_with_person - for aspect in @aspects_with_person
%li %li
= link_to aspect.name, aspect = link_to aspect.name, aspect
= link_to "x", {:controller => "aspects", :action => "remove_from_aspect", :person_id => person.id, :aspect_id => aspect.id}, :confirm => t('.remove_from', :name => person.real_name, :aspect => aspect), :remote => true, :class => "delete" = link_to "x", {:controller => "aspects", :action => "remove_from_aspect", :person_id => person.id, :aspect_id => aspect.id}, :confirm => t('.remove_from', :name => person.name, :aspect => aspect), :remote => true, :class => "delete"
-if is_contact || person == current_user.person -if is_contact || person == current_user.person

View file

@ -7,7 +7,7 @@
#author_info #author_info
.from{:style=>"padding-left:0;display:block;"} .from{:style=>"padding-left:0;display:block;"}
%h2{:style=>"display:block;"} %h2{:style=>"display:block;"}
= @person.real_name = @person.name
.right{:style => "top:0;"} .right{:style => "top:0;"}
%span.description %span.description
= @person.diaspora_handle = @person.diaspora_handle
@ -47,7 +47,7 @@
- else - else
.floating .floating
%h3 %h3
= t('.not_connected', :name => @person.real_name) = t('.not_connected', :name => @person.name)
- unless pending_request_for(@person) - unless pending_request_for(@person)
%h3 %h3
@ -59,5 +59,5 @@
- else - else
%h3 %h3
.description .description
= t('.already_requested', :name => @person.real_name) = t('.already_requested', :name => @person.name)

View file

@ -10,5 +10,5 @@
%p.photo_description %p.photo_description
= post.caption = post.caption
= link_to t('.view_all', :name => post.person.real_name), person_photos_path(post.person), :class => "small_text" = link_to t('.view_all', :name => post.person.name), person_photos_path(post.person), :class => "small_text"

View file

@ -1,5 +1,5 @@
#content #content
%h1= @person.real_name %h1= @person.name
#content_inner #content_inner
#i.entity_profile.vcard.author #i.entity_profile.vcard.author
%h2 User profile %h2 User profile
@ -7,7 +7,7 @@
%dl.entity_nickname %dl.entity_nickname
%dt Nickname %dt Nickname
%dd %dd
%a.nickname.url.uid{:href=>@person.url, :rel=>'me'}= @person.real_name %a.nickname.url.uid{:href=>@person.url, :rel=>'me'}= @person.name
%dl.entity_given_name %dl.entity_given_name
%dt First name %dt First name
@ -22,7 +22,7 @@
%dl.entity_fn %dl.entity_fn
%dt Full name %dt Full name
%dd %dd
%span.fn= @person.real_name %span.fn= @person.name
%dl.entity_url %dl.entity_url
%dt URL %dt URL

View file

@ -2,7 +2,7 @@
= person_image_link(person) = person_image_link(person)
.from .from
%h2 %h2
= person.real_name = person.name
- if current_user.owns?(post) - if current_user.owns?(post)
.aspect .aspect

View file

@ -9,7 +9,7 @@
- for contact in contacts - for contact in contacts
%li %li
%span.name %span.name
= link_to contact.person.real_name, contact.person = link_to contact.person.name, contact.person
.right .right
= aspect_membership_button(aspect_id, contact) = aspect_membership_button(aspect_id, contact)

View file

@ -2,4 +2,4 @@
-# licensed under the Affero General Public License version 3 or later. See -# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file. -# the COPYRIGHT file.
= link_to t('.new', :type => object.class.to_s, :from => object.person.real_name), object_path(object.post) = link_to t('.new', :type => object.class.to_s, :from => object.person.name), object_path(object.post)

View file

@ -4,11 +4,11 @@
%li.message{:data=>{:guid=>post.id}} %li.message{:data=>{:guid=>post.id}}
%a{:href => "/people/#{person.id}"} %a{:href => "/people/#{person.id}"}
%img{:src => image_or_default(person), :class => "avatar", :alt => person.real_name, :title => person.real_name, "data-person_id" => person.id} %img{:src => image_or_default(person), :class => "avatar", :alt => person.name, :title => person.name, "data-person_id" => person.id}
.content .content
.from .from
%a{:href => "/people/#{person.id}"}=person.real_name %a{:href => "/people/#{person.id}"}=person.name
- if person.owner_id == current_user.id - if person.owner_id == current_user.id
.aspect .aspect

View file

@ -7,7 +7,7 @@
.content .content
.from .from
= link_to post.person.real_name, post.person = link_to post.person.name, post.person
.aspect .aspect
- if post.public? - if post.public?

View file

@ -29,11 +29,11 @@ module Diaspora
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/"> <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:georss="http://www.georss.org/georss" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:media="http://purl.org/syndication/atommedia" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/">
<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.name}'s Public Feed</title>
<subtitle>Posts from Diaspora</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.name}</name>
<uri>#{@user.public_url}</uri> <uri>#{@user.public_url}</uri>
</author> </author>
XML XML
@ -51,7 +51,7 @@ module Diaspora
<activity:subject> <activity:subject>
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type> <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
<id>#{@user.public_url}</id> <id>#{@user.public_url}</id>
<title>#{@user.real_name}</title> <title>#{@user.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}"/> <link rel="avatar" type="image/jpeg" media:width="100" media:height="100" href="#{@user.profile.image_url}"/>
</activity:subject> </activity:subject>

View file

@ -67,11 +67,11 @@ module Diaspora
if contact_request.save! if contact_request.save!
self.pending_requests << contact_request self.pending_requests << contact_request
self.save! self.save!
Rails.logger.info("#{self.real_name} has received a contact request") Rails.logger.info("#{self.name} has received a contact request")
Request.send_new_request(self, contact_request.from) Request.send_new_request(self, contact_request.from)
end end
else else
Rails.logger.info "#{self.real_name} is trying to receive a contact request from himself." Rails.logger.info "#{self.name} is trying to receive a contact request from himself."
return nil return nil
end end
contact_request contact_request
@ -80,7 +80,7 @@ module Diaspora
def receive_request_acceptance(received_request, sent_request) def receive_request_acceptance(received_request, sent_request)
destination_aspect = self.aspect_by_id(sent_request.into_id) destination_aspect = self.aspect_by_id(sent_request.into_id)
activate_contact(received_request.from, destination_aspect) activate_contact(received_request.from, destination_aspect)
Rails.logger.info("#{self.real_name}'s contact request has been accepted") Rails.logger.info("#{self.name}'s contact request has been accepted")
received_request.destroy received_request.destroy
pending_requests.delete(sent_request) pending_requests.delete(sent_request)

View file

@ -16,13 +16,13 @@
Rails.logger.info("Verifying sig on #{signable_string} but no person is here") Rails.logger.info("Verifying sig on #{signable_string} but no person is here")
return false return false
elsif person.public_key.nil? elsif person.public_key.nil?
Rails.logger.info("Verifying sig on #{signable_string} but #{person.real_name} has no key") Rails.logger.info("Verifying sig on #{signable_string} but #{person.name} has no key")
return false return false
elsif signature.nil? elsif signature.nil?
Rails.logger.info("Verifying sig on #{signable_string} but #{person.real_name} did not sign") Rails.logger.info("Verifying sig on #{signable_string} but #{person.name} did not sign")
return false return false
end end
Rails.logger.debug("Verifying sig on #{signable_string} from person #{person.real_name}") Rails.logger.debug("Verifying sig on #{signable_string} from person #{person.name}")
validity = person.public_key.verify "SHA", Base64.decode64(signature), signable_string validity = person.public_key.verify "SHA", Base64.decode64(signature), signable_string
Rails.logger.debug("Validity: #{validity}") Rails.logger.debug("Validity: #{validity}")
validity validity

View file

@ -102,7 +102,7 @@ ENTRY
<iv>#{iv}</iv> <iv>#{iv}</iv>
<aes_key>#{aes_key}</aes_key> <aes_key>#{aes_key}</aes_key>
<author> <author>
<name>#{@author.real_name}</name> <name>#{@author.name}</name>
<uri>acct:#{@author.diaspora_handle}</uri> <uri>acct:#{@author.diaspora_handle}</uri>
</author> </author>
</decrypted_header> </decrypted_header>

View file

@ -72,14 +72,14 @@ begin
user_id = cookie["warden.user.user.key"].last user_id = cookie["warden.user.user.key"].last
debug_pp "In WSS, suscribing user: #{User.find(user_id).real_name} with id: #{user_id}" debug_pp "In WSS, suscribing user: #{User.find(user_id).name} with id: #{user_id}"
sid = Diaspora::WebSocket.subscribe(user_id, ws) sid = Diaspora::WebSocket.subscribe(user_id, ws)
ws.onmessage { |msg| SocketsController.new.incoming(msg) } ws.onmessage { |msg| SocketsController.new.incoming(msg) }
ws.onclose { ws.onclose {
begin begin
debug_pp "In WSS, unsuscribing user: #{User.find(user_id).real_name} with id: #{user_id}" debug_pp "In WSS, unsuscribing user: #{User.find(user_id).name} with id: #{user_id}"
Diaspora::WebSocket.unsubscribe(user_id, sid) Diaspora::WebSocket.unsubscribe(user_id, sid)
rescue rescue
debug_pp "Could not unsubscribe socket for #{user_id}" debug_pp "Could not unsubscribe socket for #{user_id}"

View file

@ -21,7 +21,7 @@ describe Notifier do
it 'has the name of person sending the request' do it 'has the name of person sending the request' do
request_mail.body.encoded.include?(person.real_name).should be true request_mail.body.encoded.include?(person.name).should be true
end end
it 'has the css' do it 'has the css' do
@ -40,7 +40,7 @@ describe Notifier do
it 'has the name of person sending the request' do it 'has the name of person sending the request' do
request_accepted_mail.body.encoded.include?(person.real_name).should be true request_accepted_mail.body.encoded.include?(person.name).should be true
end end
it 'has the name of the aspect in the body' do it 'has the name of the aspect in the body' do

View file

@ -61,14 +61,14 @@ describe Person do
end end
end end
context '#real_name' do context '#name' do
let!(:user) { make_user } let!(:user) { make_user }
let!(:person) { user.person } let!(:person) { user.person }
let!(:profile) { person.profile } let!(:profile) { person.profile }
context 'with first name' do context 'with first name' do
it 'should return their name for real name' do it 'should return their name for name' do
person.real_name.should match /#{profile.first_name}|#{profile.last_name}/ person.name.should match /#{profile.first_name}|#{profile.last_name}/
end end
end end
@ -77,7 +77,7 @@ describe Person do
person.profile.first_name = nil person.profile.first_name = nil
person.profile.last_name = nil person.profile.last_name = nil
person.save! person.save!
person.real_name.should == person.diaspora_handle person.name.should == person.diaspora_handle
end end
end end
end end