Add GitLab live folders provider (cloud and self-hosted)#13417
Closed
stevenferey wants to merge 12 commits into
Closed
Add GitLab live folders provider (cloud and self-hosted)#13417stevenferey wants to merge 12 commits into
stevenferey wants to merge 12 commits into
Conversation
Implements nsGitlabLiveFolderProvider on top of the existing nsZenLiveFolderProvider contract, with cookie-first auth and optional PAT fallback stored in the Firefox Login Manager via a small GitlabAuth wrapper. Covers gitlab.com and self-hosted instances; the host is auto-detected from the active tab when the folder is created. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds the two new menuitems (Merge Requests / Issues) to the "Create Live Folder" toolbar menu and routes their commands through ZenLiveFoldersManager.createFolder. Auto-detects the GitLab host from the active tab via ProviderClass.getDefaultHost when available, falling back to gitlab.com. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds the GitLab tanuki silhouette as a selectable single-color icon, the en-US Fluent strings for menu labels, options, errors and the PAT prompt, and a GitLab section in live-folders-specs covering host detection, the cookie-first auth model and the PAT fallback stored in the Firefox Login Manager. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirrors browser_github_live_folder.js with sinon-stubbed fetch and GitlabAuth: covers URL construction for the assigned/created/review-requested scopes, the issues endpoint switch, self-hosted host overrides, JSON parsing into folder items, PRIVATE-TOKEN injection presence vs. absence, 401/403 → no-auth, no filters → no-filter, and network failure → failed-fetch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Applies the Mozilla prettier config (arrowParens: avoid, trailing comma none for last fn arg) so the new GitLab files match the style of the surrounding live-folders/ codebase. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Mozilla preprocessor now rejects files marked for preprocessing that contain no # directives. Our SVG has no substitutions, so the leading * is removed for this single entry to copy the file verbatim. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Auto-detection only matches hosts containing "gitlab" in the name; instances like forge.example.org default to gitlab.com and need a manual override. Adds a "Change Instance…" menuitem that prompts for a host (accepts full URL, strips scheme/path) and resets per-host state (project list, excludes) so the next refresh hits the new instance cleanly. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nsILoginInfo.init() is a void mutator, so chaining .createInstance(...).init(...) returned undefined, and addLoginAsync(undefined) raised "TypeError: can't access property origin, login is null" inside LoginManager. The PAT never made it to the Login Manager, leaving folders on self-hosted instances stuck in no-auth mode. Build the loginInfo over two statements so the instance itself is returned to the caller. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Three issues prevented self-hosted GitLab folders from working: * Older self-hosted versions don't resolve __me__ in the REST API, so reviewer_username=__me__ silently returned []. Resolve the user via /api/v4/user once and cache the numeric id in state, then query reviewer_id=<id>. * /api/v4/merge_requests defaults to scope=created_by_me on the server. Combined with a reviewer filter that left scope unset, the intersection was empty whenever someone else opened the MR — i.e. the typical reviewer case. The reviewer query now forces scope=all. * The PAT prompt was passed as the dialog title (2nd arg of Services.prompt.prompt), which has a fixed-width header and truncated the long "Personal access token for <host>…" label. Move it to the text body (3rd arg). The cached user id is invalidated when the instance is changed, since it belongs to the previous host. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The file was added when live folders shipped but never wired into crowdin.yml, so all live-folder strings (GitHub, RSS, GitLab) were stuck in en-US for every other locale. Adding the entry exposes ~30 keys to translators going forward. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Services.prompt.prompt() with an empty title falls back to a
generic "Prompt" header, and a plain text input lets a personal
access token sit in cleartext on screen during entry. Switch
the PAT prompt to promptPassword() so the field renders as
••••••, and add Fluent strings for both dialog titles
("GitLab access token" / "GitLab instance").
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Member
|
Sorry, we don't accept code generated by claude |
Author
|
Hi @mr-cheffy Thanks for taking the time to look at this. I respect the decision to close — just hoping to understand the rule a bit better for future contributions. Could you point me to where the policy on If there's any nuance (e.g. the issue is unreviewed bulk generation vs. assisted authoring where I read, tested and own every line), I'd appreciate the clarification so I don't waste a reviewer's time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds GitLab as a third Live Folders provider, alongside GitHub and RSS, covering both gitlab.com and self-hosted instances (public or private). Built to address discussion
#12453.
What this PR does
nsGitlabLiveFolderProviderthat mirrors the GitHub provider's contractzen-live-folders.jsonlz4)code.company.com)Created by Me,Assigned to Me,Review Requests(usesreviewer_id+scope=allbecause older self-hosted versions don't resolve__me__and the endpoint defaults tocreated_by_me)zen-live-folder-gitlab-*)zen-live-folders.ftlincrowdin.yml(it was never wired in, so all live-folder strings — GitHub, RSS, GitLab — were stuck in en-US for every other locale)docs/live-folders-specs.mdScreenshots
Notes for reviewers
GitlabAuth.sys.mjs) so it doesn't conflict if Live Folders: support GitHub Enterprise instances #13044 lands. A sharedAuth.sys.mjswould be a sensiblefollow-up once Live Folders: support GitHub Enterprise instances #13044's design is final.
fetch()signature untouched, and supports cookies natively.promptPassword), never serialized in cleartext, and removed from Login Manager via the dedicatedRemove Access Tokenmenuitem.getDefaultHost(window)using a heuristic on the active tab's URL (gitlab.comor(^|.)gitlab.). Hosts that don't match (e.g.code.company.com) default togitlab.com; the user changes them viaChange Instance…. Switching instance invalidates the per-host cacheduserId.References