Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RainLoop committed May 22, 2016
1 parent fcfd542 commit aeec36d
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 129 deletions.
123 changes: 0 additions & 123 deletions dev/Helper/Message.js

This file was deleted.

112 changes: 112 additions & 0 deletions dev/Helper/Message.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@

import Utils from 'Common/Utils';
import EmailModel from 'Model/Email';

class MessageHelper
{
constructor() {}

/**
* @param {Array.<EmailModel>} emails
* @param {boolean=} friendlyView = false
* @param {boolean=} wrapWithLink = false
* @return {string}
*/
emailArrayToString(emails, friendlyView = false, wrapWithLink = false) {

let
result = [],
index = 0,
len = 0
;

if (Utils.isNonEmptyArray(emails))
{
for (index = 0, len = emails.length; index < len; index++)
{
result.push(emails[index].toLine(friendlyView, wrapWithLink));
}
}

return result.join(', ');
}

/**
* @param {Array.<EmailModel>} emails
* @return {string}
*/
emailArrayToStringClear(emails) {

let
result = [],
index = 0,
len = 0
;

if (Utils.isNonEmptyArray(emails))
{
for (index = 0, len = emails.length; index < len; index++)
{
if (emails[index] && emails[index].email && '' !== emails[index].name)
{
result.push(emails[index].email);
}
}
}

return result.join(', ');
}

/**
* @param {?Array} json
* @return {Array.<EmailModel>}
*/
emailArrayFromJson(json) {

let
index = 0,
len = 0,
email = null,
result = []
;

if (Utils.isNonEmptyArray(json))
{
for (index = 0, len = json.length; index < len; index++)
{
email = EmailModel.newInstanceFromJson(json[index]);
if (email)
{
result.push(email);
}
}
}

return result;
}

/**
* @param {Array.<EmailModel>} inputEmails
* @param {Object} unic
* @param {Array} localEmails
*/
replyHelper(inputEmails, unic, localEmails) {

if (inputEmails && 0 < inputEmails.length)
{
let index = 0;
const len = inputEmails.length;

for (; index < len; index++)
{
if (Utils.isUnd(unic[inputEmails[index].email]))
{
unic[inputEmails[index].email] = true;
localEmails.push(inputEmails[index]);
}
}
}
}
}

export default new MessageHelper();
2 changes: 1 addition & 1 deletion dev/Model/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

AttachmentModel = require('Model/Attachment'),

MessageHelper = require('Helper/Message'),
MessageHelper = require('Helper/Message').default,

AbstractModel = require('Knoin/AbstractModel')
;
Expand Down
2 changes: 1 addition & 1 deletion dev/Model/MessageFull.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),

// MessageHelper = require('Helper/Message'),
// MessageHelper = require('Helper/Message').default,

MessageSimpleModel = require('Model/MessageSimple')
;
Expand Down
2 changes: 1 addition & 1 deletion dev/Model/MessageSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Utils = require('Common/Utils'),

MessageHelper = require('Helper/Message'),
MessageHelper = require('Helper/Message').default,

AbstractModel = require('Knoin/AbstractModel')
;
Expand Down
2 changes: 1 addition & 1 deletion dev/Stores/User/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Remote = require('Remote/User/Ajax'),

MessageModel = require('Model/Message'),
MessageHelper = require('Helper/Message')
MessageHelper = require('Helper/Message').default
;

/**
Expand Down
9 changes: 7 additions & 2 deletions rainloop/v/0.0.0/app/libraries/MailSo/Imap/ImapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -995,8 +995,13 @@ public function FolderExamine($sFolderName, $bReSelectSameFolders = false)
*/
public function FolderUnSelect()
{
return $this->IsSelected() && $this->IsSupported('UNSELECT') ?
$this->SendRequestWithCheck('UNSELECT') : $this;
if ($this->IsSelected() && $this->IsSupported('UNSELECT'))
{
$this->SendRequestWithCheck('UNSELECT');
$this->bIsSelected = false;
}

return $this;
}

/**
Expand Down

0 comments on commit aeec36d

Please sign in to comment.