mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
29 lines
1.2 KiB
CoffeeScript
29 lines
1.2 KiB
CoffeeScript
logger = require("logger-sharelatex")
|
|
NotificationsHandler = require("./NotificationsHandler")
|
|
|
|
module.exports =
|
|
|
|
groupPlan: (user, licence)->
|
|
key : "join-sub-#{licence.subscription_id}"
|
|
create: (callback = ->)->
|
|
messageOpts =
|
|
groupName: licence.name
|
|
subscription_id: licence.subscription_id
|
|
logger.log user_id:user._id, key:key, "creating notification key for user"
|
|
NotificationsHandler.createNotification user._id, @key, "notification_group_invite", messageOpts, callback
|
|
|
|
read: (callback = ->)->
|
|
NotificationsHandler.markAsReadWithKey user._id, @key, callback
|
|
|
|
projectInvite: (invite, project, sendingUser, user) ->
|
|
key: "project-invite-#{invite._id}"
|
|
create: (callback=()->) ->
|
|
messageOpts =
|
|
userName: sendingUser.first_name
|
|
projectName: project.name
|
|
projectId: project._id.toString()
|
|
token: invite.token
|
|
logger.log {user_id: user._id, project_id: project._id, invite_id: invite._id, key: @key}, "creating project invite notification for user"
|
|
NotificationsHandler.createNotification user._id, @key, "notification_project_invite", messageOpts, callback
|
|
read: (callback=()->) ->
|
|
NotificationsHandler.markAsReadWithKey user._id, @key, callback
|