server: use named export for deleteNote

This commit is contained in:
Johann150 2023-03-11 09:54:46 +01:00
parent 1bce487965
commit e52cf25489
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
5 changed files with 7 additions and 7 deletions

View file

@ -1,5 +1,5 @@
import { CacheableRemoteUser } from '@/models/entities/user.js';
import deleteNode from '@/services/note/delete.js';
import { deleteNote } from '@/services/note/delete.js';
import { getApLock } from '@/misc/app-lock.js';
import { deleteMessage } from '@/services/messages/delete.js';
import { DbResolver } from '@/remote/activitypub/db-resolver.js';
@ -29,7 +29,7 @@ export default async function(actor: CacheableRemoteUser, uri: string): Promise<
return 'skip: cant delete other actors note';
}
await deleteNode(actor, note);
await deleteNote(actor, note);
return 'ok: note deleted';
}
} finally {

View file

@ -1,6 +1,6 @@
import { Notes } from '@/models/index.js';
import { CacheableRemoteUser } from '@/models/entities/user.js';
import deleteNote from '@/services/note/delete.js';
import { deleteNote } from '@/services/note/delete.js';
import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
export const undoAnnounce = async (actor: CacheableRemoteUser, activity: IAnnounce): Promise<string> => {

View file

@ -1,4 +1,4 @@
import deleteNote from '@/services/note/delete.js';
import { deleteNote } from '@/services/note/delete.js';
import { Users } from '@/models/index.js';
import { SECOND, HOUR } from '@/const.js';
import define from '@/server/api/define.js';
@ -47,6 +47,6 @@ export default define(meta, paramDef, async (ps, user) => {
throw new ApiError('ACCESS_DENIED');
}
// この操作を行うのが投稿者とは限らない(例えばモデレーター)ため
// Fetch the note owner, since the current user may be an admin or moderator.
await deleteNote(await Users.findOneByOrFail({ id: note.userId }), note);
});

View file

@ -1,4 +1,4 @@
import deleteNote from '@/services/note/delete.js';
import { deleteNote } from '@/services/note/delete.js';
import { Notes, Users } from '@/models/index.js';
import { SECOND, HOUR } from '@/const.js';
import define from '@/server/api/define.js';

View file

@ -21,7 +21,7 @@ import { deliverToRelays } from '../relay.js';
* @param user author
* @param note note to be deleted
*/
export default async function(user: { id: User['id']; uri: User['uri']; host: User['host']; }, note: Note, quiet = false): Promise<void> {
export async function deleteNote(user: { id: User['id']; uri: User['uri']; host: User['host']; }, note: Note, quiet = false): Promise<void> {
const deletedAt = new Date();
// If this is the only renote of this note by this user