From 8730afbbbe03ff4d39ae3cbb3db22bb21bf366ad Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Tue, 19 Jul 2022 16:59:26 +0530 Subject: [PATCH] bug fix --- index.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index e60bb0f..c6c38a2 100644 --- a/index.html +++ b/index.html @@ -1010,7 +1010,7 @@ if (firstLoad || params.articleID !== pagesData.params.articleID) { if (!params.articleID) { // if no articleID is provided, get a random article from work-in-progress - const randomArticle = floCrypto.randInt(0, floGlobals.appObjects.cc.wipArticles.length - 1) + const randomArticle = floCrypto.randInt(0, floGlobals.appObjects.cc.wipArticles.filter(v => v).length - 1) params['articleID'] = floGlobals.appObjects.cc.wipArticles[randomArticle] } await Promise.all([ @@ -1345,7 +1345,7 @@ getConfirmation('Mark as WIP article?').then(res => { if (res) { if (!floGlobals.appObjects.cc.wipArticles.includes(floGlobals.currentArticle.id)) { - floGlobals.appObjects.cc.wipArticles.push(floGlobals.currentArticle.id) + floGlobals.appObjects.cc.wipArticles.filter(v => v).push(floGlobals.currentArticle.id) floCloudAPI.updateObjectData('cc') .then((res) => { notify('Marked current article as WIP', 'success') @@ -1726,7 +1726,7 @@ const render = { article(id, focusMode) { floGlobals.currentArticle.id = id - parseArticleData() + parseArticleData(id) const { title } = floGlobals.appObjects.cc.articleList[id] const { writer, sections } = floGlobals.currentArticle let assignedSection = localStorage.getItem(`${id}_assigned_section_${myFloID}`) @@ -1895,9 +1895,10 @@ } } - function parseArticleData() { - const { sections, editors, public } = floGlobals.appObjects[floGlobals.currentArticle.id] - const generalData = floGlobals.generalData[`${floGlobals.currentArticle.id}_gd|${floGlobals.adminID}|${floGlobals.application}`] + function parseArticleData(articleID) { + console.log('Parsing article data...', articleID) + const { sections, editors, public } = floGlobals.appObjects[articleID] + const generalData = floGlobals.generalData[`${articleID}_gd|${floGlobals.adminID}|${floGlobals.application}`] floGlobals.currentArticle['sections'] = {} sections.forEach(({ id, title }) => { floGlobals.currentArticle['sections'][id] = {