Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

Commit

Permalink
Bugfix: Global Banner Off does not work correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
akiko-pusu committed May 6, 2020
1 parent f7e2089 commit 0d157d0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/banners/application_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def should_display_on_current_page?(context, setting)
(context[:controller].action_name != 'login')) &&
(setting['display_only_login_page'] == 'true')

return false if banner_is_off?(context[:controller])
should_display_for?(setting)
end

Expand All @@ -103,5 +104,17 @@ def should_display_for?(setting)

false
end

def banner_is_off?(controller)
banner_off_time = controller.session[:pref_banner_off]

global_banner = GlobalBanner.find_or_default

if !global_banner.blank? && !banner_off_time.blank? && global_banner.updated_on.to_i < banner_off_time
return true
end

false
end
end
end

0 comments on commit 0d157d0

Please sign in to comment.