Skip to content

Commit 729164e

Browse files
committed
lint: lib/models/note.ts
- add cursor and user stats type lint: lib/models/note.ts - add missing relation fields
1 parent 50f4b6b commit 729164e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

lib/models/note.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import config from "../config";
2020
import {logger} from "../logger";
2121
import {createNoteWithRevision, syncNote} from "../services/note";
2222
import {stripTags} from "../string";
23-
import {Authorship, ModelObj, MySequelize, NoteAttributes, NoteMeta} from "./baseModel";
23+
import {Authorship, ModelObj, MySequelize, NoteAttributes, NoteMeta, UserModel} from "./baseModel";
2424

2525
const md = markdownIt()
2626
export const dmp = new DiffMatchPatch()
@@ -48,6 +48,8 @@ export class Note extends Model<NoteAttributes> implements NoteAttributes {
4848
ownerId: string
4949

5050
lastchangeuserId?: string
51+
owner?: UserModel;
52+
lastchangeuser?: UserModel;
5153

5254
static initialize(sequelize: MySequelize): void {
5355
Note.init({

lib/note/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ export async function showPublishNote(req: Request, res: Response): Promise<void
140140
updatetime: updateTime,
141141
body: body,
142142
owner: note.owner ? note.owner.id : null,
143-
ownerprofile: note.owner ? User.getProfile(note.owner) : null,
143+
ownerprofile: note.owner ? User.getProfile(note.owner as User) : null,
144144
lastchangeuser: note.lastchangeuser ? note.lastchangeuser.id : null,
145-
lastchangeuserprofile: note.lastchangeuser ? User.getProfile(note.lastchangeuser) : null,
145+
lastchangeuserprofile: note.lastchangeuser ? User.getProfile(note.lastchangeuser as User) : null,
146146
robots: meta.robots || false, // default allow robots
147147
GA: meta.GA,
148148
disqus: meta.disqus,

lib/realtime/realtime.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ export interface RealtimeUserData {
3333
'user-agent'?: string
3434
photo?: string
3535

36-
cursor?: any
36+
cursor?: {line: number, ch: number}
3737
login?: boolean
3838
userid?: string
3939
name?: string
4040

41-
idle?: any
42-
type?: any
41+
// user status
42+
idle: boolean
43+
type: 'xs' | 'sm' | 'md' | 'lg'
4344
}
4445

4546
interface RealtimeAuthorData {

0 commit comments

Comments
 (0)