Skip to content

Fix GitCodeLensProvider.resolveGitAuthors… "others" pluralization.#3296

Merged
d13 merged 1 commit intogitkraken:mainfrom
bm-w:fix/git-authors-codelens-pluralization
May 31, 2024
Merged

Fix GitCodeLensProvider.resolveGitAuthors… "others" pluralization.#3296
d13 merged 1 commit intogitkraken:mainfrom
bm-w:fix/git-authors-codelens-pluralization

Conversation

@bm-w
Copy link
Contributor

@bm-w bm-w commented May 15, 2024

Description

Fixes Authors lens to say e.g. “one other” (in full “2 authors (Jane Doe and one other)”) when there are 2 authors (#3295).

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@bm-w bm-w force-pushed the fix/git-authors-codelens-pluralization branch from ac4f125 to 6c9a10c Compare May 15, 2024 21:52
Copy link
Contributor

@TJohnsonSE TJohnsonSE left a comment

Choose a reason for hiding this comment

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

This looks this change has a bug where the generated 'andOthers' string is squished against the 'author' trunk. See screenshot below:

image

My recommendation is to change the ternary evaluation to check three cases: when count is exactly 1, when count is exactly 2, and when count is > 2. Then just tack in the extra missing space before the "and".

Something like this should work:

let title = ${pluralize('author', count, { zero: '?' })} (${author}${ count > 2 ? ' and others' : count === 2 ? ' and 1 other' : '' });

@bm-w bm-w force-pushed the fix/git-authors-codelens-pluralization branch from 6c9a10c to ba647ca Compare May 16, 2024 12:02
@bm-w
Copy link
Contributor Author

bm-w commented May 16, 2024

Oops, @TJohnsonSE, thanks for catching the squishing — fixed!

@d13 d13 merged commit aa0763a into gitkraken:main May 31, 2024
@d13
Copy link
Member

d13 commented May 31, 2024

@bm-w thank you for the contribution!

Thank you

@bm-w bm-w deleted the fix/git-authors-codelens-pluralization branch May 31, 2024 16:02
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.

4 participants