From 099b86ff3c5f63c0471bcd5e5624bbbcd27ab2f9 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Sun, 1 Oct 2023 02:06:04 +0200 Subject: [PATCH] chore: lint --- packages/backend/src/core/MfmService.ts | 7 ------- .../src/server/api/mastodon/MastodonApiServerService.ts | 8 ++++---- packages/backend/src/server/api/mastodon/converters.ts | 4 ++-- packages/frontend/src/components/MkNoteSub.vue | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index 19e228810..b275d1b14 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -339,13 +339,6 @@ export class MfmService { mention: (node) => { const a = doc.createElement('a'); const { username, host, acct } = node.props; -/* if (mastodon) { - const splitacct = acct.split("@"); - a.setAttribute('href', splitacct[2] !== this.config.host && splitacct[2] !== undefined ? `https://${splitacct[2]}/@${splitacct[1]}` : `https://${this.config.host}/${acct}`); - a.className = 'u-url mention'; - a.textContent = acct; - return a; - } */ const remoteUserInfo = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host); a.setAttribute('href', remoteUserInfo ? (remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri) : `${this.config.url}/${acct}`); a.className = 'u-url mention'; diff --git a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts index 2653bbdbd..b0b5147a4 100644 --- a/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts +++ b/packages/backend/src/server/api/mastodon/MastodonApiServerService.ts @@ -263,8 +263,8 @@ export class MastodonApiServerService { // displayed without being logged in try { const data = await client.search((_request.query as any).acct, { type: 'accounts' }); - const profile = await this.userProfilesRepository.findOneBy({userId: data.data.accounts[0].id}); - data.data.accounts[0].fields = profile?.fields.map(f => ({...f, verified_at: null})) || []; + const profile = await this.userProfilesRepository.findOneBy({ userId: data.data.accounts[0].id }); + data.data.accounts[0].fields = profile?.fields.map(f => ({ ...f, verified_at: null })) || []; reply.send(convertAccount(data.data.accounts[0])); } catch (e: any) { /* console.error(e); */ @@ -302,8 +302,8 @@ export class MastodonApiServerService { try { const sharkId = convertId(_request.params.id, IdType.SharkeyId); const data = await client.getAccount(sharkId); - const profile = await this.userProfilesRepository.findOneBy({userId: sharkId}); - data.data.fields = profile?.fields.map(f => ({...f, verified_at: null})) || []; + const profile = await this.userProfilesRepository.findOneBy({ userId: sharkId }); + data.data.fields = profile?.fields.map(f => ({ ...f, verified_at: null })) || []; reply.send(convertAccount(data.data)); } catch (e: any) { /* console.error(e); diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts index 4f4524736..69b0ad93f 100644 --- a/packages/backend/src/server/api/mastodon/converters.ts +++ b/packages/backend/src/server/api/mastodon/converters.ts @@ -67,7 +67,7 @@ export class MastoConverters { public async getUser(id: string): Promise { return this.GetterService.getUser(id).then(p => { return p; - }) + }); } public async convertStatus(status: Entity.Status) { @@ -94,7 +94,7 @@ export class MastoConverters { id: convertId(mention.id, IdConvertType.MastodonId), })); const convertedMFM = this.MfmService.toHtml(parse(status.content), JSON.parse(note.mentionedRemoteUsers)); - status.content = status.content ? convertedMFM?.replace(/&/g , "&").replaceAll(`&` , "\'")! : status.content; + status.content = status.content ? convertedMFM?.replace(/&/g, "&").replaceAll(`&`, "\'") as string : status.content; if (status.poll) status.poll = convertPoll(status.poll); if (status.reblog) status.reblog = convertStatus(status.reblog); diff --git a/packages/frontend/src/components/MkNoteSub.vue b/packages/frontend/src/components/MkNoteSub.vue index 36e7c694c..a5213e1cc 100644 --- a/packages/frontend/src/components/MkNoteSub.vue +++ b/packages/frontend/src/components/MkNoteSub.vue @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only -->