mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge branch 'master' of https://github.com/sharelatex/web-sharelatex
This commit is contained in:
@@ -111,14 +111,16 @@ module.exports = CollaboratorsInviteController =
|
||||
|
||||
acceptInvite: (req, res, next) ->
|
||||
projectId = req.params.Project_id
|
||||
inviteId = req.params.invite_id
|
||||
{token} = req.body
|
||||
token = req.params.token
|
||||
currentUser = req.session.user
|
||||
logger.log {projectId, inviteId, userId: currentUser._id}, "accepting invite"
|
||||
CollaboratorsInviteHandler.acceptInvite projectId, inviteId, token, currentUser, (err) ->
|
||||
logger.log {projectId, userId: currentUser._id, token}, "got request to accept invite"
|
||||
CollaboratorsInviteHandler.acceptInvite projectId, token, currentUser, (err) ->
|
||||
if err?
|
||||
logger.err {projectId, inviteId}, "error accepting invite by token"
|
||||
logger.err {projectId, token}, "error accepting invite by token"
|
||||
return next(err)
|
||||
EditorRealTimeController.emitToRoom projectId, 'project:membership:changed', {invites: true, members: true}
|
||||
AnalyticsManger.recordEvent(currentUser._id, "project-invite-accept", {inviteId:inviteId, projectId:projectId})
|
||||
res.redirect "/project/#{projectId}"
|
||||
AnalyticsManger.recordEvent(currentUser._id, "project-invite-accept", {projectId:projectId, userId:currentUser._id})
|
||||
if req.xhr
|
||||
res.sendStatus 204 # Done async via project page notification
|
||||
else
|
||||
res.redirect "/project/#{projectId}"
|
||||
|
||||
@@ -77,10 +77,12 @@ module.exports = CollaboratorsInviteHandler =
|
||||
if err?
|
||||
logger.err {err, projectId, sendingUserId: sendingUser._id, email}, "error saving token"
|
||||
return callback(err)
|
||||
# Send email and notification in background
|
||||
CollaboratorsInviteHandler._sendMessages projectId, sendingUser, invite, (err) ->
|
||||
if err?
|
||||
logger.err {projectId, email}, "error sending messages for invite"
|
||||
callback(err, invite)
|
||||
callback(null, invite)
|
||||
|
||||
|
||||
revokeInvite: (projectId, inviteId, callback=(err)->) ->
|
||||
logger.log {projectId, inviteId}, "removing invite"
|
||||
@@ -117,15 +119,15 @@ module.exports = CollaboratorsInviteHandler =
|
||||
return callback(null, null)
|
||||
callback(null, invite)
|
||||
|
||||
acceptInvite: (projectId, inviteId, tokenString, user, callback=(err)->) ->
|
||||
logger.log {projectId, inviteId, userId: user._id}, "accepting invite"
|
||||
acceptInvite: (projectId, tokenString, user, callback=(err)->) ->
|
||||
logger.log {projectId, userId: user._id, tokenString}, "accepting invite"
|
||||
CollaboratorsInviteHandler.getInviteByToken projectId, tokenString, (err, invite) ->
|
||||
if err?
|
||||
logger.err {err, projectId, inviteId}, "error finding invite"
|
||||
logger.err {err, projectId, tokenString}, "error finding invite"
|
||||
return callback(err)
|
||||
if !invite
|
||||
err = new Errors.NotFoundError("no matching invite found")
|
||||
logger.log {err, projectId, inviteId, tokenString}, "no matching invite found"
|
||||
logger.log {err, projectId, tokenString}, "no matching invite found"
|
||||
return callback(err)
|
||||
inviteId = invite._id
|
||||
CollaboratorsHandler.addUserIdToProject projectId, invite.sendingUserId, user._id, invite.privileges, (err) ->
|
||||
|
||||
@@ -66,7 +66,7 @@ module.exports =
|
||||
)
|
||||
|
||||
webRouter.post(
|
||||
'/project/:Project_id/invite/:invite_id/accept',
|
||||
'/project/:Project_id/invite/token/:token/accept',
|
||||
AuthenticationController.requireLogin(),
|
||||
CollaboratorsInviteController.acceptInvite
|
||||
)
|
||||
|
||||
@@ -315,8 +315,12 @@ script(type='text/ng-template', id='newDocModalTemplate')
|
||||
required,
|
||||
ng-model="inputs.name",
|
||||
on-enter="create()",
|
||||
select-name-on="open"
|
||||
select-name-on="open",
|
||||
ng-pattern="validFileRegex",
|
||||
name="name"
|
||||
)
|
||||
.text-danger.row-spaced-small(ng-show="newDocForm.name.$error.pattern")
|
||||
| #{translate('files_cannot_include_invalid_characters')}
|
||||
.modal-footer
|
||||
button.btn.btn-default(
|
||||
ng-disabled="state.inflight"
|
||||
@@ -341,8 +345,12 @@ script(type='text/ng-template', id='newFolderModalTemplate')
|
||||
required,
|
||||
ng-model="inputs.name",
|
||||
on-enter="create()",
|
||||
select-name-on="open"
|
||||
select-name-on="open",
|
||||
ng-pattern="validFileRegex",
|
||||
name="name"
|
||||
)
|
||||
.text-danger.row-spaced-small(ng-show="newFolderForm.name.$error.pattern")
|
||||
| #{translate('files_cannot_include_invalid_characters')}
|
||||
.modal-footer
|
||||
button.btn.btn-default(
|
||||
ng-disabled="state.inflight"
|
||||
@@ -414,3 +422,13 @@ script(type='text/ng-template', id='deleteEntityModalTemplate')
|
||||
)
|
||||
span(ng-hide="state.inflight") #{translate("delete")}
|
||||
span(ng-show="state.inflight") #{translate("deleting")}...
|
||||
|
||||
script(type='text/ng-template', id='invalidFileNameModalTemplate')
|
||||
.modal-header
|
||||
h3 #{translate('invalid_file_name')}
|
||||
.modal-body
|
||||
p #{translate('files_cannot_include_invalid_characters')}
|
||||
.modal-footer
|
||||
button.btn.btn-default(
|
||||
ng-click="$close()"
|
||||
) #{translate('ok')}
|
||||
@@ -20,7 +20,7 @@ block content
|
||||
form.form(
|
||||
name="acceptForm",
|
||||
method="POST",
|
||||
action="/project/#{invite.projectId}/invite/#{invite._id}/accept"
|
||||
action="/project/#{invite.projectId}/invite/token/#{invite.token}/accept"
|
||||
)
|
||||
input(name='_csrf', type='hidden', value=csrfToken)
|
||||
input(name='token', type='hidden', value="#{invite.token}")
|
||||
|
||||
@@ -4,14 +4,31 @@ span(ng-controller="NotificationsController").userNotifications
|
||||
ng-cloak
|
||||
)
|
||||
li.notification_entry(
|
||||
ng-repeat="unreadNotification in notifications",
|
||||
ng-repeat="notification in notifications",
|
||||
)
|
||||
.row(ng-hide="unreadNotification.hide")
|
||||
.row(ng-hide="notification.hide")
|
||||
.col-xs-12
|
||||
.alert.alert-info
|
||||
.alert.alert-info(ng-if="notification.templateKey == 'notification_project_invite'", ng-controller="ProjectInviteNotificationController")
|
||||
div.notification_inner
|
||||
span(ng-bind-html="unreadNotification.html").notification_body
|
||||
.notification_body(ng-show="!notification.accepted")
|
||||
| !{translate("notification_project_invite_message")}
|
||||
a.pull-right.btn.btn-sm.btn-info(href, ng-click="accept()", ng-disabled="notification.inflight")
|
||||
span(ng-show="!notification.inflight") #{translate("join_project")}
|
||||
span(ng-show="notification.inflight")
|
||||
i.fa.fa-fw.fa-spinner.fa-spin
|
||||
|
|
||||
| #{translate("joining")}...
|
||||
.notification_body(ng-show="notification.accepted")
|
||||
| !{translate("notification_project_invite_accepted_message")}
|
||||
a.pull-right.btn.btn-sm.btn-info(href="/project/{{ notification.messageOpts.projectId }}") #{translate("open_project")}
|
||||
span().notification_close
|
||||
button(ng-click="dismiss(unreadNotification)").close.pull-right
|
||||
button(ng-click="dismiss(notification)").close.pull-right
|
||||
span(aria-hidden="true") ×
|
||||
span.sr-only #{translate("close")}
|
||||
.alert.alert-info(ng-if="notification.templateKey != 'notification_project_invite'")
|
||||
div.notification_inner
|
||||
span(ng-bind-html="notification.html").notification_body
|
||||
span().notification_close
|
||||
button(ng-click="dismiss(notification)").close.pull-right
|
||||
span(aria-hidden="true") ×
|
||||
span.sr-only #{translate("close")}
|
||||
|
||||
Reference in New Issue
Block a user