refactor: Use ESM (#8358)
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
This commit is contained in:
parent
0a882471f3
commit
d071d18dd7
737 changed files with 4135 additions and 3678 deletions
|
|
@ -1,39 +1,39 @@
|
|||
import * as mfm from 'mfm-js';
|
||||
import es from '../../db/elasticsearch';
|
||||
import { publishMainStream, publishNotesStream } from '@/services/stream';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager';
|
||||
import renderNote from '@/remote/activitypub/renderer/note';
|
||||
import renderCreate from '@/remote/activitypub/renderer/create';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { resolveUser } from '@/remote/resolve-user';
|
||||
import config from '@/config/index';
|
||||
import { updateHashtags } from '../update-hashtag';
|
||||
import { concat } from '@/prelude/array';
|
||||
import { insertNoteUnread } from '@/services/note/unread';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import { extractMentions } from '@/misc/extract-mentions';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm';
|
||||
import { extractHashtags } from '@/misc/extract-hashtags';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note';
|
||||
import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings, NoteThreadMutings } from '@/models/index';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { App } from '@/models/entities/app';
|
||||
import es from '../../db/elasticsearch.js';
|
||||
import { publishMainStream, publishNotesStream } from '@/services/stream.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import renderNote from '@/remote/activitypub/renderer/note.js';
|
||||
import renderCreate from '@/remote/activitypub/renderer/create.js';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { resolveUser } from '@/remote/resolve-user.js';
|
||||
import config from '@/config/index.js';
|
||||
import { updateHashtags } from '../update-hashtag.js';
|
||||
import { concat } from '@/prelude/array.js';
|
||||
import { insertNoteUnread } from '@/services/note/unread.js';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||
import { extractMentions } from '@/misc/extract-mentions.js';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js';
|
||||
import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings, NoteThreadMutings } from '@/models/index.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { App } from '@/models/entities/app.js';
|
||||
import { Not, getConnection, In } from 'typeorm';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '@/services/chart/index';
|
||||
import { Poll, IPoll } from '@/models/entities/poll';
|
||||
import { createNotification } from '../create-notification';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna';
|
||||
import { checkWordMute } from '@/misc/check-word-mute';
|
||||
import { addNoteToAntenna } from '../add-note-to-antenna';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes';
|
||||
import { deliverToRelays } from '../relay';
|
||||
import { Channel } from '@/models/entities/channel';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search';
|
||||
import { getAntennas } from '@/misc/antenna-cache';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '@/services/chart/index.js';
|
||||
import { Poll, IPoll } from '@/models/entities/poll.js';
|
||||
import { createNotification } from '../create-notification.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna.js';
|
||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||
import { addNoteToAntenna } from '../add-note-to-antenna.js';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes.js';
|
||||
import { deliverToRelays } from '../relay.js';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||
|
||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
import { publishNoteStream } from '@/services/stream';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderTombstone from '@/remote/activitypub/renderer/tombstone';
|
||||
import config from '@/config/index';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note';
|
||||
import { Notes, Users, Instances } from '@/models/index';
|
||||
import { notesChart, perUserNotesChart, instanceChart } from '@/services/chart/index';
|
||||
import { deliverToFollowers, deliverToUser } from '@/remote/activitypub/deliver-manager';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes';
|
||||
import { deliverToRelays } from '../relay';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderTombstone from '@/remote/activitypub/renderer/tombstone.js';
|
||||
import config from '@/config/index.js';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js';
|
||||
import { Notes, Users, Instances } from '@/models/index.js';
|
||||
import { notesChart, perUserNotesChart, instanceChart } from '@/services/chart/index.js';
|
||||
import { deliverToFollowers, deliverToUser } from '@/remote/activitypub/deliver-manager.js';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes.js';
|
||||
import { deliverToRelays } from '../relay.js';
|
||||
import { Brackets, In } from 'typeorm';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import renderUpdate from '@/remote/activitypub/renderer/update';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderNote from '@/remote/activitypub/renderer/note';
|
||||
import { Users, Notes } from '@/models/index';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager';
|
||||
import { deliverToRelays } from '../../relay';
|
||||
import renderUpdate from '@/remote/activitypub/renderer/update.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderNote from '@/remote/activitypub/renderer/note.js';
|
||||
import { Users, Notes } from '@/models/index.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js';
|
||||
import { deliverToRelays } from '../../relay.js';
|
||||
|
||||
export async function deliverQuestionUpdate(noteId: Note['id']) {
|
||||
const note = await Notes.findOne(noteId);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { publishNoteStream } from '@/services/stream';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { PollVotes, NoteWatchings, Polls, Blockings } from '@/models/index';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { PollVotes, NoteWatchings, Polls, Blockings } from '@/models/index.js';
|
||||
import { Not } from 'typeorm';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createNotification } from '../../create-notification';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { createNotification } from '../../create-notification.js';
|
||||
|
||||
export default async function(user: User, note: Note, choice: number) {
|
||||
const poll = await Polls.findOne(note.id);
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
import { publishNoteStream } from '@/services/stream';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { toDbReaction, decodeReaction } from '@/misc/reaction-lib';
|
||||
import { User, IRemoteUser } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '@/models/index';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { toDbReaction, decodeReaction } from '@/misc/reaction-lib.js';
|
||||
import { User, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '@/models/index.js';
|
||||
import { Not } from 'typeorm';
|
||||
import { perUserReactionsChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createNotification } from '../../create-notification';
|
||||
import deleteReaction from './delete';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { perUserReactionsChart } from '@/services/chart/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { createNotification } from '../../create-notification.js';
|
||||
import deleteReaction from './delete.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
||||
export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => {
|
||||
// Check blocking
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { publishNoteStream } from '@/services/stream';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { User, IRemoteUser } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteReactions, Users, Notes } from '@/models/index';
|
||||
import { decodeReaction } from '@/misc/reaction-lib';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { User, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteReactions, Users, Notes } from '@/models/index.js';
|
||||
import { decodeReaction } from '@/misc/reaction-lib.js';
|
||||
|
||||
export default async (user: { id: User['id']; host: User['host']; }, note: Note) => {
|
||||
// if already unreacted
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { publishMainStream } from '@/services/stream';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '@/models/index';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '@/models/index.js';
|
||||
import { Not, IsNull, In } from 'typeorm';
|
||||
import { Channel } from '@/models/entities/channel';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna';
|
||||
import { getAntennas } from '@/misc/antenna-cache';
|
||||
import { readNotificationByQuery } from '@/server/api/common/read-notification';
|
||||
import { Packed } from '@/misc/schema';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna.js';
|
||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||
import { readNotificationByQuery } from '@/server/api/common/read-notification.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
/**
|
||||
* Mark notes as read
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { Note } from '@/models/entities/note';
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Mutings, NoteThreadMutings, NoteUnreads } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Mutings, NoteThreadMutings, NoteUnreads } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
|
||||
export async function insertNoteUnread(userId: User['id'], note: Note, params: {
|
||||
// NOTE: isSpecifiedがtrueならisMentionedは必ずfalse
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { User } from '@/models/entities/user';
|
||||
import { NoteWatchings } from '@/models/index';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { NoteWatchings } from '@/models/index.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
|
||||
export default async (me: User['id'], note: Note) => {
|
||||
await NoteWatchings.delete({
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteWatchings } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { NoteWatching } from '@/models/entities/note-watching';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteWatchings } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { NoteWatching } from '@/models/entities/note-watching.js';
|
||||
|
||||
export default async (me: User['id'], note: Note) => {
|
||||
// 自分の投稿はwatchできない
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue