Cleanups lib/web/note

Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
David Mehren 2020-05-24 21:09:03 +02:00
parent 280fda1d6c
commit 5a6ec56a7e
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
3 changed files with 6 additions and 21 deletions

View file

@ -2,7 +2,7 @@ import { Request, Response } from 'express'
import { config } from '../../config'
import { errors } from '../../errors'
import { logger } from '../../logger'
import { Note, User } from '../../models'
import { Note } from '../../models'
import * as ActionController from './actions'
import * as NoteUtils from './util'
@ -24,13 +24,6 @@ export function publishNoteActions (req: Request, res: Response): void {
}
export function showPublishNote (req: Request, res: Response): void {
const include = [{
model: User,
as: 'owner'
}, {
model: User,
as: 'lastchangeuser'
}]
NoteUtils.findNoteOrCreate(req, res, function (note) {
// force to use short id
const shortid = req.params.shortid

View file

@ -1,11 +1,11 @@
import { NextFunction, Response } from 'express'
import { Request, Response } from 'express'
import { config } from '../../config'
import { errors } from '../../errors'
import { logger } from '../../logger'
import { Note, User } from '../../models'
import { Note } from '../../models'
import * as NoteUtils from './util'
export function publishSlideActions (req: any, res: Response) {
export function publishSlideActions (req: Request, res: Response): void {
NoteUtils.findNoteOrCreate(req, res, function (note) {
const action = req.params.action
if (action === 'edit') {
@ -16,14 +16,7 @@ export function publishSlideActions (req: any, res: Response) {
})
}
export function showPublishSlide (req: any, res: Response) {
const include = [{
model: User,
as: 'owner'
}, {
model: User,
as: 'lastchangeuser'
}]
export function showPublishSlide (req: Request, res: Response): void {
NoteUtils.findNoteOrCreate(req, res, function (note) {
// force to use short id
const shortid = req.params.shortid

View file

@ -2,7 +2,6 @@ import { Request, Response } from 'express'
import fs from 'fs'
import path from 'path'
import { Includeable } from 'sequelize'
import { config } from '../../config'
import { errors } from '../../errors'
import { logger } from '../../logger'
@ -33,7 +32,7 @@ export function newNote (req, res: Response, body: string | null): void {
})
}
export function checkViewPermission (req, note: any): boolean {
export function checkViewPermission (req, note: Note): boolean {
if (note.permission === 'private') {
return req.isAuthenticated() && note.ownerId === req.user.id
} else if (note.permission === 'limited' || note.permission === 'protected') {