Skip to content

Add functionality to support 3 dots menu - #320

Open
SharonStrats wants to merge 5 commits into
stagingfrom
feat/3-dots-menu
Open

Add functionality to support 3 dots menu#320
SharonStrats wants to merge 5 commits into
stagingfrom
feat/3-dots-menu

Conversation

@SharonStrats

@SharonStratsSharonStrats commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Create a resource service, the need was identified when moving the header from source pane into solid-panes and realizing the need for shared resource logic.

This consists of moving existing functions from solid-panes and source-pane into the resource service.
Some new functions were also created to accomodate the new functionality of the header for identifying if a user can delete a resource.

Some notes
The WAC specification was followed to identify whether a resource could be deleted by not only looking at the resource to see if it has write access, but as well looks at the containing container to also check if the user has write access to that as well. This is outlined in the specification.

To delete a resource additional functionality was added to give the option of deleting the resource from the type indexes. As well the original function was modified to delete the acl if it exists after the resource has been deleted. (The original was only deleted the acl when a container was deleted).

CopilotAI left a comment

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.

Pull request overview

This PR introduces a dedicated resource logic module to support resource/container operations needed by the UI (e.g., a “3 dots menu”), including recursive deletion and optional type-index cleanup, and wires it into SolidLogic.

Changes:

  • Added ResourceLogic (new src/resource/resourceLogic.ts) to centralize container helpers and recursive deletion (optionally deleting type index registrations).
  • Enhanced container detection and added a container member-count helper in containerLogic.
  • Extended type-index logic with deleteTypeIndexRegistrationForResource and exposed resource on SolidLogic.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/util/utilityLogic.tsRemoves recursiveDelete from utility logic (moved responsibility to resource).
src/util/containerLogic.tsImproves isContainer detection and adds getContainerMemberCount.
src/types.tsAdds ResourceLogic/options and extends TypeIndexLogic/SolidLogic types.
src/typeIndex/typeIndexLogic.tsAdds deletion of type-index registrations that reference a resource.
src/resource/resourceLogic.tsNew module implementing resource/container helpers and recursive deletion.
src/logic/solidLogic.tsWires new resource logic into the main SolidLogic object.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment threadsrc/types.ts
Comment threadsrc/types.ts Outdated
Comment threadsrc/resource/resourceLogic.ts Outdated
Comment threadsrc/resource/resourceLogic.ts Outdated
SharonStratsand others added 3 commits August 10, 2026 21:33
Prompt: add resource service regression tests and harden delete recursion
Co-authored-by: GPT-5.4 Mini <gpt-5.4-mini@openai.com>

CopilotAI left a comment

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/resource/resourceLogic.ts:179

  • _fetch resolves with a Response for HTTP failures, so a 403/500 response reaches the cache-removal code and is reported as a successful deletion. Validate the returned response, treating only 404/410 as idempotent success, before removing the resource from the store.
 deleted = await store.fetcher._fetch(resourceNode.value, { method: 'DELETE' })

src/resource/resourceLogic.ts:43

  • A HEAD response can legitimately omit Content-Type while still returning WAC-Allow and ETag. Because the direct response headers are only read when Content-Type is present, those access flags are discarded and the menu can incorrectly report that the user cannot edit or that the resource is not public. Read each response header independently whenever response.headers is available.
 if (response.headers && response.headers.get('content-type')) {
contentType = response.headers.get('content-type')?.split(';')[0] ?? undefined
const accessFlags = readWacAccessInfo(response.headers.get('wac-allow'))

src/resource/resourceLogic.ts:165

  • Type-index registrations are removed before the resource DELETE is attempted. If that DELETE later fails (for example with 403 or 500), the resource still exists but is no longer discoverable through its type index. Defer this cleanup until the resource DELETE succeeds or is confirmed as 404/410.

This issue also appears on line 179 of the same file.

 if (options.deleteTypeIndexes) {
await deleteTypeIndexesForResource(resourceNode, options.user)
}

src/typeIndex/typeIndexLogic.ts:229

  • loadTypeIndexesFor is not a read-only lookup: when links are missing it calls followOrCreateLinkWithContentOnCreate for public and private indexes. Consequently, deleting an unregistered resource can create new type-index documents and profile/preference links. Cleanup should use a read-only scope loader that follows only existing index links.
 const scopes = await loadTypeIndexesFor(user)

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

Labels

enhancementNew feature or request

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants

@SharonStrats