Skip to content
Extraits de code Groupes Projets
Valider 99aafb18 rédigé par Raphael Sofaer's avatar Raphael Sofaer
Parcourir les fichiers

Reshares show up on sharing, prevent multi-resharing, still need to make that ui nice

parent f74bf047
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -4,6 +4,7 @@ class Reshare < Post ...@@ -4,6 +4,7 @@ class Reshare < Post
validate :root_must_be_public validate :root_must_be_public
attr_accessible :root_guid, :public attr_accessible :root_guid, :public
validates_presence_of :root, :on => :create validates_presence_of :root, :on => :create
validates_uniqueness_of :root_guid, :scope => :author_id
xml_attr :root_diaspora_id xml_attr :root_diaspora_id
xml_attr :root_guid xml_attr :root_guid
...@@ -40,12 +41,11 @@ class Reshare < Post ...@@ -40,12 +41,11 @@ class Reshare < Post
fetched_post = self.class.fetch_post(root_author, self.root_guid) fetched_post = self.class.fetch_post(root_author, self.root_guid)
#Why are we checking for this?
if root_author.diaspora_handle != fetched_post.diaspora_handle if root_author.diaspora_handle != fetched_post.diaspora_handle
raise "Diaspora ID (#{fetched_post.diaspora_handle}) in the root does not match the Diaspora ID (#{root_author.diaspora_handle}) specified in the reshare!" raise "Diaspora ID (#{fetched_post.diaspora_handle}) in the root does not match the Diaspora ID (#{root_author.diaspora_handle}) specified in the reshare!"
end end
#Todo, this is a bug if it is necessary. The marshalling process should set the author.
fetched_post.author_id = root_author.id
fetched_post.save! fetched_post.save!
end end
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= person_image_link(post.author, :size => :thumb_small) = person_image_link(post.author, :size => :thumb_small)
.content .content
.right .right
= link_to "Show Original", post_path(post) = link_to "Show Original", post_path(post)
%span.from %span.from
= person_link(post.author, :class => "hovercardable") = person_link(post.author, :class => "hovercardable")
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
= render 'status_messages/status_message', :post => post, :photos => post.photos = render 'status_messages/status_message', :post => post, :photos => post.photos
- if defined?(current_user) && current_user && (post.author_id != current_user.person.id) && (post.public?) && !reshare?(post) - if defined?(current_user) && current_user && (post.author_id != current_user.person.id) && (post.public?) && !reshare?(post)
%span.reshare_action %span.reshare_action
= link_to "Reshare", reshares_path(:root_id => post.id), :method => :post, :remote => true, :confirm => "Reshare: #{post.author.name} - #{post.text}?" = link_to "Reshare", reshares_path(:root_guid => post.guid), :method => :post, :remote => true, :confirm => "Reshare: #{post.author.name} - #{post.text}?"
- else - else
Original post deleted by author Original post deleted by author
$('.stream_element[data-guid=<%=params[:root_guid]%>]').addClass('reshared'); $('.stream_element#<%=params[:root_guid]%>').addClass('reshared');
ContentUpdater.addPostToStream(
"<%= escape_javascript(render(:partial => 'shared/stream_element', :locals => {:post => @reshare }))=%>"
);
...@@ -41,6 +41,7 @@ Factory.define :like do |x| ...@@ -41,6 +41,7 @@ Factory.define :like do |x|
end end
Factory.define :user do |u| Factory.define :user do |u|
u.getting_started false
u.sequence(:username) { |n| "bob#{n}#{r_str}" } u.sequence(:username) { |n| "bob#{n}#{r_str}" }
u.sequence(:email) { |n| "bob#{n}#{r_str}@pivotallabs.com" } u.sequence(:email) { |n| "bob#{n}#{r_str}@pivotallabs.com" }
u.password "bluepin7" u.password "bluepin7"
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter