Compare commits
No commits in common. "7bcd793afd7fa7ae05f3cb97deb1c071027b997c" and "ba96c3b5f4eb844395294d814543dbf88f5ce1ec" have entirely different histories.
7bcd793afd
...
ba96c3b5f4
|
@ -26,7 +26,7 @@ export default async (actor: CacheableRemoteUser, activity: IUpdate): Promise<st
|
|||
await updatePerson(actor.uri!, resolver, object);
|
||||
return `ok: Person updated`;
|
||||
} else if (getApType(object) === 'Question') {
|
||||
await updateQuestion(object, resolver).catch(e => console.log(e));
|
||||
await updateQuestion(object).catch(e => console.log(e));
|
||||
return `ok: Question updated`;
|
||||
} else {
|
||||
return `skip: Unknown type: ${getApType(object)}`;
|
||||
|
|
|
@ -271,7 +271,7 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
|||
});
|
||||
//#endregion
|
||||
|
||||
await updateFeatured(user!.id, resolver).catch(err => logger.error(err));
|
||||
await updateFeatured(user!.id).catch(err => logger.error(err));
|
||||
|
||||
return user!;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
followerSharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
||||
});
|
||||
|
||||
await updateFeatured(exist.id, resolver).catch(err => logger.error(err));
|
||||
await updateFeatured(exist.id).catch(err => logger.error(err));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,14 +462,14 @@ export function analyzeAttachments(attachments: IObject | IObject[] | undefined)
|
|||
return { fields, services };
|
||||
}
|
||||
|
||||
export async function updateFeatured(userId: User['id'], resolver?: Resolver) {
|
||||
export async function updateFeatured(userId: User['id']) {
|
||||
const user = await Users.findOneByOrFail({ id: userId });
|
||||
if (!Users.isRemoteUser(user)) return;
|
||||
if (!user.featured) return;
|
||||
|
||||
logger.info(`Updating the featured: ${user.uri}`);
|
||||
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
const resolver = new Resolver();
|
||||
|
||||
// Resolve to (Ordered)Collection Object
|
||||
const collection = await resolver.resolveCollection(user.featured);
|
||||
|
|
|
@ -40,7 +40,7 @@ export async function extractPollFromQuestion(source: string | IObject, resolver
|
|||
* @param uri URI of AP Question object
|
||||
* @returns true if updated
|
||||
*/
|
||||
export async function updateQuestion(value: any, resolver?: Resolver) {
|
||||
export async function updateQuestion(value: any) {
|
||||
const uri = typeof value === 'string' ? value : value.id;
|
||||
|
||||
// URIがこのサーバーを指しているならスキップ
|
||||
|
@ -55,7 +55,7 @@ export async function updateQuestion(value: any, resolver?: Resolver) {
|
|||
//#endregion
|
||||
|
||||
// resolve new Question object
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
const resolver = new Resolver();
|
||||
const question = await resolver.resolve(value) as IQuestion;
|
||||
apLogger.debug(`fetched question: ${JSON.stringify(question, null, 2)}`);
|
||||
|
||||
|
|
|
@ -19,11 +19,9 @@ import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
|||
export default class Resolver {
|
||||
private history: Set<string>;
|
||||
private user?: ILocalUser;
|
||||
private recursionLimit?: number;
|
||||
|
||||
constructor(recursionLimit = 100) {
|
||||
constructor() {
|
||||
this.history = new Set();
|
||||
this.recursionLimit = recursionLimit;
|
||||
}
|
||||
|
||||
public getHistory(): string[] {
|
||||
|
@ -61,9 +59,7 @@ export default class Resolver {
|
|||
if (this.history.has(value)) {
|
||||
throw new Error('cannot resolve already resolved one');
|
||||
}
|
||||
if (this.recursionLimit && this.history.size > this.recursionLimit) {
|
||||
throw new Error('hit recursion limit');
|
||||
}
|
||||
|
||||
this.history.add(value);
|
||||
|
||||
const host = extractDbHost(value);
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
</button>
|
||||
</div>
|
||||
<div class="right">
|
||||
<MkA v-tooltip="$ts.favorites" class="item" to="/my/favorites"><i class="fas fa-star icon"></i></MkA>
|
||||
<MkA v-tooltip="$ts.messaging" class="item" to="/my/messaging"><i class="fas fa-comments icon"></i><span v-if="$i?.hasUnreadMessagingMessage" class="indicator"><i class="fas fa-circle"></i></span></MkA>
|
||||
<MkA v-tooltip="$ts.notifications" class="item" to="/my/notifications"><i class="fas fa-bell icon"></i><span v-if="$i?.hasUnreadNotification" class="indicator"><i class="fas fa-circle"></i></span></MkA>
|
||||
<MkA v-tooltip="$ts.favorites" class="item" to="/my/favorites"><i class="fas fa-star icon"></i><span v-if="$i.hasUnreadMessagingMessage" class="indicator"><i class="fas fa-circle"></i></span></MkA>
|
||||
<MkA v-tooltip="$ts.messaging" class="item" to="/my/messaging"><i class="fas fa-comments icon"></i><span v-if="$i.hasUnreadMessagingMessage" class="indicator"><i class="fas fa-circle"></i></span></MkA>
|
||||
<MkA v-tooltip="$ts.notifications" class="item" to="/my/notifications"><i class="fas fa-bell icon"></i><span v-if="$i.hasUnreadNotification" class="indicator"><i class="fas fa-circle"></i></span></MkA>
|
||||
</div>
|
||||
</header>
|
||||
<div class="body">
|
||||
|
|
Loading…
Reference in New Issue