Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

🧢 Changes

GitLab users were seeing "PR" (Pull Request) terminology throughout the UI instead of "MR" (Merge Request). All hardcoded labels have been replaced with dynamic references to the forge's unit configuration.

Updated components:

  • Input placeholders: "PR title" → "{unit.abbr} title" (MR/PR based on forge)
  • AI generation: "Generate PR description" → "Generate {unit.abbr} description"
  • Context menus: "Copy PR link" → "Copy {unit.abbr} link", submenu titles
  • Modal titles: "Create Pull Request" → "Create {unit.name}" (Merge request/Pull request)
  • Button labels: "Apply PR to workspace" → "Apply {unit.abbr} to workspace"
  • Toast messages: "PR link copied" → "{unit.abbr} link copied"
  • Global settings: Uses static "PR/MR" text since it's not project-specific

Implementation:

Added centralized getters to DefaultForgeFactory to reduce code duplication:

  • reviewUnitAbbr: Returns unit abbreviation with fallback to 'PR'
  • reviewUnitName: Returns unit name with fallback to 'Pull request'
  • reviewUnitSymbol: Returns unit symbol with fallback to '#'

Each forge service defines unit: { name, abbr, symbol }:

  • GitHub: { name: 'Pull request', abbr: 'PR', symbol: '#' }
  • GitLab: { name: 'Merge request', abbr: 'MR', symbol: '!' }

Components now access these via forge.reviewUnitAbbr instead of duplicated prService?.unit.abbr ?? 'PR' patterns throughout the codebase.

Files modified:

  • forgeFactory.svelte.ts (added centralized getters)
  • ReviewCreation.svelte
  • MessageEditor.svelte
  • IntegrationsSettings.svelte
  • BranchesView.svelte
  • PRBranchView.svelte
  • PullRequestCard.svelte
  • BranchHeaderContextMenu.svelte
  • BranchReview.svelte
  • BranchesViewPR.svelte
  • CanPublishReviewPlugin.svelte

☕️ Reasoning

Users expect UI terminology to match their forge. Hardcoded "PR" labels confused GitLab users and made the interface feel GitHub-centric. By adding centralized getters with fallback defaults, the code is now more maintainable with a single source of truth for default values.

Original prompt

#11444 Find places in the Desktop application frontend code that hardcode "MR" and generate the label dynamically based on the forge used by the repository.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
gitbutler-web Skipped Skipped Dec 4, 2025 5:58pm

Copilot AI changed the title [WIP] Fix hardcoded MR label in frontend code Replace hardcoded PR/MR labels with dynamic forge-based labels Dec 4, 2025
Copilot AI requested a review from Byron December 4, 2025 07:36
Copilot finished work on behalf of Byron December 4, 2025 07:36
- Refactor: rename GENERATE_MESSAGES to generateMessages for reactive clarity
- Update clipboard messages and context menu labels to use dynamic forge labels
- Update modal titles and CTA labels to use dynamic forge unit names

Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
@Byron
Copy link
Collaborator

Byron commented Dec 4, 2025

Once again, this looks like a win. How does it look to you @Caleb-T-Owens?
I am particularly unsure about how these magic $ functions are used, but it certainly looks like it knows what it's doing.

Comment on lines 22 to 27
{#snippet title()}
Auto-fill PR descriptions from commit
Auto-fill {prUnit?.abbr ?? 'PR'} descriptions from commit
{/snippet}
{#snippet caption()}
When creating a pull request for a branch with just one commit, automatically use that commit's
message as the PR title and description.
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't make sense to dynamically switch here since it's in the global settings.

If we want to be "inclusive" about this one, we should say "PR/MR" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 1cf4d11. Changed to static "PR/MR" text since this is in global settings and not project-specific.

Copy link
Contributor

@Caleb-T-Owens Caleb-T-Owens left a comment

Choose a reason for hiding this comment

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

The global settings either needs reverted, or changed to be statically "PR/MR", but the rest seems fine.

I'm not in love with all the duplicated defaults everywhere though.

I wonder if the forge factory should have it's own getters for unit, name, & friends that have the defaults there. That way we can cut down on the amount of fallbacks everywhere

@Byron
Copy link
Collaborator

Byron commented Dec 4, 2025

Thanks for taking a look. Let's see if Copilot can see this PR through tot he end.

@copilot Address the following comment:

The global settings either needs reverted, or changed to be statically "PR/MR", but the rest seems fine.

I'm not in love with all the duplicated defaults everywhere though.

I wonder if the forge factory should have it's own getters for unit, name, & friends that have the defaults there. That way we can cut down on the amount of fallbacks everywhere

Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
Co-authored-by: Byron <63622+Byron@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 4, 2025

The global settings either needs reverted, or changed to be statically "PR/MR", but the rest seems fine.

I'm not in love with all the duplicated defaults everywhere though....

Both addressed:

  1. Global settings now uses static "PR/MR" (1cf4d11)
  2. Added centralized getters to forge factory with defaults (3613ad7):
    • forge.reviewUnitAbbr → 'PR' fallback
    • forge.reviewUnitName → 'Pull request' fallback
    • forge.reviewUnitSymbol → '#' fallback

Refactored 7 components to use these getters, eliminating duplicated ?? 'PR' defaults throughout the codebase.

Copilot finished work on behalf of Byron December 4, 2025 16:30
@Byron
Copy link
Collaborator

Byron commented Dec 4, 2025

Alright, it really does seem like it addressed all concerns.

I ran it and the most obvious place to see what changed really does make a more 'native' impression.

top: nightly, bottom: dev
Screenshot 2025-12-04 at 18 49 09

@Byron Byron requested a review from Caleb-T-Owens December 4, 2025 17:51
@Byron Byron marked this pull request as ready for review December 4, 2025 17:51
Strangely enough, this wasn't flagged when running `pnpm begood` locally.
CI found it though, and it's definitely a real issue.
It's unclear to me how that's possible.
@Byron Byron force-pushed the copilot/dynamic-label-generation-mr branch from 74ff532 to 47d45db Compare December 4, 2025 17:58
@Byron Byron removed their assignment Dec 5, 2025
@Byron Byron removed their request for review December 5, 2025 10:04
@Byron Byron merged commit 27b7139 into master Dec 5, 2025
22 checks passed
@Byron Byron deleted the copilot/dynamic-label-generation-mr branch December 5, 2025 10:08
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.

3 participants