diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index f2569383..9d167647 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -1,8 +1,13 @@ class NotificationsController < ApplicationController before_action :authenticate_user! + TYPE_MAPPINGS = { + 'smile' => 'appendable::reaction', + 'reaction' => 'appendable::reaction', + }.freeze + def index - @type = params[:type] + @type = TYPE_MAPPINGS[params[:type]] || params[:type] @notifications = cursored_notifications_for(type: @type, last_id: params[:last_id]) @notifications_last_id = @notifications.map(&:id).min @more_data_available = !cursored_notifications_for(type: @type, last_id: @notifications_last_id, size: 1).count.zero? diff --git a/app/views/notifications/index.haml b/app/views/notifications/index.haml index 4c472f81..2f10b5e0 100644 --- a/app/views/notifications/index.haml +++ b/app/views/notifications/index.haml @@ -13,7 +13,7 @@ - @notifications.each do |notification| %li.list-group-item .media - = render "notifications/type/#{notification.target_type.downcase}", notification: notification + = render "notifications/type/#{notification.target_type.downcase.split('::').last}", notification: notification - unless @notifications.count.zero? = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type]