Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const subprojects = ref([]);
const organizations = ref<GitHubOrganization[]>([]);
const repositories = ref<GitHubSettingsRepository[]>([]);
const repoMappings = ref<Record<string, string>>({});
const initialRepoMappings = ref<Record<string, string>>({});

// Drawer visibility
const isDrawerVisible = computed({
Expand Down Expand Up @@ -157,7 +158,10 @@ const buildSettings = (): GitHubSettings => {
.map((r) => ({
name: r.name,
url: r.url,
updatedAt: r.updatedAt || dayjs().toISOString(),
updatedAt: (props.integration
&& repoMappings.value[r.url] !== initialRepoMappings.value[r.url])
? dayjs().toISOString()
: r.updatedAt || dayjs().toISOString(),
})),
}),
);
Expand All @@ -167,6 +171,7 @@ const buildSettings = (): GitHubSettings => {
const connect = () => {
let integration: any = null;
const settings: GitHubSettings = buildSettings();

(props.integration?.id
? IntegrationService.update(props.integration.id, {
settings,
Expand Down Expand Up @@ -219,13 +224,16 @@ const fetchGithubMappings = () => {
if (!props.integration) return;
IntegrationService.fetchGitHubMappings(props.integration).then(
(res: any[]) => {
repoMappings.value = res.reduce(
const mappings = res.reduce(
(rm, mapping) => ({
...rm,
[mapping.url]: mapping.segment.id,
}),
{},
);
// Create new objects to ensure no reference sharing
repoMappings.value = { ...mappings };
initialRepoMappings.value = { ...mappings };
},
);
};
Expand Down
Loading