Skip to content
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

Added setting to disable 'No changes...' popups #676

Merged
merged 3 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const DEFAULT_SETTINGS: Omit<ObsidianGitSettings, "autoCommitMessage"> =
disablePush: false,
pullBeforePush: true,
disablePopups: false,
disablePopupsForNoChanges: false,
listChangedFilesInMessageBody: false,
showStatusBar: true,
updateSubmodules: false,
Expand Down
6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,11 @@ I strongly recommend to use "Source mode" for viewing the conflicted files. For
this.statusBar?.displayMessage(message.toLowerCase(), timeout);

if (!this.settings.disablePopups) {
new Notice(message, 5 * 1000);
if (!this.settings.disablePopupsForNoChanges
|| (this.settings.disablePopupsForNoChanges
&& !message.startsWith("No changes"))) {
jtams marked this conversation as resolved.
Show resolved Hide resolved
new Notice(message, 5 * 1000);
}
}

console.log(`git obsidian message: ${message}`);
Expand Down
16 changes: 16 additions & 0 deletions src/setting/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,22 @@ export class ObsidianGitSettingsTab extends PluginSettingTab {
.setValue(plugin.settings.disablePopups)
.onChange((value) => {
plugin.settings.disablePopups = value;
this.display();
plugin.saveSettings();
})
);

if (!plugin.settings.disablePopups)
new Setting(containerEl)
.setName("Hide notifications for no changes")
.setDesc(
"Don't show notifications when there are no changes to commit/push"
)
.addToggle((toggle) =>
toggle
.setValue(plugin.settings.disablePopupsForNoChanges)
.onChange((value) => {
plugin.settings.disablePopupsForNoChanges = value;
plugin.saveSettings();
})
);
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ObsidianGitSettings {
disablePush: boolean;
pullBeforePush: boolean;
disablePopups: boolean;
disablePopupsForNoChanges: boolean;
listChangedFilesInMessageBody: boolean;
showStatusBar: boolean;
updateSubmodules: boolean;
Expand Down
Loading