diff --git a/src/SzuruTypes.ts b/src/SzuruTypes.ts
index efe8b49..52d0536 100644
--- a/src/SzuruTypes.ts
+++ b/src/SzuruTypes.ts
@@ -26,7 +26,7 @@ export interface Tag {
names: string[];
category: string;
version: number;
- description?: any;
+ description?: string; // Markdown
creationTime: Date;
lastEditTime?: Date;
usages: number;
diff --git a/src/popup/App.vue b/src/popup/App.vue
index a154f5c..7a6eb0c 100644
--- a/src/popup/App.vue
+++ b/src/popup/App.vue
@@ -146,13 +146,34 @@ export default Vue.extend({
}
try {
- this.pushInfo("Uploading...");
+ // Create and upload post
+ let uploadMsg = new Message("Uploading...");
+ this.messages.push(uploadMsg);
window.scrollTo(0, 0);
const createdPost = await this.szuru.createPost(this.post);
- this.clearMessages();
// TODO: Clicking a link doesn't actually open it in a new tab,
// see https://stackoverflow.com/questions/8915845
- this.pushInfo(`Uploaded post`);
+ uploadMsg.content = `Uploaded post`;
+
+ let tagsMsg = new Message("Checking tags...");
+ this.messages.push(tagsMsg);
+
+ // Find tags with "default" category and update it
+ // TODO: Make all these categories configurable
+ const tagsWithCategory = this.post.tags.filter(x => x.category);
+ const unsetCategoryTags = createdPost.tags
+ .filter(x => x.category == "default")
+ .filter(x => tagsWithCategory.some(y => x.names.includes(y.name)));
+
+ console.dir(unsetCategoryTags);
+
+ if (unsetCategoryTags.length == 0) {
+ tagsMsg.content = "All tags have the correct category";
+ } else {
+ tagsMsg.content = `${unsetCategoryTags.length} tags need a different category`;
+ // TODO: Call /tags?query={tag1},{tag2},{tag3}
+ // TODO: Foreach tag call PUT /tag/{tag1} with updated category
+ }
} catch (ex) {
const error = ex as LocalError;
diff --git a/tsconfig.json b/tsconfig.json
index 9cfb044..7b569c4 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -10,7 +10,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"lib": [
- "es2015",
+ "es2017",
"dom"
],
"plugins": [