changes for notifications
This commit is contained in:
parent
58d81e239b
commit
a737bd3cfd
|
@ -62,7 +62,6 @@ class AccessController < ApplicationController
|
||||||
request = AccessRequest.find(params[:request_id])
|
request = AccessRequest.find(params[:request_id])
|
||||||
request.approve
|
request.approve
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
|
||||||
format.json do
|
format.json do
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
@ -74,7 +73,6 @@ class AccessController < ApplicationController
|
||||||
request = AccessRequest.find(params[:request_id])
|
request = AccessRequest.find(params[:request_id])
|
||||||
request.deny
|
request.deny
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
|
||||||
format.json do
|
format.json do
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,12 +7,19 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# GET /users/current
|
# GET /users/current
|
||||||
def current
|
def current
|
||||||
#if current_user
|
if current_user
|
||||||
# these are just options, saying include these values, they aren't the values themselves
|
# 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})
|
render json: current_user.to_json({
|
||||||
#else
|
follows: true,
|
||||||
# render json: nil
|
email: true,
|
||||||
#end
|
follow_settings: true,
|
||||||
|
emails_allowed: true,
|
||||||
|
inviteCode: true,
|
||||||
|
unread_notifications_count: user_unread_notifications_count
|
||||||
|
})
|
||||||
|
else
|
||||||
|
render json: nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /users/1.json
|
# GET /users/1.json
|
||||||
|
|
|
@ -5,7 +5,7 @@ module ApplicationHelper
|
||||||
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
|
"#{request.base_url}/join" + (current_user ? "?code=#{current_user.code}" : '')
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_unread_notification_count
|
def user_unread_notifications_count
|
||||||
return 0 if current_user.nil?
|
return 0 if current_user.nil?
|
||||||
@uunc ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
|
@uunc ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
|
||||||
receipt.is_read ? total : total + 1
|
receipt.is_read ? total : total + 1
|
||||||
|
|
|
@ -70,7 +70,8 @@ class User < ApplicationRecord
|
||||||
json['follow_map_on_contributed'] = settings.follow_map_on_contributed == '1'
|
json['follow_map_on_contributed'] = settings.follow_map_on_contributed == '1'
|
||||||
end
|
end
|
||||||
json['email'] = email if options[:email]
|
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
|
json
|
||||||
end
|
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>
|
<div id="loading"></div>
|
||||||
<script type="text/javascript">
|
<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.mapIsStarred = <%= current_user && @map && current_user.starred_map?(@map) ? true : false %>
|
||||||
Metamaps.ServerData.mobileTitle = "<%= yield(:mobile_title) %>"
|
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 %>
|
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