Skip to content
Extraits de code Groupes Projets
Valider d3daa325 rédigé par zhitomirskiyi's avatar zhitomirskiyi
Parcourir les fichiers

mark a notification as read when you ignore a request

parent b528802d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -11,6 +11,10 @@ class RequestsController < ApplicationController
respond_to :html
def destroy
if notification = Notification.where(:user_id => current_user.id, :target_id=> params[:id]).first
notification.update_attributes(:unread=>false)
end
if params[:accept]
if params[:aspect_id]
@contact = current_user.accept_and_respond( params[:id], params[:aspect_id])
......
......@@ -20,10 +20,6 @@ module Diaspora
end
def accept_contact_request(request, aspect)
if notification = Notification.first(:target_id=>request.id)
notification.update_attributes(:unread=>false)
end
activate_contact(request.from, aspect)
request.destroy
request.reverse_for(self)
......
......@@ -46,6 +46,13 @@ describe RequestsController do
:id => @friend_request.id.to_s
}.should change(Request, :count).by(-1)
end
it "marks the notification as read" do
notification = Notification.where(:user_id => @user.id, :target_id=> @friend_request.id).first
notification.reload.unread.should == true
xhr :delete, :destroy,
:id => @friend_request.id.to_s
notification.reload.unread.should == false
end
end
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