FIX: ensures it works with subfolders (#15)

FIX: ensures it works with subfolders (#15)
From 50804d2427b16a5808de124deace1a38b01abf90 Mon Sep 17 00:00:00 2001
From: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Date: Thu, 15 Nov 2018 11:37:36 +0100
Subject: [PATCH] FIX: ensures it works with subfolders (#15)


diff --git a/assets/javascripts/discourse/initializers/checklist.js.es6 b/assets/javascripts/discourse/initializers/checklist.js.es6
index f2e2252..1fd4665 100644
--- a/assets/javascripts/discourse/initializers/checklist.js.es6
+++ b/assets/javascripts/discourse/initializers/checklist.js.es6
@@ -31,8 +31,8 @@ export function checklistSyntax($elem, post) {
       elem.after(iconHTML("spinner", { class: "fa-spin" }));
       elem.hide();
 
-      var postId = viewPost.id;
-      AjaxLib.ajax("/posts/" + postId, { type: "GET", cache: false }).then(
+      const endpoint = Discourse.getURL(`/posts/${viewPost.id}`);
+      AjaxLib.ajax(endpoint, { type: "GET", cache: false }).then(
         function(result) {
           var nth = -1, // make the first run go to index = 0
             new_raw = result.raw.replace(/\[(\s|\_|\-|\x|\\?\*)?\]/gi, function(
@@ -70,4 +70,4 @@ export default {
   initialize: function() {
     withPluginApi("0.1", api => initializePlugin(api));
   }
-};
\ No newline at end of file
+};

GitHub