mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-23 02:17:40 -07:00
Refactor
This commit is contained in:
parent
7da5dc23d7
commit
59ba7e2b34
5 changed files with 10 additions and 30 deletions
|
@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: IAccept): Promise<void> => {
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
||||||
let object;
|
const object = await resolver.resolve(activity.object).catch(e => {
|
||||||
|
|
||||||
try {
|
|
||||||
object = await resolver.resolve(activity.object);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(`Resolution failed: ${e}`);
|
logger.error(`Resolution failed: ${e}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
});
|
||||||
|
|
||||||
switch (object.type) {
|
switch (object.type) {
|
||||||
case 'Follow':
|
case 'Follow':
|
||||||
|
|
|
@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: IAnnounce): Promise<void> =>
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
||||||
let object;
|
const object = await resolver.resolve(activity.object).catch(e => {
|
||||||
|
|
||||||
try {
|
|
||||||
object = await resolver.resolve(activity.object);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(`Resolution failed: ${e}`);
|
logger.error(`Resolution failed: ${e}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
});
|
||||||
|
|
||||||
if (validPost.includes(object.type)) {
|
if (validPost.includes(object.type)) {
|
||||||
announceNote(resolver, actor, activity, object);
|
announceNote(resolver, actor, activity, object);
|
||||||
|
|
|
@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: ICreate): Promise<void> => {
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
||||||
let object;
|
const object = await resolver.resolve(activity.object).catch(e => {
|
||||||
|
|
||||||
try {
|
|
||||||
object = await resolver.resolve(activity.object);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(`Resolution failed: ${e}`);
|
logger.error(`Resolution failed: ${e}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
});
|
||||||
|
|
||||||
if (validPost.includes(object.type)) {
|
if (validPost.includes(object.type)) {
|
||||||
createNote(resolver, actor, object);
|
createNote(resolver, actor, object);
|
||||||
|
|
|
@ -13,14 +13,10 @@ export default async (actor: IRemoteUser, activity: IReject): Promise<void> => {
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
||||||
let object;
|
const object = await resolver.resolve(activity.object).catch(e => {
|
||||||
|
|
||||||
try {
|
|
||||||
object = await resolver.resolve(activity.object);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(`Resolution failed: ${e}`);
|
logger.error(`Resolution failed: ${e}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
});
|
||||||
|
|
||||||
switch (object.type) {
|
switch (object.type) {
|
||||||
case 'Follow':
|
case 'Follow':
|
||||||
|
|
|
@ -20,14 +20,10 @@ export default async (actor: IRemoteUser, activity: IUndo): Promise<void> => {
|
||||||
|
|
||||||
const resolver = new Resolver();
|
const resolver = new Resolver();
|
||||||
|
|
||||||
let object;
|
const object = await resolver.resolve(activity.object).catch(e => {
|
||||||
|
|
||||||
try {
|
|
||||||
object = await resolver.resolve(activity.object);
|
|
||||||
} catch (e) {
|
|
||||||
logger.error(`Resolution failed: ${e}`);
|
logger.error(`Resolution failed: ${e}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
});
|
||||||
|
|
||||||
switch (object.type) {
|
switch (object.type) {
|
||||||
case 'Follow':
|
case 'Follow':
|
||||||
|
|
Loading…
Reference in a new issue