fix: align activity badge and person profile with prior lens

Count nav badge for desk=mine, always apply activity prior filter on person records, and stop loading prior=all deals on profiles.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-17 18:56:44 +03:30
co-authored by Cursor
parent 0ce2533066
commit 3fb5f32ac3
4 changed files with 72 additions and 66 deletions
+12 -5
View File
@@ -118,9 +118,19 @@ export class ActivitiesService {
async summary(
organizationId: string,
actor: ActivityActor,
desk?: 'mine' | 'team',
): Promise<ActivitySummaryDto> {
const { start, end } = dayBounds();
const scope = activityAccessWhere(actor);
const scope: Prisma.ActivityWhereInput =
desk === 'mine'
? {
OR: [
{ assigneeId: actor.userId },
{ assignees: { some: { id: actor.userId } } },
{ participantIds: { has: actor.userId } },
],
}
: activityAccessWhere(actor);
const prior = activityPriorWhere(actor.priorLens, actor.priorCutoff);
const [todayCount, overdueCount] = await Promise.all([
this.prisma.activity.count({
@@ -733,10 +743,7 @@ export class ActivitiesService {
...this.types.searchByName(typeRows, t),
]);
if (search) andParts.push(search);
const onRecord = Boolean(entity?.personId || entity?.companyId || entity?.dealId);
if (!onRecord) {
andParts.push(activityPriorWhere(actor.priorLens, actor.priorCutoff));
}
andParts.push(activityPriorWhere(actor.priorLens, actor.priorCutoff));
const base: Prisma.ActivityWhereInput = {
organizationId,
AND: andParts,