diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 033e68c2f..4354093bc 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -65,22 +65,22 @@ class NotificationsController < ApplicationController end def read_all - if params[:type] - Notification.where(:recipient_id => current_user.id, :type => Notification.types[params[:type]]).update_all(:unread => false) - else - Notification.where(:recipient_id => current_user.id).update_all(:unread => false) - end + current_type = Notification.types[params[:type]] + notifications = Notification.where(:recipient_id => current_user.id) + notifications = notifications.where(:type => current_type) if params[:type] + notifications.update_all(:unread => false) respond_to do |format| if current_user.unread_notifications.count > 0 - format.html { redirect_to notifications_path} - format.mobile{ redirect_to notifications_path} + format.html { redirect_to notifications_path } + format.mobile { redirect_to notifications_path } else format.html { redirect_to stream_path } - format.mobile{ redirect_to stream_path} + format.mobile { redirect_to stream_path } end - format.xml { render :xml => {}.to_xml } - format.json { render :json => {}.to_json } + format.xml { render :xml => {}.to_xml } + format.json { render :json => {}.to_json } end + end end diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index 9d0c894dd..19033fe7a 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -37,7 +37,10 @@ %a.btn.btn-default{ :class => ('active' if params[:show] == 'unread'), :href => '/notifications?show=unread' + (params[:type] ? '&type=' + params[:type] : '') } = t('.show_unread') %a.btn.btn-default{:href => read_all_notifications_path(:type => params[:type] ), :class => ('disabled' unless @unread_notification_count > 0)} - = t('.mark_all_as_read') + -if params[:type] + = t('.mark_all_shown_as_read') + -else + = t('.mark_all_as_read') - @group_days.each do |day, notes| .day_group.row-fluid .date.span2 diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 851d01e37..ea4049660 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -708,6 +708,7 @@ en: index: notifications: "Notifications" mark_all_as_read: "Mark all as read" + mark_all_shown_as_read: "Mark all shown as read" mark_read: "Mark read" mark_unread: "Mark unread" show_all: "show all"