Skip to content

Commit

Permalink
Extract the notification poll interval to an engine configuration set…
Browse files Browse the repository at this point in the history
…ting
  • Loading branch information
cbeer committed May 12, 2017
1 parent a8ee769 commit 4c60143
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/hyrax/users/_notify_number.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
'aria-label' => t("hyrax.toolbar.notifications"),
class: "notify-number",
data: { 'update-poll-url' => hyrax.user_notify_path,
'update-poll-interval' => 30 } do %>
'update-poll-interval' => Hyrax.config.notifications_update_poll_interval } do %>
<span class="fa fa-bell"></span>
<span class="count invisible label label-danger">0</span>
<% end %>
3 changes: 3 additions & 0 deletions lib/generators/hyrax/templates/config/hyrax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# How many notifications should be displayed on the dashboard
# config.max_notifications_for_dashboard = 5

# How often clients should poll for notifications
# config.notifications_update_poll_interval = 30.seconds

# How frequently should a file be fixity checked
# config.max_days_between_fixity_checks = 7

Expand Down
5 changes: 5 additions & 0 deletions lib/hyrax/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ def max_notifications_for_dashboard
@max_notifications_for_dashboard ||= 5
end

attr_writer :notifications_update_poll_interval
def notifications_update_poll_interval
@notifications_update_poll_interval ||= 30.seconds
end

attr_writer :activity_to_show_default_seconds_since_now
def activity_to_show_default_seconds_since_now
@activity_to_show_default_seconds_since_now ||= 24 * 60 * 60
Expand Down

0 comments on commit 4c60143

Please sign in to comment.