Skip to content
Extraits de code Groupes Projets
notifications_controller.rb 717 octets
Newer Older
  • Learn to ignore specific revisions
  • maxwell's avatar
    maxwell a validé
    #   Copyright (c) 2010, Diaspora Inc.  This file is
    #   licensed under the Affero General Public License version 3 or later.  See
    #   the COPYRIGHT file.
    
    class NotificationsController < ApplicationController
      before_filter :authenticate_user!
    
    maxwell's avatar
    maxwell a validé
    
    
    maxwell's avatar
    maxwell a validé
    
      def update
    
        note = Notification.where(:recipient_id => current_user.id, :id => params[:id]).first
    
    maxwell's avatar
    maxwell a validé
        if note
    
    maxwell's avatar
    maxwell a validé
          note.update_attributes(:unread => false)
    
    maxwell's avatar
    maxwell a validé
          render :nothing => true
        else
          render :nothing => true, :code => 404
        end
      end
    
      def index
    
        @notifications = Notification.for(current_user)
    
        @group_days = @notifications.group_by{|note| note.created_at.strftime("%B %d") }
    
    maxwell's avatar
    maxwell a validé
      end
    end