Skip to content

feat(graph): expose the favorite state on drives and sharedWithMe - #4036

Merged
aduffeck merged 1 commit into
mainfrom
feat/graph-expose-favorites
Nov 18, 2026
Merged

aduffeck merged 1 commit into
mainfrom
feat/graph-expose-favorites

Conversation

@AlexAndBear

Copy link
Copy Markdown
Member

Description

Spaces and shares can already be marked as favorites, but the graph API did not report the favorite state for them. This adds @libre.graph.me.following to:

  • drive.root on the drive endpoints (/me/drives, /drives, /drives/{id}, v1.0 and v1beta1), including mountpoint drives
  • the driveItems returned by /v1beta1/me/drive/sharedWithMe

sharedByMe already returned the flag through cs3ResourceToDriveItem.

The root info of a space is built with only the quota metadata key, so the per-user favorite flag is not part of its arbitrary metadata. The new isFollowing helper therefore also checks the favorites opaque entry, which the storage driver adds to every resource info (the search service already relies on it for is:favorite). The flag is set only when the space has a root info.

Related Issue

Motivation and Context

The web app needs the favorite state on spaces and received shares to show and toggle it.

How Has This Been Tested?

  • Unit tests for drives (followed by the current user, followed only by others, flag in metadata, no root info) and for sharedWithMe. Both fail without the change.
  • Manually against a local instance built from this branch (demo users, basic auth, curl):
    • admin creates two project spaces with alan and mary as members, alan follows one of them via POST /graph/v1.0/me/drive/items/{id}/follow
    • /me/drives (v1.0 and v1beta1) and /drives/{id}: true for alan on the followed space, false on the other one; mary and admin get false on both
    • after DELETE /me/drive/following/{id} alan gets false again
    • mary shares a folder with alan and dennis, alan follows it: sharedWithMe and the mountpoint drive show true for alan and false for dennis; after mary follows it herself, her sharedByMe shows true

Found while testing, not changed here: following a received share by its share jail id (the id of the sharedWithMe driveItem) fails with 500 "could not add label", because the sharesstorageprovider does not implement AddLabel/RemoveLabel. Following by remoteItem.id works.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

Spaces and received shares can be marked as favorites, but the graph
API did not report it, so the web app could not show them.

drive.root and the sharedWithMe driveItems now carry
@libre.graph.me.following. The space root info only holds the requested
quota metadata, so the per-user flag is also read from the favorites
list the storage driver adds to the opaque.

Fixes #2511
@codacy-production

codacy-production Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity

Metric Results
Complexity 10

View in Codacy

🟢 Coverage 81.82% diff coverage · +0.02% coverage variation

Metric Results
Coverage variation ✅ +0.02% coverage variation (-1.00%)
Diff coverage ✅ 81.82% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (0ec0411) 94240 28196 29.92%
Head commit (d2b1ab3) 94263 (+23) 28219 (+23) 29.94% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4036) 22 18 81.82%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@AlexAndBear
AlexAndBear requested a review from aduffeck November 17, 2026 12:40

@aduffeck aduffeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, lgtm.

@aduffeck
aduffeck merged commit edacb0e into main Nov 18, 2026
63 checks passed
@aduffeck
aduffeck deleted the feat/graph-expose-favorites branch November 18, 2026 07:45
v-scharf added a commit to opencloud-eu/web that referenced this pull request Nov 20, 2026
…and shares

The e2e tests for favorite spaces and shares need the favorite state on
drives and shares from opencloud-eu/opencloud#4036.

Assisted-by: Claude Code:claude-opus-5-5
v-scharf added a commit to opencloud-eu/web that referenced this pull request Nov 23, 2026
…and shares

The e2e tests for favorite spaces and shares need the favorite state on
drives and shares from opencloud-eu/opencloud#4036.

Assisted-by: Claude Code:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Favorite property missing on drive endpoints in graph api

2 participants