Skip to content

Live Folders #8888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

ZacharyEllison
Copy link

This update introduces "Live Folders," starting with support for GitHub Pull Requests.

Here's what it does:

  1. Core Logic & Storage:

    • I've added components to manage live folder operations, including fetching and parsing RSS feeds.
    • I've also set up a system to store live folder data and items in an SQLite database.
    • The GitHub PR RSS feed URL is used to get public pull requests for a specified user.
  2. UI Integration:

    • You'll find a new context menu item "Enable GitHub PR Live Folder" (currently accessible via main toolbar/tab context menus).
    • Selecting this option will open a page where you can input a GitHub username.
    • Once you submit a username, a new "Live Folder" (e.g., "Pull Requests (username)") will be created.
    • Live Folders appear as pinned tabs and display a content page that dynamically shows the fetched pull requests with status indicators (open, merged, closed) and links to the PRs.
    • The display page listens for updates and refreshes content automatically.
  3. Configuration & Error Handling:

    • You can configure the polling interval for checking RSS feed updates (default is 15 minutes, minimum 1 minute).
    • You can update this polling interval dynamically without a browser restart.
    • I've included basic error handling for feed fetching and parsing, with logs for diagnostics.
  4. Unit Tests:

    • I've added unit tests for the new live folder management and storage components.
    • These tests cover data persistence, feed parsing logic, folder creation, polling configuration, and error handling, using mocks for external dependencies.

This feature allows you to create dynamic folders that stay updated with information from external sources, beginning with GitHub Pull Requests.

…t's new:

This update introduces "Live Folders," starting with support for GitHub Pull Requests.

Here's what it does:

1.  **Core Logic & Storage:**
    *   I've added components to manage live folder operations, including fetching and parsing RSS feeds.
    *   I've also set up a system to store live folder data and items in an SQLite database.
    *   The GitHub PR RSS feed URL is used to get public pull requests for a specified user.

2.  **UI Integration:**
    *   You'll find a new context menu item "Enable GitHub PR Live Folder" (currently accessible via main toolbar/tab context menus).
    *   Selecting this option will open a page where you can input a GitHub username.
    *   Once you submit a username, a new "Live Folder" (e.g., "Pull Requests (username)") will be created.
    *   Live Folders appear as pinned tabs and display a content page that dynamically shows the fetched pull requests with status indicators (open, merged, closed) and links to the PRs.
    *   The display page listens for updates and refreshes content automatically.

3.  **Configuration & Error Handling:**
    *   You can configure the polling interval for checking RSS feed updates (default is 15 minutes, minimum 1 minute).
    *   You can update this polling interval dynamically without a browser restart.
    *   I've included basic error handling for feed fetching and parsing, with logs for diagnostics.

4.  **Unit Tests:**
    *   I've added unit tests for the new live folder management and storage components.
    *   These tests cover data persistence, feed parsing logic, folder creation, polling configuration, and error handling, using mocks for external dependencies.

This feature allows you to create dynamic folders that stay updated with information from external sources, beginning with GitHub Pull Requests.
@ZacharyEllison ZacharyEllison requested a review from mr-cheffy June 5, 2025 16:18
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Feature labels Jun 5, 2025
if (contextMenu && !document.getElementById('zen-toolbar-context-enable-github-live-folder')) {
const menuItem = document.createXULElement('menuitem');
menuItem.setAttribute('id', 'zen-toolbar-context-enable-github-live-folder');
// TODO: Replace with data-lazy-l10n-id for localization if this were a production feature.

Choose a reason for hiding this comment

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

Is this PR in draft?
There's a lot to still be implemented.

Copy link
Author

Choose a reason for hiding this comment

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

Apologies for opening not in draft

Comment on lines +1174 to +1176
// Fallback if goDoCommand is not the mechanism, add a command event listener.
// This is a simplified approach. A more robust solution might involve <command> elements in XUL
// and ensuring this listener is correctly scoped and cleaned up.

Choose a reason for hiding this comment

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

  • _____

Comment on lines +53 to +54
// Simplified check
// Listen on gBrowser.tabContainer for events that might bubble from tabs

Choose a reason for hiding this comment

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

  • _____

Comment on lines +89 to +93
// descriptionId: 'zen-livefolder-github-enabled-toast-description', // Example for a more specific message
// For now, using the main messageId as the primary display string.
// In a real scenario, 'zen-livefolder-github-enabled-toast' would be a generic title
// and descriptionId would point to "GitHub PR Live Folder for '{username}' enabled!"
// For simplicity here, we'll assume the main ID can convey enough.

Choose a reason for hiding this comment

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

  • _____

Comment on lines +139 to +140
// Fallback for environments where Services.uuid might not be available directly
// This is a simplified UUID v4 generator, consider a more robust one if needed.

Choose a reason for hiding this comment

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

  • _____

Comment on lines +201 to +212
// We need PlacesUtils to be available. Assuming it's loaded similarly to other storage files.
// A more robust way would be to ensure PlacesUtils is loaded before calling init.
if (globalThis.PlacesUtils) {
ZenLiveFolderStorage.init();
} else {
// If PlacesUtils is not available, wait for a global event or use a lazy loader.
// For simplicity, we'll assume it becomes available.
// In a real scenario, this needs careful handling of dependencies.
console.warn(
'PlacesUtils not immediately available for ZenLiveFolderStorage. Will try to initialize later.'
);
// Fallback or error handling

Choose a reason for hiding this comment

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

  • _____

Etc...

@ZacharyEllison ZacharyEllison marked this pull request as draft June 6, 2025 01:48
@jeroenrinzema
Copy link

jeroenrinzema commented Jun 12, 2025

Really like this PR! I would recommend moving the GitHub implementation to their own location and exposing an internal livefolders API instead.

This would allow the project to add future integrations easily and possibly in the future expose the internal API, allowing plugins or mods (when able to run JavaScript) to be written.

An additional nice feature is if we could have live elements (this most likely should be included in a separate PR). Live elements would show things like upcoming calendar items right from the browser.

@jeroenrinzema
Copy link

@ZacharyEllison One additional requirement we may need to address is how to handle OAuth2 clients. The current PR supports public GitHub repositories, but it would be great to include the ability to add private repositories as well. I often use this feature at work to keep track of open PRs within my team.

@mrcoder991
Copy link

mrcoder991 commented Jun 13, 2025

@ZacharyEllison One additional requirement we may need to address is how to handle OAuth2 clients. The current PR supports public GitHub repositories, but it would be great to include the ability to add private repositories as well. I often use this feature at work to keep track of open PRs within my team.

Also for organisation SSO too. many people would benefit from that and also if its possible to add that 🔑 button on the folder to complete SSO so that private PRs can be fetched

Great work btw Thanks Man.

@LemonPotion
Copy link

@ZacharyEllison , is there some progress on this pr?

@mr-cheffy
Copy link
Contributor

How did you even make live folders before folders even exist

@Anoms12
Copy link

Anoms12 commented Jul 11, 2025

@mr-cheffy from scrolling through the code, it seems to only make a "folder" in the backend, but just pin the tab in the UI. I am not too sure as I did not have a lot of time to look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants