mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(editor): Add default author name and email to source control settings (#6543)
This commit is contained in:
parent
8b76e98085
commit
e1a02c7625
|
@ -1,24 +1,31 @@
|
||||||
import { computed, reactive } from 'vue';
|
import { computed, reactive } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { EnterpriseEditionFeature } from '@/constants';
|
import { EnterpriseEditionFeature } from '@/constants';
|
||||||
import { useSettingsStore } from '@/stores/settings.store';
|
import { useSettingsStore, useRootStore, useUsersStore } from '@/stores';
|
||||||
import * as vcApi from '@/api/sourceControl';
|
import * as vcApi from '@/api/sourceControl';
|
||||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
|
||||||
import type { SourceControlPreferences } from '@/Interface';
|
import type { SourceControlPreferences } from '@/Interface';
|
||||||
|
|
||||||
export const useSourceControlStore = defineStore('sourceControl', () => {
|
export const useSourceControlStore = defineStore('sourceControl', () => {
|
||||||
const rootStore = useRootStore();
|
const rootStore = useRootStore();
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
|
const usersStore = useUsersStore();
|
||||||
|
|
||||||
const isEnterpriseSourceControlEnabled = computed(() =>
|
const isEnterpriseSourceControlEnabled = computed(() =>
|
||||||
settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.SourceControl),
|
settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.SourceControl),
|
||||||
);
|
);
|
||||||
|
const defaultAuthor = computed(() => {
|
||||||
|
const user = usersStore.currentUser;
|
||||||
|
return {
|
||||||
|
name: user?.fullName ?? `${user?.firstName} ${user?.lastName}`.trim(),
|
||||||
|
email: user?.email ?? '',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const preferences = reactive<SourceControlPreferences>({
|
const preferences = reactive<SourceControlPreferences>({
|
||||||
branchName: '',
|
branchName: '',
|
||||||
branches: [],
|
branches: [],
|
||||||
authorName: '',
|
authorName: defaultAuthor.value.name,
|
||||||
authorEmail: '',
|
authorEmail: defaultAuthor.value.email,
|
||||||
repositoryUrl: '',
|
repositoryUrl: '',
|
||||||
branchReadOnly: false,
|
branchReadOnly: false,
|
||||||
branchColor: '#5296D6',
|
branchColor: '#5296D6',
|
||||||
|
|
Loading…
Reference in a new issue