2016-09-24 11:00:46 +08:00
|
|
|
# frozen_string_literal: true
|
2017-11-25 11:23:47 -08:00
|
|
|
|
2016-03-24 21:26:07 -07:00
|
|
|
module ApplicationHelper
|
2016-09-24 12:27:34 +08:00
|
|
|
def invite_link
|
2016-07-26 08:14:23 +08:00
|
|
|
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
|
2016-03-24 21:26:07 -07:00
|
|
|
end
|
2016-11-01 11:18:27 +08:00
|
|
|
|
|
|
|
def user_unread_notification_count
|
|
|
|
return 0 if current_user.nil?
|
2016-12-11 17:29:48 -05:00
|
|
|
@uunc ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
|
2016-11-01 11:18:27 +08:00
|
|
|
receipt.is_read ? total : total + 1
|
|
|
|
end
|
|
|
|
end
|
2012-09-22 22:39:12 -04:00
|
|
|
end
|