mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 08:09:01 +02:00
Merge pull request #17084 from overleaf/dp-mongoose-callback-system-message-manager
Promisify SystemMessageManager and SystemMessageManagerTests GitOrigin-RevId: b8fafdfdba817160c1b18cf7eb0270a27adf114c
This commit is contained in:
@@ -8,23 +8,19 @@ const ProjectController = {
|
||||
// gracefully handle requests from anonymous users
|
||||
return res.json([])
|
||||
}
|
||||
SystemMessageManager.getMessages((err, messages) => {
|
||||
if (err) {
|
||||
next(err)
|
||||
} else {
|
||||
if (!Settings.siteIsOpen) {
|
||||
// Override all messages with notice for admins when site is closed.
|
||||
messages = [
|
||||
{
|
||||
content:
|
||||
'SITE IS CLOSED TO PUBLIC. OPEN ONLY FOR SITE ADMINS. DO NOT EDIT PROJECTS.',
|
||||
_id: 'protected', // prevents hiding message in frontend
|
||||
},
|
||||
]
|
||||
}
|
||||
res.json(messages || [])
|
||||
}
|
||||
})
|
||||
let messages = SystemMessageManager.getMessages()
|
||||
|
||||
if (!Settings.siteIsOpen) {
|
||||
// Override all messages with notice for admins when site is closed.
|
||||
messages = [
|
||||
{
|
||||
content:
|
||||
'SITE IS CLOSED TO PUBLIC. OPEN ONLY FOR SITE ADMINS. DO NOT EDIT PROJECTS.',
|
||||
_id: 'protected', // prevents hiding message in frontend
|
||||
},
|
||||
]
|
||||
}
|
||||
res.json(messages || [])
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user