mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
worked on response.ts
- renamed unused arguments to '_' - fixed noteUtil call - moved export of response to the end of the file Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
57675265fc
commit
6601ac76b5
1 changed files with 15 additions and 11 deletions
|
@ -3,7 +3,7 @@ import { Note, User } from './models'
|
||||||
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
import {logger} from './logger'
|
import { logger } from './logger'
|
||||||
|
|
||||||
import { NoteUtils } from './web/note/util'
|
import { NoteUtils } from './web/note/util'
|
||||||
|
|
||||||
|
@ -12,13 +12,8 @@ import errors from './errors'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
import request from 'request'
|
import request from 'request'
|
||||||
export const response = {
|
|
||||||
showIndex: showIndex,
|
|
||||||
githubActions: githubActions,
|
|
||||||
gitlabActions: gitlabActions
|
|
||||||
}
|
|
||||||
|
|
||||||
function showIndex (req, res, next) {
|
function showIndex (req, res, _): void {
|
||||||
const authStatus = req.isAuthenticated()
|
const authStatus = req.isAuthenticated()
|
||||||
const deleteToken = ''
|
const deleteToken = ''
|
||||||
|
|
||||||
|
@ -54,8 +49,11 @@ function githubActionGist (req, res, note: Note): void {
|
||||||
if (!code || !state) {
|
if (!code || !state) {
|
||||||
return errors.errorForbidden(res)
|
return errors.errorForbidden(res)
|
||||||
} else {
|
} else {
|
||||||
|
// This is the way the github api works, therefore we can't change it to camelcase
|
||||||
const data = {
|
const data = {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||||
client_id: config.github.clientID,
|
client_id: config.github.clientID,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||||
client_secret: config.github.clientSecret,
|
client_secret: config.github.clientSecret,
|
||||||
code: code,
|
code: code,
|
||||||
state: state
|
state: state
|
||||||
|
@ -105,7 +103,7 @@ function githubActionGist (req, res, note: Note): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function githubActions (req, res, next): void {
|
function githubActions (req, res, _): void {
|
||||||
const noteId = req.params.noteId
|
const noteId = req.params.noteId
|
||||||
NoteUtils.findNoteOrCreate(req, res, function (note: Note) {
|
NoteUtils.findNoteOrCreate(req, res, function (note: Note) {
|
||||||
const action = req.params.action
|
const action = req.params.action
|
||||||
|
@ -120,7 +118,7 @@ function githubActions (req, res, next): void {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function gitlabActionProjects (req, res, note): void {
|
function gitlabActionProjects (req, res, _): void {
|
||||||
if (req.isAuthenticated()) {
|
if (req.isAuthenticated()) {
|
||||||
User.findOne({
|
User.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
@ -163,9 +161,9 @@ function gitlabActionProjects (req, res, note): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function gitlabActions (req, res, next): void {
|
function gitlabActions (req, res, _): void {
|
||||||
const noteId = req.params.noteId
|
const noteId = req.params.noteId
|
||||||
noteUtil.findNote(req, res, function (note) {
|
NoteUtils.findNoteOrCreate(req, res, function (note) {
|
||||||
const action = req.params.action
|
const action = req.params.action
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'projects':
|
case 'projects':
|
||||||
|
@ -177,3 +175,9 @@ function gitlabActions (req, res, next): void {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const response = {
|
||||||
|
showIndex: showIndex,
|
||||||
|
githubActions: githubActions,
|
||||||
|
gitlabActions: gitlabActions
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue