forked from FoundKeyGang/FoundKey
server: use named export for deleteNote
This commit is contained in:
parent
1bce487965
commit
e52cf25489
5 changed files with 7 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
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 { getApLock } from '@/misc/app-lock.js';
|
||||||
import { deleteMessage } from '@/services/messages/delete.js';
|
import { deleteMessage } from '@/services/messages/delete.js';
|
||||||
import { DbResolver } from '@/remote/activitypub/db-resolver.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';
|
return 'skip: cant delete other actors note';
|
||||||
}
|
}
|
||||||
|
|
||||||
await deleteNode(actor, note);
|
await deleteNote(actor, note);
|
||||||
return 'ok: note deleted';
|
return 'ok: note deleted';
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Notes } from '@/models/index.js';
|
import { Notes } from '@/models/index.js';
|
||||||
import { CacheableRemoteUser } from '@/models/entities/user.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';
|
import { IAnnounce, getApId } from '@/remote/activitypub/type.js';
|
||||||
|
|
||||||
export const undoAnnounce = async (actor: CacheableRemoteUser, activity: IAnnounce): Promise<string> => {
|
export const undoAnnounce = async (actor: CacheableRemoteUser, activity: IAnnounce): Promise<string> => {
|
||||||
|
|
|
@ -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 { Users } from '@/models/index.js';
|
||||||
import { SECOND, HOUR } from '@/const.js';
|
import { SECOND, HOUR } from '@/const.js';
|
||||||
import define from '@/server/api/define.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');
|
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);
|
await deleteNote(await Users.findOneByOrFail({ id: note.userId }), note);
|
||||||
});
|
});
|
||||||
|
|
|
@ -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 { Notes, Users } from '@/models/index.js';
|
||||||
import { SECOND, HOUR } from '@/const.js';
|
import { SECOND, HOUR } from '@/const.js';
|
||||||
import define from '@/server/api/define.js';
|
import define from '@/server/api/define.js';
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { deliverToRelays } from '../relay.js';
|
||||||
* @param user author
|
* @param user author
|
||||||
* @param note note to be deleted
|
* @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();
|
const deletedAt = new Date();
|
||||||
|
|
||||||
// If this is the only renote of this note by this user
|
// If this is the only renote of this note by this user
|
||||||
|
|
Loading…
Reference in a new issue