diff --git a/nodejs/app.js b/nodejs/app.js
index a4ff4de1..f3830416 100644
--- a/nodejs/app.js
+++ b/nodejs/app.js
@@ -32,12 +32,12 @@ function bytesToBase64(bytes) {
}
// convert unicode string to base64 encoded ascii
-function utoa(str) {
+function uniTob64(str) {
return bytesToBase64(new TextEncoder().encode(str))
}
// convert base64 encoded ascii to unicode string
-function atou(bytes) {
+function b64ToUni(bytes) {
return new TextDecoder().decode(base64ToBytes(bytes))
}
@@ -98,9 +98,9 @@ function mkHtml(dbName, eventType, value, event, doc) {
}
switch (eventType) {
case "acceptanceEvent":
- return mkHeader() + `
The acceptance criteria changed from:
${replaceEmpty(atou(value[0]))}
to ${replaceEmpty(atou(value[1]))}
` + mkFooter()
+ return mkHeader() + `The acceptance criteria changed from:
${replaceEmpty(b64ToUni(value[0]))}
to ${replaceEmpty(b64ToUni(value[1]))}
` + mkFooter()
case "addCommentEvent":
- return mkHeader() + `The user added a comment:
${replaceEmpty(atou(value[0]))}
` + mkFooter()
+ return mkHeader() + `The user added a comment:
${replaceEmpty(b64ToUni(value[0]))}
` + mkFooter()
case "addSprintIdsEvent":
{
let txt = `This ${getLevelText(dbName, value[0], value[1])} is assigned to sprint '${value[2]}'.`
@@ -110,7 +110,7 @@ function mkHtml(dbName, eventType, value, event, doc) {
case "cloneEvent":
return mkHeader() + `This ${getLevelText(dbName, value[0], value[1])} has been cloned as item of product '${value[2]}'.
` + mkFooter()
case "commentToHistoryEvent":
- return mkHeader() + `The user added comment:
${replaceEmpty(atou(value[0]))}
to the history of this item
` + mkFooter()
+ return mkHeader() + `The user added comment:
${replaceEmpty(b64ToUni(value[0]))}
to the history of this item
` + mkFooter()
case "conditionRemovedEvent":
{
let s
@@ -128,7 +128,7 @@ function mkHtml(dbName, eventType, value, event, doc) {
return mkHeader() + `${s}
` + + mkFooter()
}
case "descriptionEvent":
- return mkHeader() + `The description changed from:
${replaceEmpty(atou(value[0]))}
to ${replaceEmpty(atou(value[1]))}
` + mkFooter()
+ return mkHeader() + `The description changed from:
${replaceEmpty(b64ToUni(value[0]))}
to ${replaceEmpty(b64ToUni(value[1]))}
` + mkFooter()
case "undoBranchRemovalEvent":
return mkHeader() + `The ${this.getLevelText(value[9], value[10])} with title '${value[11]}' and ${value[1]} descendants are restored from removal.
` + mkFooter()
case "newChildEvent":
@@ -157,7 +157,7 @@ function mkHtml(dbName, eventType, value, event, doc) {
case "removeStoryEvent":
return mkHeader() + `This ${getLevelText(dbName, value[0], value[1])} is removed from sprint '${value[2]}
` + mkFooter()
case "replaceCommentEvent":
- return mkHeader() + `The user changed his last comment:
${replaceEmpty(atou(value[0]))}
` + mkFooter()
+ return mkHeader() + `The user changed his last comment:
${replaceEmpty(b64ToUni(value[0]))}
` + mkFooter()
case "setConditionEvent":
if (value[2]) return mkHeader() + `The previous condition set for item '${value[1]} is undone'.
` + mkFooter()
return mkHeader() + `This item is set to be conditional for item '${value[1]}'.
` + mkFooter()
diff --git a/src/common_functions.js b/src/common_functions.js
index c9b75898..736202f6 100644
--- a/src/common_functions.js
+++ b/src/common_functions.js
@@ -20,12 +20,12 @@ function bytesToBase64(bytes) {
}
// convert unicode string to base64 encoded ascii
-export function utoa(str) {
+export function uniTob64(str) {
return bytesToBase64(new TextEncoder().encode(str))
}
// convert base64 encoded ascii to unicode string
-export function atou(bytes) {
+export function b64ToUni(bytes) {
return new TextDecoder().decode(base64ToBytes(bytes))
}
@@ -185,4 +185,4 @@ export function isValidEmail(email) {
return re.test(email)
}
-export default { utoa, atou, expandNode, collapseNode, showNode, hideNode, addToArray, createId, createLoadEventText, dedup, getLocationInfo, getSprintById, getSprintNameById, localTimeAndMilis, removeFromArray, isValidEmail }
+export default { uniTob64, b64ToUni, expandNode, collapseNode, showNode, hideNode, addToArray, createId, createLoadEventText, dedup, getLocationInfo, getSprintById, getSprintNameById, localTimeAndMilis, removeFromArray, isValidEmail }
diff --git a/src/components/views/common_context.js b/src/components/views/common_context.js
index 3627db3f..5a0b46c9 100644
--- a/src/components/views/common_context.js
+++ b/src/components/views/common_context.js
@@ -1,5 +1,5 @@
import { SEV, STATE, MISC } from '../../constants.js'
-import { utoa, createId } from '../../common_functions.js'
+import { uniTob64, createId } from '../../common_functions.js'
import { authorization, utilities } from '../mixins/generic.js'
import store from '../../store/store.js'
@@ -157,8 +157,8 @@ const methods = {
conditionalFor: [],
title: newNode.title,
followers: [],
- description: utoa(currentDoc.description),
- acceptanceCriteria: utoa(currentDoc.acceptanceCriteria),
+ description: uniTob64(currentDoc.description),
+ acceptanceCriteria: uniTob64(currentDoc.acceptanceCriteria),
priority: newNode.data.priority,
comments: [{
ignoreEvent: 'comments initiated',
@@ -267,8 +267,8 @@ const methods = {
conditionalFor: [],
title: newNode.title,
followers: newNode.data.followers,
- description: utoa(''),
- acceptanceCriteria: newNode.level < this.TASKLEVEL ? utoa('Please do not neglect
') : utoa('See the acceptance criteria of the story/spike/defect.
'),
+ description: uniTob64(''),
+ acceptanceCriteria: newNode.level < this.TASKLEVEL ? uniTob64('Please do not neglect
') : uniTob64('See the acceptance criteria of the story/spike/defect.
'),
priority: newNode.data.priority,
comments: [{
ignoreEvent: 'comments initiated',
diff --git a/src/components/views/common_listings.js b/src/components/views/common_listings.js
index 5940e0d0..b165d6a2 100644
--- a/src/components/views/common_listings.js
+++ b/src/components/views/common_listings.js
@@ -1,5 +1,5 @@
import { utilities } from '../mixins/generic.js'
-import { atou } from '../../common_functions.js'
+import { b64ToUni } from '../../common_functions.js'
import store from '../../store/store.js'
@@ -203,7 +203,7 @@ const methods = {
/* Presentation methods */
mkAcceptanceEvent(value) {
- return 'The acceptance criteria of the item have changed:(from/to)
' + replaceEmpty(atou(value[0])) + '
' + replaceEmpty(atou(value[1]))
+ return 'The acceptance criteria of the item have changed:(from/to)
' + replaceEmpty(b64ToUni(value[0])) + '
' + replaceEmpty(b64ToUni(value[1]))
},
mkAddSprintIdsEvent(value) {
@@ -221,7 +221,7 @@ const methods = {
},
mkCommentToHistoryEvent(value) {
- return replaceEmpty(atou(value[0]))
+ return replaceEmpty(b64ToUni(value[0]))
},
mkConditionRemovedEvent(value) {
@@ -249,7 +249,7 @@ const methods = {
},
mkDescriptionEvent(value) {
- return 'The description of the item has changed:(from/to)
' + replaceEmpty(atou(value[0])) + '
' + replaceEmpty(atou(value[1]))
+ return 'The description of the item has changed:(from/to)
' + replaceEmpty(b64ToUni(value[0])) + '
' + replaceEmpty(b64ToUni(value[1]))
},
mkImportToSprintEvent(value) {
@@ -369,7 +369,7 @@ const methods = {
},
mkComment(value) {
- return replaceEmpty(atou(value[0]))
+ return replaceEmpty(b64ToUni(value[0]))
},
mkResetCommentsEvent(value) {
@@ -413,13 +413,13 @@ const methods = {
startEditMyComment(comment) {
this.commentObjToBeReplaced = comment
- this.myLastCommentText = atou(this.getEventValue(comment))
+ this.myLastCommentText = b64ToUni(this.getEventValue(comment))
this.editMyComment = true
},
startEditMyHistComment(comment) {
this.commentObjToBeReplaced = comment
- this.myLastHistCommentText = atou(this.getEventValue(comment))
+ this.myLastHistCommentText = b64ToUni(this.getEventValue(comment))
this.editMyHistComment = true
},
diff --git a/src/store/modules/sync.js b/src/store/modules/sync.js
index 795557e1..f58233a5 100644
--- a/src/store/modules/sync.js
+++ b/src/store/modules/sync.js
@@ -1,5 +1,5 @@
import { SEV, LEVEL, MISC } from '../../constants.js'
-import { atou, getLocationInfo } from '../../common_functions.js'
+import { b64ToUni, getLocationInfo } from '../../common_functions.js'
import globalAxios from 'axios'
var lastSeq = undefined
const SPECIAL_TEXT = true
@@ -243,7 +243,7 @@ const actions = {
}
break
case 'descriptionEvent':
- commit('updateNodesAndCurrentDoc', { node, description: atou(doc.description), lastContentChange: doc.lastContentChange })
+ commit('updateNodesAndCurrentDoc', { node, description: b64ToUni(doc.description), lastContentChange: doc.lastContentChange })
showSyncMessage(`changed the description of`, SEV.INFO)
break
case 'nodeMovedEvent':
@@ -279,7 +279,7 @@ const actions = {
// process events for non requirement area items
switch (histEvent) {
case 'acceptanceEvent':
- commit('updateNodesAndCurrentDoc', { node, acceptanceCriteria: atou(doc.acceptanceCriteria), lastContentChange: doc.lastContentChange })
+ commit('updateNodesAndCurrentDoc', { node, acceptanceCriteria: b64ToUni(doc.acceptanceCriteria), lastContentChange: doc.lastContentChange })
showSyncMessage(`changed the acceptance criteria for`, SEV.INFO)
break
case 'addSprintIdsEvent':
@@ -312,7 +312,7 @@ const actions = {
showSyncMessage(`removed a condition for`, SEV.INFO)
break
case 'descriptionEvent':
- commit('updateNodesAndCurrentDoc', { node, description: atou(doc.description), lastContentChange: doc.lastContentChange })
+ commit('updateNodesAndCurrentDoc', { node, description: b64ToUni(doc.description), lastContentChange: doc.lastContentChange })
showSyncMessage(`changed the description of`, SEV.INFO)
break
case 'itemToNewTeamEvent':
diff --git a/src/store/modules/update.js b/src/store/modules/update.js
index 7343b3f4..9e526cd7 100644
--- a/src/store/modules/update.js
+++ b/src/store/modules/update.js
@@ -1,5 +1,5 @@
import { SEV, STATE, LEVEL } from '../../constants.js'
-import { utoa, atou } from '../../common_functions.js'
+import { uniTob64, b64ToUni } from '../../common_functions.js'
import globalAxios from 'axios'
// IMPORTANT: all updates on the backlogitem documents must add history in order for the changes feed to work properly (if omitted the previous event will be processed again)
// Save the history, to trigger the distribution to other online users, when all other database updates are done.
@@ -720,9 +720,9 @@ const actions = {
}).then(res => {
const tmpDoc = res.data
// decode from base64
- const oldDescription = atou(tmpDoc.description)
+ const oldDescription = b64ToUni(tmpDoc.description)
// encode to base64
- const newEncodedDescription = utoa(payload.newDescription)
+ const newEncodedDescription = uniTob64(payload.newDescription)
const newHist = {
descriptionEvent: [tmpDoc.description, newEncodedDescription],
by: rootState.userData.user,
@@ -784,9 +784,9 @@ const actions = {
}).then(res => {
const tmpDoc = res.data
// decode from base64
- const oldAcceptance = atou(tmpDoc.acceptanceCriteria)
+ const oldAcceptance = b64ToUni(tmpDoc.acceptanceCriteria)
// encode to base64
- const newEncodedAcceptance = utoa(payload.newAcceptance)
+ const newEncodedAcceptance = uniTob64(payload.newAcceptance)
const newHist = {
acceptanceEvent: [tmpDoc.acceptanceCriteria, newEncodedAcceptance],
by: rootState.userData.user,
@@ -847,7 +847,7 @@ const actions = {
}).then((res) => {
const tmpDoc = res.data
const newComment = {
- addCommentEvent: [utoa(payload.comment)],
+ addCommentEvent: [uniTob64(payload.comment)],
by: rootState.userData.user,
email: rootState.userData.email,
timestamp: Date.now(),
@@ -857,7 +857,7 @@ const actions = {
tmpDoc.lastChange = payload.timestamp
const newHist = {
- addCommentEvent: [utoa(payload.comment)],
+ addCommentEvent: [uniTob64(payload.comment)],
by: rootState.userData.user,
email: rootState.userData.email,
timestamp: Date.now(),
@@ -897,7 +897,7 @@ const actions = {
for (let i = 0; i < tmpDoc.comments.length; i++) {
const uneditedCommentObj = tmpDoc.comments[i]
if (Object.keys(uneditedCommentObj)[0] === 'addCommentEvent' && uneditedCommentObj.timestamp === payload.commentObjToBeReplaced.timestamp) {
- tmpDoc.comments[i].addCommentEvent = [utoa(payload.editedCommentText)]
+ tmpDoc.comments[i].addCommentEvent = [uniTob64(payload.editedCommentText)]
tmpDoc.comments[i].timestamp = Date.now()
couldReplace = true
break
@@ -905,7 +905,7 @@ const actions = {
}
if (couldReplace) {
const newHist = {
- replaceCommentEvent: [utoa(payload.editedCommentText)],
+ replaceCommentEvent: [uniTob64(payload.editedCommentText)],
by: rootState.userData.user,
email: rootState.userData.email,
timestamp: Date.now(),
@@ -954,7 +954,7 @@ const actions = {
if (Object.keys(tmpDoc.history[i])[0] === 'commentToHistoryEvent') {
const uneditedCommentObj = tmpDoc.history[i]
if (uneditedCommentObj.timestamp === payload.commentObjToBeReplaced.timestamp) {
- tmpDoc.history[i].commentToHistoryEvent = [utoa(payload.editedCommentText)]
+ tmpDoc.history[i].commentToHistoryEvent = [uniTob64(payload.editedCommentText)]
tmpDoc.history[i].timestamp = Date.now()
couldReplace = true
break
@@ -998,7 +998,7 @@ const actions = {
}).then(res => {
const tmpDoc = res.data
const newHist = {
- commentToHistoryEvent: [utoa(payload.comment)],
+ commentToHistoryEvent: [uniTob64(payload.comment)],
by: rootState.userData.user,
email: rootState.userData.email,
timestamp: Date.now(),
diff --git a/src/store/store.js b/src/store/store.js
index 07264ea8..8542da29 100644
--- a/src/store/store.js
+++ b/src/store/store.js
@@ -1,6 +1,6 @@
import { createStore } from 'vuex'
import globalAxios from 'axios'
-import { atou, expandNode, collapseNode, addToArray, removeFromArray } from '../common_functions.js'
+import { b64ToUni, expandNode, collapseNode, addToArray, removeFromArray } from '../common_functions.js'
// IMPORTANT: all updates on the backlogitem documents must add history in order for the changes feed to work properly (if omitted the previous event will be processed again)
// Save the history, to trigger the distribution to other online users, when all other database updates are done.
import { SEV, LEVEL, MISC } from '../constants.js'
@@ -896,8 +896,8 @@ const store = createStore({
if (payload.newDoc) {
// decode from base64 + replace the encoded data
- payload.newDoc.description = atou(payload.newDoc.description)
- payload.newDoc.acceptanceCriteria = atou(payload.newDoc.acceptanceCriteria)
+ payload.newDoc.description = b64ToUni(payload.newDoc.description)
+ payload.newDoc.acceptanceCriteria = b64ToUni(payload.newDoc.acceptanceCriteria)
// replace the currently loaded document
state.currentDoc = cleanHistory(payload.newDoc)
}