diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-04-04 08:46:54 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-04-04 08:46:54 +0900 |
| commit | d4a630902d8d250b67fcd0ce2b49240786b40368 (patch) | |
| tree | b87395691e52e3b86ce40196993d492c694c5e79 /src/remote/activitypub | |
| parent | enhance(server): Log error message when internal error occured (diff) | |
| download | sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.tar.gz sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.tar.bz2 sharkey-d4a630902d8d250b67fcd0ce2b49240786b40368.zip | |
refactor: Use ===
Diffstat (limited to 'src/remote/activitypub')
| -rw-r--r-- | src/remote/activitypub/kernel/accept/follow.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/kernel/follow.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/kernel/reject/follow.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/kernel/undo/block.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/kernel/undo/follow.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/models/note.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/models/person.ts | 4 | ||||
| -rw-r--r-- | src/remote/activitypub/models/question.ts | 2 | ||||
| -rw-r--r-- | src/remote/activitypub/renderer/announce.ts | 4 | ||||
| -rw-r--r-- | src/remote/activitypub/renderer/note.ts | 6 |
10 files changed, 14 insertions, 14 deletions
diff --git a/src/remote/activitypub/kernel/accept/follow.ts b/src/remote/activitypub/kernel/accept/follow.ts index 377b8dac42..cf6763186e 100644 --- a/src/remote/activitypub/kernel/accept/follow.ts +++ b/src/remote/activitypub/kernel/accept/follow.ts @@ -5,7 +5,7 @@ import { IFollow } from '../../type'; import { Users } from '../../../../models'; export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => { - const id = typeof activity.actor == 'string' ? activity.actor : activity.actor.id; + const id = typeof activity.actor === 'string' ? activity.actor : activity.actor.id; if (id == null) throw new Error('missing id'); if (!id.startsWith(config.url + '/')) { diff --git a/src/remote/activitypub/kernel/follow.ts b/src/remote/activitypub/kernel/follow.ts index c255067bfd..fca6d26ccc 100644 --- a/src/remote/activitypub/kernel/follow.ts +++ b/src/remote/activitypub/kernel/follow.ts @@ -5,7 +5,7 @@ import { IFollow } from '../type'; import { Users } from '../../../models'; export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => { - const id = typeof activity.object == 'string' ? activity.object : activity.object.id; + const id = typeof activity.object === 'string' ? activity.object : activity.object.id; if (id == null) throw new Error('missing id'); if (!id.startsWith(config.url + '/')) { diff --git a/src/remote/activitypub/kernel/reject/follow.ts b/src/remote/activitypub/kernel/reject/follow.ts index d8b5a4b9b9..bc7d03f9a9 100644 --- a/src/remote/activitypub/kernel/reject/follow.ts +++ b/src/remote/activitypub/kernel/reject/follow.ts @@ -5,7 +5,7 @@ import { IFollow } from '../../type'; import { Users } from '../../../../models'; export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => { - const id = typeof activity.actor == 'string' ? activity.actor : activity.actor.id; + const id = typeof activity.actor === 'string' ? activity.actor : activity.actor.id; if (id == null) throw new Error('missing id'); if (!id.startsWith(config.url + '/')) { diff --git a/src/remote/activitypub/kernel/undo/block.ts b/src/remote/activitypub/kernel/undo/block.ts index 8ef70a9bef..17eab0d2d0 100644 --- a/src/remote/activitypub/kernel/undo/block.ts +++ b/src/remote/activitypub/kernel/undo/block.ts @@ -8,7 +8,7 @@ import { Users } from '../../../../models'; const logger = apLogger; export default async (actor: IRemoteUser, activity: IBlock): Promise<void> => { - const id = typeof activity.object == 'string' ? activity.object : activity.object.id; + const id = typeof activity.object === 'string' ? activity.object : activity.object.id; if (id == null) throw new Error('missing id'); const uri = activity.id || activity; diff --git a/src/remote/activitypub/kernel/undo/follow.ts b/src/remote/activitypub/kernel/undo/follow.ts index d75f055640..2a42f83907 100644 --- a/src/remote/activitypub/kernel/undo/follow.ts +++ b/src/remote/activitypub/kernel/undo/follow.ts @@ -6,7 +6,7 @@ import { IRemoteUser } from '../../../../models/entities/user'; import { Users, FollowRequests, Followings } from '../../../../models'; export default async (actor: IRemoteUser, activity: IFollow): Promise<void> => { - const id = typeof activity.object == 'string' ? activity.object : activity.object.id; + const id = typeof activity.object === 'string' ? activity.object : activity.object.id; if (id == null) throw new Error('missing id'); if (!id.startsWith(config.url + '/')) { diff --git a/src/remote/activitypub/models/note.ts b/src/remote/activitypub/models/note.ts index 1e633704d4..a149660ccb 100644 --- a/src/remote/activitypub/models/note.ts +++ b/src/remote/activitypub/models/note.ts @@ -293,7 +293,7 @@ export async function createNote(value: string | IObject, resolver?: Resolver, s * リモートサーバーからフェッチしてMisskeyに登録しそれを返します。 */ export async function resolveNote(value: string | IObject, resolver?: Resolver): Promise<Note | null> { - const uri = typeof value == 'string' ? value : value.id; + const uri = typeof value === 'string' ? value : value.id; if (uri == null) throw new Error('missing uri'); // ブロックしてたら中断 diff --git a/src/remote/activitypub/models/person.ts b/src/remote/activitypub/models/person.ts index 5936cee32c..80ba6b514a 100644 --- a/src/remote/activitypub/models/person.ts +++ b/src/remote/activitypub/models/person.ts @@ -136,7 +136,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us const tags = extractApHashtags(person.tag).map(tag => tag.toLowerCase()).splice(0, 32); - const isBot = object.type == 'Service'; + const isBot = object.type === 'Service'; // Create user let user: IRemoteUser; @@ -327,7 +327,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint emojis: emojiNames, name: person.name, tags, - isBot: object.type == 'Service', + isBot: object.type === 'Service', isCat: (person as any).isCat === true, isLocked: !!person.manuallyApprovesFollowers, } as Partial<User>; diff --git a/src/remote/activitypub/models/question.ts b/src/remote/activitypub/models/question.ts index 5c889db431..6b6749894a 100644 --- a/src/remote/activitypub/models/question.ts +++ b/src/remote/activitypub/models/question.ts @@ -41,7 +41,7 @@ export async function extractPollFromQuestion(source: string | IObject, resolver * @returns true if updated */ export async function updateQuestion(value: any) { - const uri = typeof value == 'string' ? value : value.id; + const uri = typeof value === 'string' ? value : value.id; // URIがこのサーバーを指しているならスキップ if (uri.startsWith(config.url + '/')) throw new Error('uri points local'); diff --git a/src/remote/activitypub/renderer/announce.ts b/src/remote/activitypub/renderer/announce.ts index 11e7be449b..d82bf6a693 100644 --- a/src/remote/activitypub/renderer/announce.ts +++ b/src/remote/activitypub/renderer/announce.ts @@ -7,10 +7,10 @@ export default (object: any, note: Note) => { let to: string[] = []; let cc: string[] = []; - if (note.visibility == 'public') { + if (note.visibility === 'public') { to = ['https://www.w3.org/ns/activitystreams#Public']; cc = [`${attributedTo}/followers`]; - } else if (note.visibility == 'home') { + } else if (note.visibility === 'home') { to = [`${attributedTo}/followers`]; cc = ['https://www.w3.org/ns/activitystreams#Public']; } else { diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts index f9912b0ddc..5b00f82958 100644 --- a/src/remote/activitypub/renderer/note.ts +++ b/src/remote/activitypub/renderer/note.ts @@ -63,13 +63,13 @@ export default async function renderNote(note: Note, dive = true, isTalk = false let to: string[] = []; let cc: string[] = []; - if (note.visibility == 'public') { + if (note.visibility === 'public') { to = ['https://www.w3.org/ns/activitystreams#Public']; cc = [`${attributedTo}/followers`].concat(mentions); - } else if (note.visibility == 'home') { + } else if (note.visibility === 'home') { to = [`${attributedTo}/followers`]; cc = ['https://www.w3.org/ns/activitystreams#Public'].concat(mentions); - } else if (note.visibility == 'followers') { + } else if (note.visibility === 'followers') { to = [`${attributedTo}/followers`]; cc = mentions; } else { |