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

Provide feedback when a user tries to double-reshare

parent 99aafb18
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -4,7 +4,7 @@ class ResharesController < ApplicationController
def create
@reshare = current_user.build_post(:reshare, :root_guid => params[:root_guid])
if @reshare.save!
if @reshare.save
current_user.add_to_streams(@reshare, current_user.aspects)
current_user.dispatch_post(@reshare, :url => post_url(@reshare), :additional_subscribers => @reshare.root.author)
end
......
module ResharesHelper
def reshare_error_message(reshare)
if @reshare.errors[:root_guid].present?
escape_javascript(@reshare.errors[:root_guid].first)
else
escape_javascript(t('reshares.create.failure'))
end
end
end
$('.stream_element#<%=params[:root_guid]%>').addClass('reshared');
ContentUpdater.addPostToStream(
"<%= escape_javascript(render(:partial => 'shared/stream_element', :locals => {:post => @reshare }))=%>"
);
<% if @reshare.persisted? %>
$('.stream_element#<%=params[:root_guid]%>').addClass('reshared');
ContentUpdater.addPostToStream(
"<%= escape_javascript(render(:partial => 'shared/stream_element', :locals => {:post => @reshare }))=%>"
);
<% else %>
Diaspora.widgets.flashes.render({success:false,
notice: "<%= reshare_error_message(@reshare) %>"});
<% end %>
......@@ -26,3 +26,4 @@
attributes:
from_id:
taken: "is a duplicate of a pre-existing request."
......@@ -65,8 +65,10 @@ en:
attributes:
from_id:
taken: "is a duplicate of a pre-existing request."
reshare:
attributes:
root_guid:
taken: "You've already reshared that post!"
error_messages:
helper:
invalid_fields: "Invalid Fields"
......@@ -579,7 +581,9 @@ en:
few: "%{count} new requests!"
many: "%{count} new requests!"
other: "%{count} new requests!"
reshares:
create:
failure: "There was an error resharing this post."
services:
index:
logged_in_as: "logged in as"
......
......@@ -47,3 +47,5 @@ en:
comments:
show: "show all comments"
hide: "hide comments"
reshares:
duplicate:"You've already reshared that post!"
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter