diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-02-03 02:41:22 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-02-03 02:41:22 +0900 |
| commit | 435945d09d9f6113ae299225c4561ae47e4c7576 (patch) | |
| tree | 21f52077c318a44b1e2d64f3b990ab5c64b3b7f6 /packages/backend/src/services/note/create.ts | |
| parent | :art: (diff) | |
| download | misskey-435945d09d9f6113ae299225c4561ae47e4c7576.tar.gz misskey-435945d09d9f6113ae299225c4561ae47e4c7576.tar.bz2 misskey-435945d09d9f6113ae299225c4561ae47e4c7576.zip | |
refactor
Diffstat (limited to 'packages/backend/src/services/note/create.ts')
| -rw-r--r-- | packages/backend/src/services/note/create.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/backend/src/services/note/create.ts b/packages/backend/src/services/note/create.ts index fb22bd6593..cfb1f8c1e5 100644 --- a/packages/backend/src/services/note/create.ts +++ b/packages/backend/src/services/note/create.ts @@ -59,7 +59,7 @@ class NotificationManager { if (exist) { // 「メンションされているかつ返信されている」場合は、メンションとしての通知ではなく返信としての通知にする - if (reason != 'mention') { + if (reason !== 'mention') { exist.reason = reason; } } else { @@ -201,7 +201,7 @@ export default async (user: { id: User['id']; username: User['username']; host: mentionedUsers.push(await Users.findOneOrFail(data.reply.userId)); } - if (data.visibility == 'specified') { + if (data.visibility === 'specified') { if (data.visibleUsers == null) throw new Error('invalid param'); for (const u of data.visibleUsers) { @@ -301,7 +301,7 @@ export default async (user: { id: User['id']; username: User['username']; host: if (Users.isRemoteUser(user)) activeUsersChart.update(user); // 未読通知を作成 - if (data.visibility == 'specified') { + if (data.visibility === 'specified') { if (data.visibleUsers == null) throw new Error('invalid param'); for (const u of data.visibleUsers) { @@ -439,7 +439,7 @@ export default async (user: { id: User['id']; username: User['username']; host: async function renderNoteOrRenoteActivity(data: Option, note: Note) { if (data.localOnly) return null; - const content = data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length == 0) + const content = data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length === 0) ? renderAnnounce(data.renote.uri ? data.renote.uri : `${config.url}/notes/${data.renote.id}`, note) : renderCreate(await renderNote(note, false), note); @@ -478,7 +478,7 @@ async function insertNote(user: { id: User['id']; host: User['host']; }, data: O userId: user.id, localOnly: data.localOnly!, visibility: data.visibility as any, - visibleUserIds: data.visibility == 'specified' + visibleUserIds: data.visibility === 'specified' ? data.visibleUsers ? data.visibleUsers.map(u => u.id) : [] @@ -502,7 +502,7 @@ async function insertNote(user: { id: User['id']; host: User['host']; }, data: O insert.mentions = mentionedUsers.map(u => u.id); const profiles = await UserProfiles.find({ userId: In(insert.mentions) }); insert.mentionedRemoteUsers = JSON.stringify(mentionedUsers.filter(u => Users.isRemoteUser(u)).map(u => { - const profile = profiles.find(p => p.userId == u.id); + const profile = profiles.find(p => p.userId === u.id); const url = profile != null ? profile.url : null; return { uri: u.uri, |