Merge pull request #1152 from consul/direct_message_polish

Direct message polish
This commit is contained in:
Juanjo Bazán
2016-06-16 16:38:27 +02:00
committed by GitHub
8 changed files with 18 additions and 16 deletions

View File

@@ -15,7 +15,7 @@ class DirectMessage < ActiveRecord::Base
max = Setting[:direct_message_max_per_day] max = Setting[:direct_message_max_per_day]
if sender.direct_messages_sent.today.count >= max.to_i if sender.direct_messages_sent.today.count >= max.to_i
errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid', max: max)) errors.add(:title, I18n.t('activerecord.errors.models.direct_message.attributes.max_per_day.invalid'))
end end
end end

View File

@@ -2,7 +2,8 @@
<div class="activity row margin-top"> <div class="activity row margin-top">
<div class="small-12 column"> <div class="small-12 column">
<% if @user != current_user && @user.email_on_direct_message? %> <% if @user != current_user %>
<% if @user.email_on_direct_message? %>
<%= link_to t("users.show.send_private_message"), <%= link_to t("users.show.send_private_message"),
new_user_direct_message_path(@user), new_user_direct_message_path(@user),
class: "button hollow float-right" %> class: "button hollow float-right" %>
@@ -11,6 +12,7 @@
<%= t("users.show.no_private_messages") %> <%= t("users.show.no_private_messages") %>
</div> </div>
<% end %> <% end %>
<% end %>
<h2 class="inline-block"> <h2 class="inline-block">
<%= avatar_image(@user, seed: @user.id, size: 60) %> <%= avatar_image(@user, seed: @user.id, size: 60) %>

View File

@@ -81,7 +81,7 @@ en:
direct_message: direct_message:
attributes: attributes:
max_per_day: max_per_day:
invalid: "You can only send a maximum of %{max} direct messages per day" invalid: "You have reached the maximum number of private messages per day"
proposal: proposal:
attributes: attributes:
tag_list: tag_list:

View File

@@ -81,7 +81,7 @@ es:
direct_message: direct_message:
attributes: attributes:
max_per_day: max_per_day:
invalid: "Sólo puedes enviar %{max} mensajes directos por día" invalid: "Has llegado al número máximo de mensajes privados por día"
proposal: proposal:
attributes: attributes:
tag_list: tag_list:

View File

@@ -15,7 +15,7 @@ es:
public_activity_label: Mostrar públicamente mi lista de actividades public_activity_label: Mostrar públicamente mi lista de actividades
save_changes_submit: Guardar cambios save_changes_submit: Guardar cambios
subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web
email_on_direct_message_label: Recibir emails con mensajes directos email_on_direct_message_label: Recibir emails con mensajes privados
email_digest_label: Recibir resumen de notificaciones sobre propuestas email_digest_label: Recibir resumen de notificaciones sobre propuestas
title: Mi cuenta title: Mi cuenta
user_permission_debates: Participar en debates user_permission_debates: Participar en debates
@@ -506,7 +506,7 @@ es:
direct_messages: direct_messages:
new: new:
body_label: "Mensaje" body_label: "Mensaje"
direct_messages_bloqued: "Este usuarios ha decidido no recibir mensajes directos" direct_messages_bloqued: "Este usuario ha decidido no recibir mensajes privados"
submit_button: "Enviar mensaje" submit_button: "Enviar mensaje"
title: Enviar mensaje privado a %{receiver} title: Enviar mensaje privado a %{receiver}
title_label: "Título" title_label: "Título"

View File

@@ -40,7 +40,7 @@ es:
direct_message_for_receiver: direct_message_for_receiver:
subject: "Has recibido un nuevo mensaje privado" subject: "Has recibido un nuevo mensaje privado"
reply: Responder a %{sender} reply: Responder a %{sender}
unsubscribe: "Si no quieres recibir mensajes privados, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes directos'." unsubscribe: "Si no quieres recibir mensajes privados, puedes entrar en %{account} y desmarcar la opción 'Recibir emails con mensajes privados'."
unsubscribe_account: Mi cuenta unsubscribe_account: Mi cuenta
direct_message_for_sender: direct_message_for_sender:
subject: "Has enviado un nuevo mensaje privado" subject: "Has enviado un nuevo mensaje privado"

View File

@@ -76,5 +76,5 @@ Setting['banner-img.banner-img-two'] = "Banner image 2"
Setting['banner-img.banner-img-three'] = "Banner image 3" Setting['banner-img.banner-img-three'] = "Banner image 3"
# Proposal notifications # Proposal notifications
Setting['proposal_notification_minimum_interval_in_days '] = 3 Setting['proposal_notification_minimum_interval_in_days'] = 3
Setting['direct_message_max_per_day'] = 3 Setting['direct_message_max_per_day'] = 3

View File

@@ -113,7 +113,7 @@ feature 'Direct messages' do
fill_in 'direct_message_body', with: "How are you doing?" fill_in 'direct_message_body', with: "How are you doing?"
click_button "Send message" click_button "Send message"
expect(page).to have_content "You can only send a maximum of 3 direct messages per day" expect(page).to have_content "You have reached the maximum number of private messages per day"
expect(page).to_not have_content "You message has been sent successfully." expect(page).to_not have_content "You message has been sent successfully."
end end