Skip to content

Commit bfdfd42

Browse files
committed
feat: Ignore chooser modal if there is only one profile.
1 parent 04ff2d0 commit bfdfd42

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/main.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,16 @@ export default class WordpressPlugin extends Plugin {
116116
}
117117

118118
private openProfileChooser(): void {
119-
new WpProfileChooserModal(this.app, this, (profile) => {
120-
console.log(profile);
121-
this.doClientPublish(profile);
122-
}).open();
119+
if (this.settings.profiles.length === 1) {
120+
this.doClientPublish(this.settings.profiles[0]);
121+
} else if (this.settings.profiles.length > 1) {
122+
new WpProfileChooserModal(this.app, this, (profile) => {
123+
console.log(profile);
124+
this.doClientPublish(profile);
125+
}).open();
126+
} else {
127+
new Notice(this.i18n.t('error_noProfile'));
128+
}
123129
}
124130

125131
private doClientPublish(profile: WpProfile, defaultPostParams?: WordPressPostParams): void {

0 commit comments

Comments
 (0)