File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11class NamesController < ApplicationController
22 before_action ( :set_tutorial )
3+ before_action ( :set_name_and_notifications , only : %i[ show ] )
34 before_action (
45 :set_name ,
56 only : %i[
6- show edit update destroy network wiki
7+ edit update destroy network wiki
78 proposed_in not_validly_proposed_in emended_in assigned_in
89 corrigendum_in corrigendum_orphan corrigendum
910 edit_description edit_rank edit_notes edit_etymology edit_links edit_type
@@ -567,17 +568,24 @@ def quality_checks
567568 private
568569
569570 # Use callbacks to share common setup or constraints between actions
571+ def set_name_and_notifications
572+ if set_name
573+ current_user
574+ &.unseen_notifications
575+ &.where ( notifiable : @name )
576+ &.update ( seen : true )
577+ end
578+ end
579+
570580 def set_name
571581 @name = Name . find ( params [ :id ] )
572582
573583 if @name &.can_view? ( current_user , cookies [ :reviewer_token ] )
574584 @register = @name . try ( :register )
575- current_user
576- &.unseen_notifications
577- &.where ( notifiable : @name )
578- &.update ( seen : true )
585+ true
579586 else
580587 render 'hidden'
588+ false
581589 end
582590 end
583591
You can’t perform that action at this time.
0 commit comments