Bugfix: Contacts.js trim() missing

Bugfix: ClearCookie failed
This commit is contained in:
djmaze 2020-08-22 01:05:43 +02:00
parent d88855ebd9
commit b185402ae7
3 changed files with 19 additions and 12 deletions

View file

@ -20,7 +20,7 @@ import { emailArrayFromJson, emailArrayToStringClear, emailArrayToString, replyH
import { AttachmentModel, staticCombinedIconClass } from 'Model/Attachment';
import { AbstractModel } from 'Knoin/AbstractModel';
const $ = jQuery;
const $ = jQuery, isArray = Array.isArray;
class MessageModel extends AbstractModel {
constructor() {
@ -259,7 +259,7 @@ class MessageModel extends AbstractModel {
this.unsubsribeLinks = isNonEmptyArray(json.UnsubsribeLinks) ? json.UnsubsribeLinks : [];
this.subject(json.Subject);
if (Array.isArray(json.SubjectParts)) {
if (isArray(json.SubjectParts)) {
this.subjectPrefix(json.SubjectParts[0]);
this.subjectSuffix(json.SubjectParts[1]);
} else {
@ -269,14 +269,14 @@ class MessageModel extends AbstractModel {
this.dateTimeStampInUTC(pInt(json.DateTimeStampInUTC));
this.hasAttachments(!!json.HasAttachments);
this.attachmentsSpecData(Array.isArray(json.AttachmentsSpecData) ? json.AttachmentsSpecData : []);
this.attachmentsSpecData(isArray(json.AttachmentsSpecData) ? json.AttachmentsSpecData : []);
this.fromEmailString(emailArrayToString(this.from, true));
this.fromClearEmailString(emailArrayToStringClear(this.from));
this.toEmailsString(emailArrayToString(this.to, true));
this.toClearEmailsString(emailArrayToStringClear(this.to));
this.threads(Array.isArray(json.Threads) ? json.Threads : []);
this.threads(isArray(json.Threads) ? json.Threads : []);
this.initFlagsByJson(json);
this.computeSenderEmail();
@ -315,9 +315,9 @@ class MessageModel extends AbstractModel {
}
this.hasAttachments(!!json.HasAttachments);
this.attachmentsSpecData(Array.isArray(json.AttachmentsSpecData) ? json.AttachmentsSpecData : []);
this.attachmentsSpecData(isArray(json.AttachmentsSpecData) ? json.AttachmentsSpecData : []);
this.foundedCIDs = Array.isArray(json.FoundedCIDs) ? json.FoundedCIDs : [];
this.foundedCIDs = isArray(json.FoundedCIDs) ? json.FoundedCIDs : [];
this.attachments(this.initAttachmentsFromJson(json.Attachments));
this.readReceipt(json.ReadReceipt || '');
@ -539,7 +539,7 @@ class MessageModel extends AbstractModel {
* @returns {string}
*/
fromAsSingleEmail() {
return Array.isArray(this.from) && this.from[0] ? this.from[0].email : '';
return isArray(this.from) && this.from[0] ? this.from[0].email : '';
}
/**

View file

@ -13,7 +13,6 @@ import {
import {
delegateRunOnDestroy,
computedPagenatorHelper,
trim,
isNonEmptyArray,
fakeMd5,
pInt
@ -42,6 +41,8 @@ import { getApp } from 'Helper/Apps/User';
import { popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const trim = text => null == text ? "" : (text + "").trim();
@popup({
name: 'View/Popup/Contacts',
templateID: 'PopupsContacts'

View file

@ -378,7 +378,7 @@ class Utils
if (null === $sPath)
{
$sPath = static::$CookieDefaultPath;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : '/';
}
if (null === $bSecure)
@ -390,7 +390,7 @@ class Utils
\setcookie($sName, $sValue, array(
'expires' => $iExpire,
'path' => $sPath,
'domain' => $sDomain,
// 'domain' => $sDomain,
'secure' => $bSecure,
'httponly' => $bHttpOnly,
'samesite' => 'Strict'
@ -405,10 +405,16 @@ class Utils
}
$sPath = static::$CookieDefaultPath;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
unset(static::$Cookies[$sName]);
\setcookie($sName, '', \time() - 3600 * 24 * 30, $sPath);
\setcookie($sName, '', array(
'expires' => \time() - 3600 * 24 * 30,
'path' => $sPath && 0 < \strlen($sPath) ? $sPath : '/',
// 'domain' => null,
'secure' => static::$CookieDefaultSecure,
'httponly' => true,
'samesite' => 'Strict'
));
}
public static function UrlEncode(string $sV, bool $bEncode = false) : string