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
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
def image_or_default(person)

View file

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

View file

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

View file

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

View file

@ -5,10 +5,10 @@
- person = hash[:person]
%li.comment{:data=>{:guid=>comment.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
.from
%a{:href => "/people/#{person.id}"}=person.real_name
%a{:href => "/people/#{person.id}"}=person.name
= markdownify(comment.text, :youtube_maps => comment[:youtube_titles])
%div.time
= 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
- 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
= 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)
- @invs.each do |inv|
- if inv.message
= "#{inv.from.real_name}:"
= "#{inv.from.name}:"
= "\"#{inv.message}\""
%p

View file

@ -26,7 +26,7 @@
.avatar
= 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('.edit_profile'), edit_person_path(current_user.person)
%li= link_to t('.account_settings'), edit_user_path(current_user)

View file

@ -9,7 +9,7 @@
%title
- if current_user
= "#{current_user.real_name} | DIASPORA*"
= "#{current_user.name} | DIASPORA*"
- else
DIASPORA*
@ -69,7 +69,7 @@
- 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
-unless @landing_page

View file

@ -6,7 +6,7 @@
%html{:lang => I18n.locale.to_s}
%head
%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"}/
@ -25,7 +25,7 @@
%div{:data => {:role => 'header', :nobackbtn => 'true'}}
%h1
= person_image_tag (current_user.person)
= current_user.real_name
= current_user.name
= select_tag "aspect_picker", aspect_select_options(@aspects, @aspect)
= yield

View file

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

View file

@ -1,5 +1,5 @@
= 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.try_it_out')

View file

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

View file

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

View file

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

View file

@ -9,7 +9,7 @@
$(this).closest('li').fadeOut(200);
});
$('.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
%li
= 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

View file

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

View file

@ -10,5 +10,5 @@
%p.photo_description
= 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
%h1= @person.real_name
%h1= @person.name
#content_inner
#i.entity_profile.vcard.author
%h2 User profile
@ -7,7 +7,7 @@
%dl.entity_nickname
%dt Nickname
%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
%dt First name
@ -22,7 +22,7 @@
%dl.entity_fn
%dt Full name
%dd
%span.fn= @person.real_name
%span.fn= @person.name
%dl.entity_url
%dt URL

View file

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

View file

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

View file

@ -2,4 +2,4 @@
-# licensed under the Affero General Public License version 3 or later. See
-# 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}}
%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
.from
%a{:href => "/people/#{person.id}"}=person.real_name
%a{:href => "/people/#{person.id}"}=person.name
- if person.owner_id == current_user.id
.aspect

View file

@ -7,7 +7,7 @@
.content
.from
= link_to post.person.real_name, post.person
= link_to post.person.name, post.person
.aspect
- 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/">
<generator uri="http://joindiaspora.com/">Diaspora</generator>
<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>
<updated>#{Time.now.xmlschema}</updated>
<author>
<name>#{@user.real_name}</name>
<name>#{@user.name}</name>
<uri>#{@user.public_url}</uri>
</author>
XML
@ -51,7 +51,7 @@ module Diaspora
<activity:subject>
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
<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="avatar" type="image/jpeg" media:width="100" media:height="100" href="#{@user.profile.image_url}"/>
</activity:subject>

View file

@ -67,11 +67,11 @@ module Diaspora
if contact_request.save!
self.pending_requests << contact_request
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)
end
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
end
contact_request
@ -80,7 +80,7 @@ module Diaspora
def receive_request_acceptance(received_request, sent_request)
destination_aspect = self.aspect_by_id(sent_request.into_id)
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
pending_requests.delete(sent_request)

View file

@ -16,13 +16,13 @@
Rails.logger.info("Verifying sig on #{signable_string} but no person is here")
return false
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
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
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
Rails.logger.debug("Validity: #{validity}")
validity

View file

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

View file

@ -72,14 +72,14 @@ begin
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)
ws.onmessage { |msg| SocketsController.new.incoming(msg) }
ws.onclose {
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)
rescue
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
request_mail.body.encoded.include?(person.real_name).should be true
request_mail.body.encoded.include?(person.name).should be true
end
it 'has the css' do
@ -40,7 +40,7 @@ describe Notifier 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
it 'has the name of the aspect in the body' do

View file

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