Skip to content

Conversation

@vsedmik
Copy link
Contributor

@vsedmik vsedmik commented Dec 9, 2025

What are the changes introduced in this pull request?

This PR just slightly modifies the "Create flatpak remote" modal:

  1. The helper banner is shown if a "Red Hat remote" (one with flatpaks.redhat.io in URL) is missing in the current organization (used to be global).
  2. A click on "Add Red Hat flatpak remote" fills both, Name and URL, fields (used to fill the URL only).
  3. Capitalization of the Create/Edit modal header ("Create Flatpak Remote" -> "Create flatpak remote")

I did not touch the Create/Update buttons, they seem fine to me.

This PR has been AI-assisted.

Considerations taken when implementing this change?

None.

What are the testing steps for this pull request?

  1. Try to create RH Flatpak remotes in different organizations - banner should be shown only if RH remote doesn't exist in the current org.
  2. Click on "Add Red Hat flatpak remote" -> both Name and URL is filled.
  3. Header capitalization of the Create/Edit modal should be of "sentence case".

Summary by Sourcery

Scope Red Hat flatpak helper behavior to the current organization and align the flatpak remote creation UI copy.

New Features:

  • Automatically prefill both name and URL when adding the Red Hat flatpak remote from the helper banner.

Bug Fixes:

  • Restrict detection of existing Red Hat flatpak remotes to the current organization instead of checking globally.

Enhancements:

  • Update create/edit flatpak remote modal titles to use sentence case for consistency.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • In the has_redhat_flatpak_remote query you dropped unscoped, which changes behavior when an organization is not present or when a default scope exists; consider preserving unscoped while still scoping by organization_id when @organization is set.
  • The hardcoded setName('Red Hat remote') string in the helper banner isn't localized; consider wrapping it in __() (or reusing an existing translated label) so it follows the rest of the UI's i18n pattern.
  • The Red Hat flatpak URL (https://flatpaks.redhat.io/rhel) is now duplicated between frontend behavior and backend detection logic; pulling this into a shared constant or at least a single definition would reduce the risk of future drift.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `has_redhat_flatpak_remote` query you dropped `unscoped`, which changes behavior when an organization is not present or when a default scope exists; consider preserving `unscoped` while still scoping by `organization_id` when `@organization` is set.
- The hardcoded `setName('Red Hat remote')` string in the helper banner isn't localized; consider wrapping it in `__()` (or reusing an existing translated label) so it follows the rest of the UI's i18n pattern.
- The Red Hat flatpak URL (`https://flatpaks.redhat.io/rhel`) is now duplicated between frontend behavior and backend detection logic; pulling this into a shared constant or at least a single definition would reduce the risk of future drift.

## Individual Comments

### Comment 1
<location> `webpack/scenes/FlatpakRemotes/CreateEdit/FlatpakRemoteform.js:130-132` </location>
<code_context>
         actionLinks={
           <React.Fragment>
-            <AlertActionLink onClick={() => setUrl('https://flatpaks.redhat.io/rhel')}>
+            <AlertActionLink onClick={() => {
+              setUrl('https://flatpaks.redhat.io/rhel');
+              setName('Red Hat remote');
+            }}
+            >
</code_context>

<issue_to_address>
**issue:** New label string for the Red Hat remote name should likely go through the i18n helper.

This introduces a new user-visible string that skips the translation helper used elsewhere in this file (e.g. `__('Add Red Hat flatpak remote')`). Please wrap it with the i18n helper for consistency and localization support, e.g. `setName(__('Red Hat remote'))`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

<Modal
ouiaId="create-flatpak-modal"
title={__('Create Flatpak Remote')}
title={__('Create flatpak remote')}
Copy link
Member

Choose a reason for hiding this comment

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

I know sentence case is usually the goal here, but I wonder if this one should be different because Flatpak is a proper name.

Suggested change
title={__('Create flatpak remote')}
title={__('Create Flatpak remote')}

@MariSvirik thoughts?

<Modal
ouiaId="edit-flatpak-modal"
title={__('Edit Flatpak Remote')}
title={__('Edit flatpak remote')}
Copy link
Member

Choose a reason for hiding this comment

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

same comment as above

Copy link
Member

@sjha4 sjha4 left a comment

Choose a reason for hiding this comment

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

Functionality-wise, this is working nicely..Was able to test the changed org and remote name behavior..Ack from me.. Merge after @MariSvirik acks 👍🏼

@MariSvirik
Copy link

MariSvirik commented Dec 17, 2025

If "Flatpak" is functionally equivalent to a proper noun like "Ansible" or "Kubernetes," the correct choice is to capitalize it.

Create Flatpak remote
Edit Flatpak remote

@vsedmik vsedmik force-pushed the 38945-org-scope-rh-remote-banner branch from 6ea3e23 to 581f19c Compare December 17, 2025 17:02
@vsedmik
Copy link
Contributor Author

vsedmik commented Dec 17, 2025

Upper-cased both, thank you @MariSvirik and @jeremylenz !

Copy link
Member

@sjha4 sjha4 left a comment

Choose a reason for hiding this comment

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

APJ 👍🏼 Thanks @vsedmik !

Copy link
Contributor

@sambible sambible left a comment

Choose a reason for hiding this comment

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

Nice fix! Need to find myself some sort of issue like this for my first upstream contribution :)

@jeremylenz jeremylenz merged commit f531e11 into Katello:master Dec 17, 2025
22 checks passed
@vsedmik vsedmik deleted the 38945-org-scope-rh-remote-banner branch December 18, 2025 09:27
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.

5 participants