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) * 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) * 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) * 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 ## Bug fixes
* orca cannot see 'Add Contact' button [#5158](https://github.com/diaspora/diaspora/pull/5158) * 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, @vis = ConversationVisibility.where(:person_id => current_user.person.id,
:conversation_id => params[:conversation_id]).first :conversation_id => params[:conversation_id]).first
if @vis if @vis
participants = @vis.conversation.participants.count
if @vis.destroy 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
end end
redirect_to conversations_path redirect_to conversations_path

View file

@ -3,13 +3,21 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
.conversation_participants .conversation_participants
= link_to(content_tag(:div, nil, :class => 'icons-deletelabel'), - if conversation.participants.count > 1
conversation_visibility_path(conversation), = link_to(content_tag(:div, nil, :class => 'icons-deletelabel'),
:method => 'delete', conversation_visibility_path(conversation),
:data => { :confirm => "#{t('.delete')}?" }, :method => 'delete',
:title => t('.delete'), :data => { :confirm => "#{t('.hide')}?" },
:class => 'close_conversation') :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) } %h3{ :class => direction_for(conversation.subject) }
= conversation.subject = conversation.subject

View file

@ -358,7 +358,8 @@ en:
show: show:
reply: "reply" reply: "reply"
replying: "Replying..." replying: "Replying..."
delete: "delete and block conversation" hide: "hide and mute conversation"
delete: "delete conversation"
new: new:
to: "to" to: "to"
subject: "subject" subject: "subject"
@ -377,8 +378,8 @@ en:
new_conversation: new_conversation:
fail: "Invalid message" fail: "Invalid message"
destroy: destroy:
success: "Conversation successfully removed" delete_success: "Conversation successfully deleted"
hide_success: "Conversation successfully hidden"
date: date:
formats: formats:
fullmonth_day: "%B %d" fullmonth_day: "%B %d"

View file

@ -33,5 +33,18 @@ describe ConversationVisibilitiesController, :type => :controller do
delete :destroy, :conversation_id => @conversation.id delete :destroy, :conversation_id => @conversation.id
}.not_to change(ConversationVisibility, :count) }.not_to change(ConversationVisibility, :count)
end 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 end