Allow notifications with explicit/unexistent links
Notifications usually link to the associated notifiable, but the new AdminNotifications have a link attribute that may be empty or contain an external or internal url.
This commit is contained in:
@@ -44,7 +44,11 @@ class NotificationsController < ApplicationController
|
||||
when "Topic"
|
||||
community_topic_path @notification.linkable_resource.community, @notification.linkable_resource
|
||||
else
|
||||
url_for @notification.linkable_resource
|
||||
if @notification.linkable_resource.is_a?(AdminNotification)
|
||||
@notification.linkable_resource.link || notifications_path
|
||||
else
|
||||
url_for @notification.linkable_resource
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user