Skip to content

Commit d6cdc36

Browse files
committed
fix(settings): keep release history accessible after dismiss
1 parent 039588f commit d6cdc36

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/settings-implementation.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {App, PluginSettingTab, Setting, Notice, TextComponent} from 'obsidian';
22
import GitLabFilesPush, { type ConnectionStatus } from "./main";
33
import {FolderSuggest} from "./ui/FolderSuggest";
44
import {RemoteFolderSuggest} from "./ui/RemoteFolderSuggest";
5+
import {WhatsNewModal} from "./ui/WhatsNewModal";
56
import { t, setLanguageOverride, type LanguageSetting } from "./i18n";
67
import { CHANGELOG, entryText } from "./changelog";
78

@@ -172,10 +173,8 @@ export class GitLabSyncSettingTab extends PluginSettingTab {
172173
}
173174

174175
// Persistent (until dismissed) banner surfacing the current version's notable
175-
// highlights right at the top of the settings tab, so users who dismissed or
176-
// never saw the WhatsNewModal (see main.ts) can still find them. Separate
177-
// from `lastSeenVersion` — that gate controls the once-per-upgrade modal,
178-
// this one just tracks whether the banner itself was dismissed.
176+
// highlights right at the top of the settings tab. Dismissing this only hides
177+
// the attention banner; release history remains available from Settings.
179178
private renderWhatsNewBanner(containerEl: HTMLElement): void {
180179
const currentVersion = this.plugin.manifest.version;
181180
if (this.plugin.settings.bannerDismissedVersion === currentVersion) return;
@@ -206,6 +205,17 @@ export class GitLabSyncSettingTab extends PluginSettingTab {
206205
});
207206
}
208207

208+
private renderReleaseHistorySetting(containerEl: HTMLElement): void {
209+
new Setting(containerEl)
210+
.setName(t('settings.releaseHistory.name'))
211+
.setDesc(t('settings.releaseHistory.desc'))
212+
.addButton(button => button
213+
.setButtonText(t('settings.releaseHistory.button'))
214+
.onClick(() => {
215+
new WhatsNewModal(this.app, CHANGELOG).open();
216+
}));
217+
}
218+
209219
// Rebuilding the whole settings tab (renderSettings) to refresh the badge
210220
// would empty and recreate every field, stealing focus mid-typing. The
211221
// badge element is instead created once per renderSettings pass and
@@ -249,6 +259,7 @@ export class GitLabSyncSettingTab extends PluginSettingTab {
249259
containerEl.empty();
250260

251261
this.renderWhatsNewBanner(containerEl);
262+
this.renderReleaseHistorySetting(containerEl);
252263
this.renderConnectionStatus(containerEl);
253264

254265
new Setting(containerEl)
@@ -490,7 +501,7 @@ export class GitLabSyncSettingTab extends PluginSettingTab {
490501
.setPlaceholder('https://gitea.example.com')
491502
.setValue(this.plugin.settings.giteaBaseUrl)
492503
.onChange((value) => {
493-
this.plugin.settings.giteaBaseUrl = value;
504+
this.plugin.settings.giteaBaseUrl = value || 'https://gitea.example.com';
494505
void this.plugin.saveSettings();
495506
this.plugin.initializeGitService();
496507
this.scheduleConnectionTest();

0 commit comments

Comments
 (0)