Merge pull request #5477 from margori/Leave_conversation_tooltip

Changed delete conversation button tooltip
This commit is contained in:
Steffen van Bergerem 2014-12-20 00:43:52 +01:00
commit 1efed0ea61
5 changed files with 40 additions and 12 deletions

View file

@ -77,6 +77,7 @@ This is disabled by default since it requires the installation of additional pac
* Cleanup diaspora.yml [#5426](https://github.com/diaspora/diaspora/pull/5426)
* Replace `opengraph_parser` with `open_graph_reader` [#5462](https://github.com/diaspora/diaspora/pull/5462)
* Make sure conversations without any visibilities left are deleted [#5478](https://github.com/diaspora/diaspora/pull/5478)
* Change tooltip for delete button in conversations view [#5477](https://github.com/diaspora/diaspora/pull/5477)
## Bug fixes
* orca cannot see 'Add Contact' button [#5158](https://github.com/diaspora/diaspora/pull/5158)

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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
end