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 { AttachmentModel, staticCombinedIconClass } from 'Model/Attachment';
import { AbstractModel } from 'Knoin/AbstractModel'; import { AbstractModel } from 'Knoin/AbstractModel';
const $ = jQuery; const $ = jQuery, isArray = Array.isArray;
class MessageModel extends AbstractModel { class MessageModel extends AbstractModel {
constructor() { constructor() {
@ -259,7 +259,7 @@ class MessageModel extends AbstractModel {
this.unsubsribeLinks = isNonEmptyArray(json.UnsubsribeLinks) ? json.UnsubsribeLinks : []; this.unsubsribeLinks = isNonEmptyArray(json.UnsubsribeLinks) ? json.UnsubsribeLinks : [];
this.subject(json.Subject); this.subject(json.Subject);
if (Array.isArray(json.SubjectParts)) { if (isArray(json.SubjectParts)) {
this.subjectPrefix(json.SubjectParts[0]); this.subjectPrefix(json.SubjectParts[0]);
this.subjectSuffix(json.SubjectParts[1]); this.subjectSuffix(json.SubjectParts[1]);
} else { } else {
@ -269,14 +269,14 @@ class MessageModel extends AbstractModel {
this.dateTimeStampInUTC(pInt(json.DateTimeStampInUTC)); this.dateTimeStampInUTC(pInt(json.DateTimeStampInUTC));
this.hasAttachments(!!json.HasAttachments); 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.fromEmailString(emailArrayToString(this.from, true));
this.fromClearEmailString(emailArrayToStringClear(this.from)); this.fromClearEmailString(emailArrayToStringClear(this.from));
this.toEmailsString(emailArrayToString(this.to, true)); this.toEmailsString(emailArrayToString(this.to, true));
this.toClearEmailsString(emailArrayToStringClear(this.to)); this.toClearEmailsString(emailArrayToStringClear(this.to));
this.threads(Array.isArray(json.Threads) ? json.Threads : []); this.threads(isArray(json.Threads) ? json.Threads : []);
this.initFlagsByJson(json); this.initFlagsByJson(json);
this.computeSenderEmail(); this.computeSenderEmail();
@ -315,9 +315,9 @@ class MessageModel extends AbstractModel {
} }
this.hasAttachments(!!json.HasAttachments); 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.attachments(this.initAttachmentsFromJson(json.Attachments));
this.readReceipt(json.ReadReceipt || ''); this.readReceipt(json.ReadReceipt || '');
@ -539,7 +539,7 @@ class MessageModel extends AbstractModel {
* @returns {string} * @returns {string}
*/ */
fromAsSingleEmail() { 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 { import {
delegateRunOnDestroy, delegateRunOnDestroy,
computedPagenatorHelper, computedPagenatorHelper,
trim,
isNonEmptyArray, isNonEmptyArray,
fakeMd5, fakeMd5,
pInt pInt
@ -42,6 +41,8 @@ import { getApp } from 'Helper/Apps/User';
import { popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin'; import { popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
import { AbstractViewNext } from 'Knoin/AbstractViewNext'; import { AbstractViewNext } from 'Knoin/AbstractViewNext';
const trim = text => null == text ? "" : (text + "").trim();
@popup({ @popup({
name: 'View/Popup/Contacts', name: 'View/Popup/Contacts',
templateID: 'PopupsContacts' templateID: 'PopupsContacts'

View file

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