mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 03:06:31 -05:00
fix: code formatting
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
ae9ec95a4e
commit
4d70ccafbc
13 changed files with 51 additions and 21 deletions
|
@ -372,9 +372,9 @@ export class NotesService {
|
|||
return {
|
||||
id: note.publicId,
|
||||
aliases: await Promise.all(
|
||||
(
|
||||
await note.aliases
|
||||
).map((alias) => this.aliasService.toAliasDto(alias, note)),
|
||||
(await note.aliases).map((alias) =>
|
||||
this.aliasService.toAliasDto(alias, note),
|
||||
),
|
||||
),
|
||||
primaryAddress: (await getPrimaryAlias(note)) ?? note.publicId,
|
||||
title: latestRevision.title,
|
||||
|
|
|
@ -32,7 +32,7 @@ jest.mock(
|
|||
...jest.requireActual('@hedgedoc/commons'),
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
YDocSyncServerAdapter: jest.fn(() => Mock.of<YDocSyncServerAdapter>({})),
|
||||
} as Record<string, unknown>),
|
||||
}) as Record<string, unknown>,
|
||||
);
|
||||
|
||||
describe('websocket connection', () => {
|
||||
|
|
|
@ -143,9 +143,9 @@ export class RevisionsService {
|
|||
anonymousAuthorCount: revisionUserInfo.anonymousUserCount,
|
||||
patch: revision.patch,
|
||||
edits: await Promise.all(
|
||||
(
|
||||
await revision.edits
|
||||
).map(async (edit) => await this.editService.toEditDto(edit)),
|
||||
(await revision.edits).map(
|
||||
async (edit) => await this.editService.toEditDto(edit),
|
||||
),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -61,8 +61,12 @@ export class SessionService {
|
|||
*/
|
||||
fetchUsernameForSessionId(sessionId: string): Promise<Username | undefined> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.typeormStore.get(sessionId, (error?: Error, result?: SessionState) =>
|
||||
error || !result ? reject(error) : resolve(result.username as Username),
|
||||
this.typeormStore.get(
|
||||
sessionId,
|
||||
(error?: Error, result?: SessionState) =>
|
||||
error || !result
|
||||
? reject(error)
|
||||
: resolve(result.username as Username),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -11,7 +11,10 @@ import { ApiError } from './api-error'
|
|||
export class ErrorToI18nKeyMapper {
|
||||
private foundI18nKey: string | undefined = undefined
|
||||
|
||||
constructor(private apiError: Error, private i18nNamespace?: string) {}
|
||||
constructor(
|
||||
private apiError: Error,
|
||||
private i18nNamespace?: string
|
||||
) {}
|
||||
|
||||
public withHttpCode(code: number, i18nKey: string, treatAsAbsoluteKey?: boolean): this {
|
||||
if (this.foundI18nKey === undefined && this.apiError instanceof ApiError && this.apiError.statusCode === code) {
|
||||
|
|
|
@ -16,7 +16,11 @@ const syncAnnotation = Annotation.define()
|
|||
export class YTextSyncViewPlugin implements PluginValue {
|
||||
private readonly observer: YTextSyncViewPlugin['onYTextUpdate']
|
||||
|
||||
constructor(private view: EditorView, private readonly yText: YText, pluginLoaded: () => void) {
|
||||
constructor(
|
||||
private view: EditorView,
|
||||
private readonly yText: YText,
|
||||
pluginLoaded: () => void
|
||||
) {
|
||||
this.observer = this.onYTextUpdate.bind(this)
|
||||
this.yText.observe(this.observer)
|
||||
pluginLoaded()
|
||||
|
|
|
@ -16,7 +16,11 @@ export class SendCursorViewPlugin implements PluginValue {
|
|||
private lastCursor: SelectionRange | undefined
|
||||
private listener?: Listener
|
||||
|
||||
constructor(private view: EditorView, private messageTransporter: MessageTransporter, private mayEdit: boolean) {
|
||||
constructor(
|
||||
private view: EditorView,
|
||||
private messageTransporter: MessageTransporter,
|
||||
private mayEdit: boolean
|
||||
) {
|
||||
if (mayEdit) {
|
||||
this.listener = messageTransporter.doAsSoonAsReady(() => {
|
||||
this.sendCursor(this.lastCursor)
|
||||
|
|
|
@ -40,10 +40,13 @@ export const useRealtimeConnection = (): MessageTransporter => {
|
|||
const socket = new WebSocket(websocketUrl.toString())
|
||||
socket.addEventListener('error', () => {
|
||||
const timeout = WEBSOCKET_RECONNECT_INTERVAL + reconnectCount.current * 1000 + Math.random() * 1000
|
||||
setTimeout(() => {
|
||||
setTimeout(
|
||||
() => {
|
||||
reconnectCount.current += 1
|
||||
establishWebsocketConnection()
|
||||
}, Math.max(timeout, WEBSOCKET_RECONNECT_MAX_DURATION))
|
||||
},
|
||||
Math.max(timeout, WEBSOCKET_RECONNECT_MAX_DURATION)
|
||||
)
|
||||
})
|
||||
socket.addEventListener('open', () => {
|
||||
messageTransporter.setAdapter(new FrontendWebsocketAdapter(socket))
|
||||
|
|
|
@ -17,7 +17,10 @@ export interface CodeProps {
|
|||
* Checks if the given checked node is a code block with a specific language attribute and creates an react-element that receives the code.
|
||||
*/
|
||||
export class CodeBlockComponentReplacer extends ComponentReplacer {
|
||||
constructor(private component: FunctionComponent<CodeProps>, private language: string) {
|
||||
constructor(
|
||||
private component: FunctionComponent<CodeProps>,
|
||||
private language: string
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,10 @@ export interface IdProps {
|
|||
* Replaces custom tags that have just an id (<app-something id="something"/>) with react elements.
|
||||
*/
|
||||
export class CustomTagWithIdComponentReplacer extends ComponentReplacer {
|
||||
constructor(private component: FunctionComponent<IdProps>, private tagName: string) {
|
||||
constructor(
|
||||
private component: FunctionComponent<IdProps>,
|
||||
private tagName: string
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,10 @@ export abstract class WindowPostMessageCommunicator<
|
|||
private readonly log: Logger
|
||||
private readonly boundListener: (event: MessageEvent) => void
|
||||
|
||||
public constructor(private readonly uuid: string, private readonly targetOrigin: string) {
|
||||
public constructor(
|
||||
private readonly uuid: string,
|
||||
private readonly targetOrigin: string
|
||||
) {
|
||||
this.boundListener = this.handleEvent.bind(this)
|
||||
this.communicationEnabled = false
|
||||
this.log = this.createLogger()
|
||||
|
|
|
@ -26,7 +26,10 @@ export interface QuoteExtraTagValues {
|
|||
export class BlockquoteExtraTagMarkdownItPlugin {
|
||||
private static readonly BlockquoteExtraTagRuleName = 'blockquote_extra_tag'
|
||||
|
||||
constructor(private tagName: string, private icon: BootstrapIconName) {}
|
||||
constructor(
|
||||
private tagName: string,
|
||||
private icon: BootstrapIconName
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Registers an inline rule that detects blockquote extra tags and replaces them with blockquote tokens.
|
||||
|
|
|
@ -13,7 +13,7 @@ jest.mock(
|
|||
({
|
||||
...jest.requireActual('@hedgedoc/commons'),
|
||||
generateNoteTitle: () => 'generated title'
|
||||
} as Record<string, unknown>)
|
||||
}) as Record<string, unknown>
|
||||
)
|
||||
|
||||
describe('build state from first heading update', () => {
|
||||
|
|
Loading…
Reference in a new issue