-
Notifications
You must be signed in to change notification settings - Fork 15
feat(oauth): gitlab support #72
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
base: main
Are you sure you want to change the base?
Conversation
|
@TotomInc is attempting to deploy a commit to the Nuxt Team on Vercel. A member of the Team first needs to authorize it. |
e83bdf9 to
963a4e7
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Can someone from the core-team review this PR please? I believe all the changes required for GitLab provider support is done. I've done testing on our company's GitLab self-hosted repository, and it works well:
Thanks! 🙂 |
|
Thanks a lot @TotomInc! I've already had a check at it and it looks pretty good to me! There is a refactor I would like to do before merging, I'll take care of it, just need to finish another big refactor I'm working on first 😄 |
|
Alright awesome @larbish, feel free to ping me if necessary or if I can give some help in getting this merged 🙂 |
…e + create empty provider for dev mode
|
I did a small refactor:
Ready to merge once @farnabaz validate the auth behaviour ✅ |
Co-authored-by: Farnabaz <farnabaz@gmail.com>
|
|
||
| <p class="text-muted text-xs mb-2"> | ||
| {{ $t('studio.conflict.description') }} | ||
| {{ $t('studio.conflict.description', gitProvider.name) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation calls are using incorrect Vue I18n syntax - named placeholders like {providerName} require object parameters, not positional arguments.
View Details
📝 Patch Details
diff --git a/src/app/src/components/content/ContentEditorConflict.vue b/src/app/src/components/content/ContentEditorConflict.vue
index f4ea501..57e05a9 100644
--- a/src/app/src/components/content/ContentEditorConflict.vue
+++ b/src/app/src/components/content/ContentEditorConflict.vue
@@ -118,7 +118,7 @@ useMonacoDiff(diffEditorRef, {
</dl>
<p class="text-muted text-xs mb-2">
- {{ $t('studio.conflict.description', gitProvider.name) }}
+ {{ $t('studio.conflict.description', { providerName: gitProvider.name }) }}
</p>
</div>
</div>
diff --git a/src/app/src/components/media/MediaEditorImage.vue b/src/app/src/components/media/MediaEditorImage.vue
index 65fe0b7..a7a67f3 100644
--- a/src/app/src/components/media/MediaEditorImage.vue
+++ b/src/app/src/components/media/MediaEditorImage.vue
@@ -145,7 +145,7 @@ const remotePath = computed(() => {
:name="gitProvider.icon"
class="w-3.5 h-3.5"
/>
- <span>{{ $t('studio.media.providerPath', gitProvider.name) }}</span>
+ <span>{{ $t('studio.media.providerPath', { providerName: gitProvider.name }) }}</span>
</div>
<p class="text-xs font-mono text-highlighted truncate">
{{ remoteFile.path }}
diff --git a/src/app/src/pages/error.vue b/src/app/src/pages/error.vue
index 77615a3..e73302a 100644
--- a/src/app/src/pages/error.vue
+++ b/src/app/src/pages/error.vue
@@ -66,7 +66,7 @@ function retry() {
<UAlert
icon="i-lucide-alert-triangle"
- :title="$t('studio.publish.errorTitle', gitProvider.name)"
+ :title="$t('studio.publish.errorTitle', { providerName: gitProvider.name })"
:description="errorMessage"
color="error"
variant="soft"
Analysis
Named placeholder syntax mismatch in Vue I18n translation calls
What fails: Three components pass string values to i18n translation functions that contain named placeholders like {providerName}, which causes the placeholders to remain substituted. The translation calls use $t('key', stringValue) syntax instead of the required $t('key', { providerName: stringValue }) object parameter syntax.
How to reproduce:
- Run the project and navigate to a page that displays a content conflict (ContentEditorConflict.vue)
- Observe the conflict description message
- The provider name will not appear in the translated text - instead you'll see: "The content on differs from your website version." (with empty placeholder)
What happens vs expected behavior:
-
Actual result: Placeholders render empty because Vue I18n doesn't recognize positional string arguments as named parameters
- Line 121 ContentEditorConflict.vue:
$t('studio.conflict.description', gitProvider.name)produces "The content on differs from..." - Line 148 MediaEditorImage.vue:
$t('studio.media.providerPath', gitProvider.name)produces " path" - Line 69 error.vue:
$t('studio.publish.errorTitle', gitProvider.name)produces "Error during publish"
- Line 121 ContentEditorConflict.vue:
-
Expected result: According to Vue I18n message format syntax documentation, named placeholders require object parameters with matching property names:
- Should be:
$t('studio.conflict.description', { providerName: gitProvider.name })→ "The content on GitHub differs from..." - Should be:
$t('studio.media.providerPath', { providerName: gitProvider.name })→ "GitHub path" - Should be:
$t('studio.publish.errorTitle', { providerName: gitProvider.name })→ "Error during GitHub publish"
- Should be:
The correct pattern is already established in ItemActionsDropdown.vue line 48: t('studio.actions.confirmAction', { action: t(...) })
/auth/gitlab/__nuxt_studio/auth/gitlabwhich points to/server/routes/auth/gitlab.getruntime method/auth/adminto redirect to the proper provider as defined in the module configuseGitinto a shared composable, returns the proper git provider based on the module provider configGitProviderinterfacecreateGitLabProviderwith methods to fetch, commit and push to remote repositorycreateGitHubProviderwithGitProviderabstract interfacebase64, similar to GitHub providergitlabprovider in user & module configgitlab.applicationId,gitlab.applicationSecretandgitlab.instanceUrlmodule config properties with support for their own environment variablesbase64orutf-8)useGitProviderIconcomposable which returns the correct Git provider icon based on Studio user provider configSee #65 for context (fixes #65)
What's missing