changes for notifications
This commit is contained in:
parent
58d81e239b
commit
a737bd3cfd
8 changed files with 9452 additions and 12 deletions
|
@ -62,7 +62,6 @@ class AccessController < ApplicationController
|
|||
request = AccessRequest.find(params[:request_id])
|
||||
request.approve
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.json do
|
||||
head :ok
|
||||
end
|
||||
|
@ -74,7 +73,6 @@ class AccessController < ApplicationController
|
|||
request = AccessRequest.find(params[:request_id])
|
||||
request.deny
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.json do
|
||||
head :ok
|
||||
end
|
||||
|
|
|
@ -7,12 +7,19 @@ class UsersController < ApplicationController
|
|||
|
||||
# GET /users/current
|
||||
def current
|
||||
#if current_user
|
||||
if current_user
|
||||
# these are just options, saying include these values, they aren't the values themselves
|
||||
render json: current_user.to_json({follows: true, email: true, follow_settings: true, emails_allowed: true})
|
||||
#else
|
||||
# render json: nil
|
||||
#end
|
||||
render json: current_user.to_json({
|
||||
follows: true,
|
||||
email: true,
|
||||
follow_settings: true,
|
||||
emails_allowed: true,
|
||||
inviteCode: true,
|
||||
unread_notifications_count: user_unread_notifications_count
|
||||
})
|
||||
else
|
||||
render json: nil
|
||||
end
|
||||
end
|
||||
|
||||
# GET /users/1.json
|
||||
|
|
|
@ -5,7 +5,7 @@ module ApplicationHelper
|
|||
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
|
||||
end
|
||||
|
||||
def user_unread_notification_count
|
||||
def user_unread_notifications_count
|
||||
return 0 if current_user.nil?
|
||||
@uunc ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
|
||||
receipt.is_read ? total : total + 1
|
||||
|
|
|
@ -70,7 +70,8 @@ class User < ApplicationRecord
|
|||
json['follow_map_on_contributed'] = settings.follow_map_on_contributed == '1'
|
||||
end
|
||||
json['email'] = email if options[:email]
|
||||
json['emails_allowed'] = emails_allowed if options[:emails_allowed]
|
||||
json['invite_code'] = code if options[:inviteCode]
|
||||
json['unread_notifications_count'] = options[:unread_notifications_count] if not options[:unread_notifications_count].nil?
|
||||
json
|
||||
end
|
||||
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
$('.main-text').text($('.requesterName').text() + ' has been shared on the map and notified.')
|
|
@ -1 +0,0 @@
|
|||
$('.main-text').text('Fair enough.')
|
|
@ -1,6 +1,6 @@
|
|||
<div id="loading"></div>
|
||||
<script type="text/javascript">
|
||||
Metamaps.ServerData.unreadNotificationsCount = <%= current_user ? user_unread_notification_count : 0 %>
|
||||
Metamaps.ServerData.unreadNotificationsCount = <%= current_user ? user_unread_notifications_count : 0 %>
|
||||
Metamaps.ServerData.mapIsStarred = <%= current_user && @map && current_user.starred_map?(@map) ? true : false %>
|
||||
Metamaps.ServerData.mobileTitle = "<%= yield(:mobile_title) %>"
|
||||
Metamaps.ServerData.ActiveMapper = <%= current_user ? current_user.to_json({follows: true, email: true, follow_settings: true}).html_safe : nil %>
|
||||
|
|
9436
package-lock.json
generated
Normal file
9436
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue