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

Allow to setup the test mode folder with dry-run disabled #279

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
},
"folder": {
"desc": "Use {{owner}}, {{repo}} and {{branch}} to dynamically name the folder.",
"title": "Folder where the repository will be simulated"
"title": "Folder where the repository will be simulated (test mode only)"
}
},
"ghToken": {
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
},
"folder": {
"desc": "Utilisez {{owner}}, {{repo}} et {{branch}} pour nommer dynamiquement le dossier.",
"title": "Dossier où le dépôt sera simulé"
"title": "Dossier où le dépôt sera simulé (test mode uniquement)"
}
},
"ghToken": {
Expand Down
28 changes: 14 additions & 14 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,20 +306,20 @@ export class GithubPublisherSettingsTab extends PluginSettingTab {
this.renderSettingsPage(EnumbSettingsTabId.github);
})
);
if (githubSettings.dryRun.enable) {
new Setting(this.settingsPage)
.setName(i18next.t("settings.github.dryRun.folder.title"))
.setDesc(i18next.t("settings.github.dryRun.folder.desc"))
.addText((text) =>
text
.setPlaceholder("github-publisher")
.setValue(githubSettings.dryRun.folderName)
.onChange(async (value) => {
githubSettings.dryRun.folderName = value.trim();
await this.plugin.saveSettings();
})
);
}

new Setting(this.settingsPage)
.setName(i18next.t("settings.github.dryRun.folder.title"))
.setDesc(i18next.t("settings.github.dryRun.folder.desc"))
.addText((text) =>
text
.setPlaceholder("github-publisher")
.setValue(githubSettings.dryRun.folderName)
.onChange(async (value) => {
githubSettings.dryRun.folderName = value.trim();
await this.plugin.saveSettings();
})
);


new Setting(this.settingsPage)
.setClass("no-display")
Expand Down
2 changes: 1 addition & 1 deletion src/utils/data_validation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export function isFolderNote(properties: MultiProperties) {
}

export function isInDryRunFolder(settings: GitHubPublisherSettings, repo: Repository | null, file: TFile | TFolder) {
if (!settings.github.dryRun.enable) return false;
if (settings.github.dryRun.folderName.trim().length ===0) return false;
const variables = {
owner: repo?.user ?? settings.github.user,
repo: repo?.repo ?? settings.github.repo,
Expand Down