Skip to content
Extraits de code Groupes Projets
Valider 27a18868 rédigé par margori's avatar margori
Parcourir les fichiers

Changes delete conversation button tooltip to 'hide' or 'delete'

parent 5d44fa77
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -10,8 +10,13 @@ class ConversationVisibilitiesController < ApplicationController
@vis = ConversationVisibility.where(:person_id => current_user.person.id,
:conversation_id => params[:conversation_id]).first
if @vis
participants = @vis.conversation.participants.count
if @vis.destroy
flash[:notice] = I18n.t('conversations.destroy.success')
if participants == 1
flash[:notice] = I18n.t('conversations.destroy.delete_success')
else
flash[:notice] = I18n.t('conversations.destroy.hide_success')
end
end
end
redirect_to conversations_path
......
......@@ -3,13 +3,21 @@
-# the COPYRIGHT file.
.conversation_participants
= link_to(content_tag(:div, nil, :class => 'icons-deletelabel'),
conversation_visibility_path(conversation),
:method => 'delete',
:data => { :confirm => "#{t('.delete')}?" },
:title => t('.delete'),
:class => 'close_conversation')
- if conversation.participants.count > 1
= link_to(content_tag(:div, nil, :class => 'icons-deletelabel'),
conversation_visibility_path(conversation),
:method => 'delete',
:data => { :confirm => "#{t('.hide')}?" },
:title => t('.hide'),
:class => 'close_conversation')
- else
= link_to(content_tag(:div, nil, :class => 'icons-deletelabel'),
conversation_visibility_path(conversation),
:method => 'delete',
:data => { :confirm => "#{t('.delete')}?" },
:title => t('.delete'),
:class => 'close_conversation')
%h3{ :class => direction_for(conversation.subject) }
= conversation.subject
......
......@@ -358,7 +358,8 @@ en:
show:
reply: "reply"
replying: "Replying..."
delete: "delete and block conversation"
hide: "hide and mute conversation"
delete: "delete conversation"
new:
to: "to"
subject: "subject"
......@@ -377,8 +378,8 @@ en:
new_conversation:
fail: "Invalid message"
destroy:
success: "Conversation successfully removed"
delete_success: "Conversation successfully deleted"
hide_success: "Conversation successfully hidden"
date:
formats:
fullmonth_day: "%B %d"
......
......@@ -33,5 +33,18 @@ describe ConversationVisibilitiesController, :type => :controller do
delete :destroy, :conversation_id => @conversation.id
}.not_to change(ConversationVisibility, :count)
end
it 'returns "hidden"' do
get :destroy, :conversation_id => @conversation.id
expect(flash.notice).to include("hidden")
end
it 'returns "deleted" when last participant' do
get :destroy, :conversation_id => @conversation.id
sign_out :user
sign_in :user, bob
get :destroy, :conversation_id => @conversation.id
expect(flash.notice).to include("deleted")
end
end
end
\ No newline at end of file
end
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