Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve comment notifications in case of deletion

  • Loading branch information...
commit a122cb01839ae677ebe8b78967c125b1da43d6be 1 parent 38beaa2
Robert May authored
5 app/controllers/notifications_controller.rb
View
@@ -28,6 +28,11 @@ def show
respond_with @notification do |f|
f.html { redirect_to path }
end
+
+ rescue ActiveRecord::RecordNotFound
+ respond_to do |f|
+ f.html { redirect_to root_path, alert: t("notifications.not_found") }
+ end
end
def mark_all_as_read
2  app/models/comment.rb
View
@@ -1,7 +1,7 @@
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :comment_thread, touch: true
- has_many :notifications, as: :notifiable
+ has_many :notifications, as: :notifiable, dependent: :destroy
has_many :reports, as: :reportable
acts_as_tree dependent: :destroy
3  config/locales/en.yml
View
@@ -469,6 +469,9 @@ en:
title: "Notifications"
none: "You have no notifications right now."
mark_as_read: "Mark all as read"
+ not_found: >
+ That notification could not be found, it is possible that the event which
+ generated it has changed.
email:
subject: "Photographer.io: %{subject}"
button: "View on Photographer.io"
Please sign in to comment.
Something went wrong with that request. Please try again.