mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add missing ip matcher endpoint hit when opening project dashboard react (#12015)
* Add missing ip matcher endpoint hit when opening project dashboard react * Add error logger on the catch block GitOrigin-RevId: 0f69de329b1290a4f0f98ef00dda050fb09d5a08
This commit is contained in:
parent
351ab1979b
commit
f1304fa205
2 changed files with 17 additions and 0 deletions
|
@ -245,6 +245,9 @@ NotificationsBuilder.promises = {
|
||||||
dropboxDuplicateProjectNames(userId) {
|
dropboxDuplicateProjectNames(userId) {
|
||||||
return promisifyAll(dropboxDuplicateProjectNames(userId))
|
return promisifyAll(dropboxDuplicateProjectNames(userId))
|
||||||
},
|
},
|
||||||
|
ipMatcherAffiliation: function (userId) {
|
||||||
|
return promisifyAll(ipMatcherAffiliation(userId))
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = NotificationsBuilder
|
module.exports = NotificationsBuilder
|
||||||
|
|
|
@ -20,6 +20,7 @@ const { User } = require('../../models/User')
|
||||||
const UserPrimaryEmailCheckHandler = require('../User/UserPrimaryEmailCheckHandler')
|
const UserPrimaryEmailCheckHandler = require('../User/UserPrimaryEmailCheckHandler')
|
||||||
const UserController = require('../User/UserController')
|
const UserController = require('../User/UserController')
|
||||||
const LimitationsManager = require('../Subscription/LimitationsManager')
|
const LimitationsManager = require('../Subscription/LimitationsManager')
|
||||||
|
const NotificationsBuilder = require('../Notifications/NotificationsBuilder')
|
||||||
|
|
||||||
/** @typedef {import("./types").GetProjectsRequest} GetProjectsRequest */
|
/** @typedef {import("./types").GetProjectsRequest} GetProjectsRequest */
|
||||||
/** @typedef {import("./types").GetProjectsResponse} GetProjectsResponse */
|
/** @typedef {import("./types").GetProjectsResponse} GetProjectsResponse */
|
||||||
|
@ -283,6 +284,19 @@ async function projectListReactPage(req, res, next) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in v2 add notifications for matching university IPs
|
||||||
|
if (Settings.overleaf != null && req.ip !== user.lastLoginIp) {
|
||||||
|
NotificationsBuilder.promises
|
||||||
|
.ipMatcherAffiliation(user._id)
|
||||||
|
.create(req.ip)
|
||||||
|
.catch(err => {
|
||||||
|
logger.error(
|
||||||
|
{ err },
|
||||||
|
'failed to create institutional IP match notification'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const hasPaidAffiliation = userAffiliations.some(
|
const hasPaidAffiliation = userAffiliations.some(
|
||||||
affiliation => affiliation.licence && affiliation.licence !== 'free'
|
affiliation => affiliation.licence && affiliation.licence !== 'free'
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue