Skip to content

Commit

Permalink
Allow to setup the test mode folder with dry-run disabled (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li authored Jan 22, 2024
1 parent f460aa1 commit d38eb61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
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

0 comments on commit d38eb61

Please sign in to comment.