From 7b5b9800957cc8bf8087a5ee16da936b147b1be5 Mon Sep 17 00:00:00 2001 From: MrZYX Date: Tue, 8 Mar 2011 18:43:37 +0100 Subject: [PATCH] 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 --- app/models/person.rb | 7 ++++++- app/models/status_message.rb | 6 +++--- app/views/layouts/application.html.haml | 6 ++++-- config/locales/diaspora/en.yml | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index ac6a5dc88..d448f2911 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -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 diff --git a/app/models/status_message.rb b/app/models/status_message.rb index a3a0146f1..3c6d1778c 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -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 - #{x(self.message)} - + #{x(self.formatted_message(:plain_text => true))} + #{person.url}posts/#{self.id} #{self.created_at.xmlschema} #{self.updated_at.xmlschema} diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a94987ae9..3721ca088 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -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 diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 162542839..4a91ed354 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -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"