[Calendar] Enlever les logs
This commit is contained in:
parent
fac424b1bf
commit
843c7b8d35
@ -141,11 +141,31 @@ const setCustomKeyValuesArrayToIcsAndReturnIcs = (ics, keyValueArray) => {
|
|||||||
return ics;
|
return ics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const escapeICSField = (value) => {
|
||||||
|
return value
|
||||||
|
.replace(/\\/g, '\\\\')
|
||||||
|
.replace(/\n/g, '\\n')
|
||||||
|
.replace(/,/g, '\\,')
|
||||||
|
.replace(/;/g, '\\;');
|
||||||
|
}
|
||||||
|
|
||||||
|
const foldICSLines = (line) => {
|
||||||
|
const folded = [];
|
||||||
|
while (line.length > 75) {
|
||||||
|
folded.push(line.slice(0, 75));
|
||||||
|
line = ' ' + line.slice(75); // continuation line starts with a space
|
||||||
|
}
|
||||||
|
folded.push(line);
|
||||||
|
return folded.join('\r\n');
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getDefaultCalendarObjectObject,
|
getDefaultCalendarObjectObject,
|
||||||
mapCDavObjectToCalendarObject,
|
mapCDavObjectToCalendarObject,
|
||||||
mapCalendarJsToCalendarObject,
|
mapCalendarJsToCalendarObject,
|
||||||
setCustomKeyValuesArrayToIcsAndReturnIcs,
|
setCustomKeyValuesArrayToIcsAndReturnIcs,
|
||||||
getKeyValueIcsProperty,
|
getKeyValueIcsProperty,
|
||||||
setCustomKeyValueToIcsAndReturnIcs
|
setCustomKeyValueToIcsAndReturnIcs,
|
||||||
|
escapeICSField,
|
||||||
|
foldICSLines,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { mapCalendarJsToCalendarObject, setClientValueToIcsAndReturnIcs, setCustomKeyValuesArrayToIcsAndReturnIcs } from '../models/calendarObject.js'
|
import { mapCalendarJsToCalendarObject, setClientValueToIcsAndReturnIcs, setCustomKeyValuesArrayToIcsAndReturnIcs, foldICSLines, escapeICSField } from '../models/calendarObject.js'
|
||||||
import logger from '../utils/logger.js'
|
import logger from '../utils/logger.js'
|
||||||
import {
|
import {
|
||||||
createEvent,
|
createEvent,
|
||||||
@ -227,6 +227,7 @@ const actions = {
|
|||||||
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
|
let eventComponent = calendarObject.calendarComponent.getFirstComponent('VEVENT');
|
||||||
if (calendarObject.existsOnServer) {
|
if (calendarObject.existsOnServer) {
|
||||||
let icsValue = calendarObject.calendarComponent.toICS();
|
let icsValue = calendarObject.calendarComponent.toICS();
|
||||||
|
|
||||||
if(eventComponent != null){
|
if(eventComponent != null){
|
||||||
if(eventComponent.client != null){
|
if(eventComponent.client != null){
|
||||||
let newClientKeyValue = "CLIENT:"+eventComponent.client;
|
let newClientKeyValue = "CLIENT:"+eventComponent.client;
|
||||||
@ -246,14 +247,18 @@ const actions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(eventComponent.comment != null){
|
if(eventComponent.comment != null){
|
||||||
let newCommentKeyValue = "COMMENT:"+eventComponent.comment;
|
const escapedComment = escapeICSField(eventComponent.comment)
|
||||||
let regex = /COMMENT:[^\s]+/;
|
const foldedComment = foldICSLines(escapedComment)
|
||||||
|
|
||||||
|
let newCommentKeyValue = "COMMENT:"+foldedComment;
|
||||||
|
//let regex = /COMMENT:[^\s]+/;
|
||||||
|
let regex = /^COMMENT:.*$/m;
|
||||||
if(regex.test(icsValue)){
|
if(regex.test(icsValue)){
|
||||||
icsValue = icsValue.replace(regex, newCommentKeyValue);
|
icsValue = icsValue.replace(regex, newCommentKeyValue);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const customKeyValue = {
|
const customKeyValue = {
|
||||||
"COMMENT": eventComponent.comment
|
"COMMENT": foldedComment
|
||||||
};
|
};
|
||||||
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
icsValue = setCustomKeyValuesArrayToIcsAndReturnIcs(icsValue,customKeyValue);
|
||||||
}
|
}
|
||||||
@ -304,6 +309,7 @@ const actions = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calendarObject.dav.data = icsValue;
|
calendarObject.dav.data = icsValue;
|
||||||
await calendarObject.dav.update()
|
await calendarObject.dav.update()
|
||||||
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
|
context.commit('addCalendarObjectIdToAllTimeRangesOfCalendar', {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user