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:
@@ -57,8 +57,12 @@ export class ActivitiesController {
|
||||
) {}
|
||||
|
||||
@Get('summary')
|
||||
summary(@CurrentUser() user: Actor) {
|
||||
return this.activitiesService.summary(user.organizationId, user);
|
||||
summary(
|
||||
@CurrentUser() user: Actor,
|
||||
@Query('desk') desk?: string,
|
||||
) {
|
||||
const scope = desk === 'mine' || desk === 'team' ? desk : undefined;
|
||||
return this.activitiesService.summary(user.organizationId, user, scope);
|
||||
}
|
||||
|
||||
@Get('stages')
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user