This commit is contained in:
sairaj mote 2022-07-19 16:59:26 +05:30
parent 15d4c69c3a
commit 8730afbbbe

View File

@ -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] = {