link to public feed of the person on the profile person show page instead of to the one of current_user

fixed #700
fixed #864
fixed #774
This commit is contained in:
MrZYX 2011-03-08 18:43:37 +01:00
parent fd0bc8a09a
commit 7b5b980095
4 changed files with 14 additions and 6 deletions

View file

@ -114,7 +114,12 @@ class Person < ActiveRecord::Base
end
def public_url
"#{url}public/#{self.owner.username}"
if self.owner
username = self.owner.username
else
username = self.diaspora_handle.split("@")[0]
end
"#{url}public/#{username}"
end
def public_key_hash

View file

@ -37,7 +37,7 @@ class StatusMessage < Post
return self.raw_message unless self.raw_message
people = self.mentioned_people
regex = /@\{([^;]+); ([^\}]+)\}/
escaped_message = ERB::Util.h(raw_message)
escaped_message = opts[:plain_text] ? raw_message : ERB::Util.h(raw_message)
form_message = escaped_message.gsub(regex) do |matched_string|
inner_captures = matched_string.match(regex).captures
person = people.detect{ |p|
@ -87,8 +87,8 @@ class StatusMessage < Post
def to_activity
<<-XML
<entry>
<title>#{x(self.message)}</title>
<link rel="alternate" type="text/html" href="#{person.url}status_messages/#{self.id}"/>
<title>#{x(self.formatted_message(:plain_text => true))}</title>
<link rel="alternate" type="text/html" href="#{person.url}p/#{self.id}"/>
<id>#{person.url}posts/#{self.id}</id>
<published>#{self.created_at.xmlschema}</published>
<updated>#{self.updated_at.xmlschema}</updated>

View file

@ -70,8 +70,10 @@
} catch( err ) {}
- if current_user
%link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "Public Diaspora Feed for #{current_user.name}"}
- if @person
%link{:rel => "alternate", :href => "#{@person.public_url}", :type => "application/atom+xml", :title => "#{t('.public_feed', :name => @person.name)}"}
- elsif current_user
%link{:rel => "alternate", :href => "#{current_user.public_url}", :type => "application/atom+xml", :title => "#{t('.public_feed', :name => current_user.name)}"}
%body
- unless @landing_page

View file

@ -112,6 +112,7 @@ en:
your_aspects: "your aspects"
logged_in_as: "logged in as %{name}"
toggle: "toggle mobile site"
public_feed: "Public Diaspora Feed for %{name}"
shared:
publisher:
mention_helper_text: "to mention someone, press '@' and start typing their name"