mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-04-20 12:25:51 +00:00
Merge pull request #1790 from hedgedoc/fix-gitlab-response-crash
This commit is contained in:
commit
2d811ffeb2
2 changed files with 11 additions and 2 deletions
|
@ -153,7 +153,9 @@ function gitlabActionProjects (req, res, note) {
|
|||
id: req.user.id
|
||||
}
|
||||
}).then(function (user) {
|
||||
if (!user) { return errors.errorNotFound(res) }
|
||||
if (!user) {
|
||||
return errors.errorNotFound(res)
|
||||
}
|
||||
const ret = { baseURL: config.gitlab.baseURL, version: config.gitlab.version }
|
||||
ret.accesstoken = user.accessToken
|
||||
ret.profileid = user.profileid
|
||||
|
@ -161,12 +163,14 @@ function gitlabActionProjects (req, res, note) {
|
|||
fetch(apiUrl).then(resp => {
|
||||
if (!resp.ok) {
|
||||
res.send(ret)
|
||||
throw new Error('HTTP request returned not okay-ish status')
|
||||
return Promise.reject(new Error('HTTP request returned not okay-ish status'))
|
||||
}
|
||||
return resp.json()
|
||||
}).then(body => {
|
||||
ret.projects = body
|
||||
return res.send(ret)
|
||||
}).catch(err => {
|
||||
logger.error('gitlab action projects failed: ', err)
|
||||
})
|
||||
}).catch(function (err) {
|
||||
logger.error('gitlab action projects failed: ' + err)
|
||||
|
|
|
@ -621,6 +621,11 @@ Visibility.change(function (e, state) {
|
|||
|
||||
// when page ready
|
||||
$(document).ready(function () {
|
||||
// set global ajax timeout
|
||||
$.ajaxSetup({
|
||||
timeout: 10000
|
||||
})
|
||||
|
||||
idle.checkAway()
|
||||
checkResponsive()
|
||||
// if in smaller screen, we don't need advanced scrollbar
|
||||
|
|
Loading…
Add table
Reference in a new issue