Skip to content

Commit f800f03

Browse files
committed
add a notice when trying to add two embeds in one file
1 parent 2a3c817 commit f800f03

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

main.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {App, Notice, Plugin, PluginSettingTab, setIcon, Setting} from 'obsidian'
22
import {api_authenticate, RepoItem} from "./API/ApiHandler";
33
import {IssuesModal} from "./Elements/Modals/IssuesModal";
44
import {Octokit} from "@octokit/core";
5-
import {softUpdateIssues, updateIssues} from "./Issues/IssueUpdater";
5+
import {getRepoInFile, softUpdateIssues, updateIssues} from "./Issues/IssueUpdater";
66
import {NewIssueModal} from "./Elements/Modals/NewIssueModal";
77
import {createCompactIssueElement, createDefaultIssueElement} from "./Elements/IssueItems";
88
import {CSVIssue, Issue} from "./Issues/Issue";
@@ -175,10 +175,16 @@ export default class MyPlugin extends Plugin {
175175
name: 'Embed open Issues',
176176
callback: () => {
177177
if (this.octokit){
178-
new IssuesModal(this.app, {
179-
octokit: this.octokit,
180-
plugin_settings: this.settings
181-
} as OctoBundle).open();
178+
//check if repo already exists in file
179+
const repo = getRepoInFile(this.app)
180+
if(repo){
181+
new Notice("Only one repo per file is supported at the moment! Current repo:" + repo.name + "/" + repo.repo)
182+
} else {
183+
new IssuesModal(this.app, {
184+
octokit: this.octokit,
185+
plugin_settings: this.settings
186+
} as OctoBundle).open();
187+
}
182188
} else {
183189
new Notice(errors.noCreds);
184190
}
@@ -288,10 +294,10 @@ class GithubIssuesSettings extends PluginSettingTab {
288294
containerEl.createEl('h2', {text: 'Github Authentication'});
289295

290296
containerEl.createSpan({
291-
text: "For authenticating you need to provide your Github Username and a Personal Authentication Token. You can create a new token "
297+
text: "To use this plugin, you need to create a personal access token. You can find a guide on how to do that in the "
292298
}).createEl('a', {
293-
text: "here.",
294-
href: "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token"
299+
text: "README.",
300+
href: "https://github.com/Frostplexx/obsidian-github-issues#prerequisites"
295301
})
296302

297303
// username

0 commit comments

Comments
 (0)