Skip to content

feat: add presences read and write scopes to API keys#3050

Open
ArnabChatterjee20k wants to merge 1 commit into
mainfrom
presences-api
Open

feat: add presences read and write scopes to API keys#3050
ArnabChatterjee20k wants to merge 1 commit into
mainfrom
presences-api

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR adds presences.read and presences.write to the API key scope definitions and updates the scopes component to fall back to locally-defined categories when the API returns a scope without one.

  • Adds two new entries to constants.ts under a new 'Presences' category with the user-group icon.
  • In scopes.svelte, builds a localByScope lookup map and uses fallback?.category to fill in the category when the API response omits it, ensuring presences scopes group correctly even before the server fully propagates the category field.

Confidence Score: 4/5

Safe to merge; changes are additive and isolated to the scope-selection UI.

Both changes are straightforward and additive. The constants addition is correct. The fallback logic in the component handles the case where the API omits a category, but the same fallback is not applied to the icon field despite one being available locally — a minor inconsistency with no immediate visible impact since icons are not rendered in this component's template.

No files require special attention.

Important Files Changed

Filename Overview
src/lib/constants.ts Adds presences.read and presences.write scope definitions with category 'Presences' and icon 'user-group', inserted between the Messaging and Other groups.
src/routes/(console)/project-[region]-[project]/overview/api-keys/scopes.svelte Adds a local-scope fallback map so that when the API returns a scope without a category, the locally defined category is used instead; icon fallback is not applied consistently.

Reviews (1): Last reviewed commit: "feat: add presences read and write scope..." | Re-trigger Greptile

Comment on lines 127 to 133
scopesById.set(scope.$id, {
scope: scope.$id,
description: scope.description,
category: normalizeCategory(scope.category),
category: normalizeCategory(scope.category || fallback?.category || ''),
deprecated: scope.deprecated,
icon: ''
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The fallback applies category from the local scope definition when the API omits it, but icon is still hardcoded to '' even though fallback?.icon is available. This creates an inconsistency: if the API returns a presences scope without its category, the grouping recovers correctly, but the icon stays blank rather than using the locally defined 'user-group' value.

Suggested change
scopesById.set(scope.$id, {
scope: scope.$id,
description: scope.description,
category: normalizeCategory(scope.category),
category: normalizeCategory(scope.category || fallback?.category || ''),
deprecated: scope.deprecated,
icon: ''
});
scopesById.set(scope.$id, {
scope: scope.$id,
description: scope.description,
category: normalizeCategory(scope.category || fallback?.category || ''),
deprecated: scope.deprecated,
icon: fallback?.icon ?? ''
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant