From 040669b06142e313be78d0d8b885729241b284a8 Mon Sep 17 00:00:00 2001 From: erikaperugachi Date: Fri, 26 Apr 2019 09:43:57 -0500 Subject: [PATCH 1/4] Fix mark as read/unread emails. Fix #864 --- email_mailbox/src/actions/emails.js | 10 ++++++---- email_mailbox/src/components/Email.js | 2 ++ email_mailbox/src/components/EmailActions.js | 8 +++++++- email_mailbox/src/components/HeaderThreadOptions.js | 4 ++-- .../src/components/HeaderThreadOptionsWrapper.js | 2 +- email_mailbox/src/components/settinggeneral.scss | 13 ++++++------- email_mailbox/src/containers/Email.js | 12 ++++++++++-- email_mailbox/src/containers/HeaderThreadOptions.js | 2 +- 8 files changed, 35 insertions(+), 18 deletions(-) diff --git a/email_mailbox/src/actions/emails.js b/email_mailbox/src/actions/emails.js index 973a0391e..b097286fd 100644 --- a/email_mailbox/src/actions/emails.js +++ b/email_mailbox/src/actions/emails.js @@ -16,7 +16,8 @@ import { addContacts, addFiles, unsendEmailFiles, - updateEmailIdsThread + updateEmailIdsThread, + updateThreadsSuccess } from './index'; import { EmailStatus, SocketCommand } from '../utils/const'; import { @@ -48,11 +49,11 @@ export const muteNotifications = emailId => { }; }; -export const markEmailUnreadSuccess = (emailId, unreadValue) => { +export const markEmailUnreadSuccess = (emailId, unread) => { return { type: Email.MARK_UNREAD, emailId, - unread: unreadValue + unread }; }; @@ -110,11 +111,12 @@ export const muteEmail = (emailId, valueToSet) => { }; }; -export const markEmailUnread = (emailId, valueToSet) => { +export const markEmailUnread = (labelId, threadId, emailId, valueToSet) => { return async dispatch => { try { await updateEmail({ id: emailId, unread: !!valueToSet }); dispatch(markEmailUnreadSuccess(emailId, valueToSet)); + dispatch(updateThreadsSuccess(labelId, [threadId], valueToSet)); } catch (e) { // To do } diff --git a/email_mailbox/src/components/Email.js b/email_mailbox/src/components/Email.js index abc37ce7f..25ad03dd3 100644 --- a/email_mailbox/src/components/Email.js +++ b/email_mailbox/src/components/Email.js @@ -170,6 +170,7 @@ const renderEmailInfoExpand = props => ( onReplyAll={props.onReplyAll} onForward={props.onForward} onMarkAsSpam={props.onMarkAsSpam} + onMarkUnread={props.onMarkUnread} onDelete={props.onDelete} onDeletePermanently={props.handleClickPermanentlyDeleteEmail} onToggleMenu={props.onTogglePopOverEmailActions} @@ -269,6 +270,7 @@ renderEmailInfoExpand.propTypes = { onDeletePermanently: PropTypes.func, onForward: PropTypes.func, onMarkAsSpam: PropTypes.func, + onMarkUnread: PropTypes.func, onOpenEmailSource: PropTypes.func, onPrintEmail: PropTypes.func, onReplyEmail: PropTypes.func, diff --git a/email_mailbox/src/components/EmailActions.js b/email_mailbox/src/components/EmailActions.js index 2a1ed196c..fd417ca63 100644 --- a/email_mailbox/src/components/EmailActions.js +++ b/email_mailbox/src/components/EmailActions.js @@ -51,7 +51,12 @@ const EmailActions = props => { )} -
  • +
  • { + props.onMarkUnread(ev); + props.onToggleMenu(ev); + }} + > {string.mailbox.mark_as_unread}
  • {!props.isSpam && ( @@ -95,6 +100,7 @@ EmailActions.propTypes = { onDeletePermanently: PropTypes.func, onForward: PropTypes.func, onMarkAsSpam: PropTypes.func, + onMarkUnread: PropTypes.func, onOpenEmailSource: PropTypes.func, onPrintEmail: PropTypes.func, onReplyAll: PropTypes.func, diff --git a/email_mailbox/src/components/HeaderThreadOptions.js b/email_mailbox/src/components/HeaderThreadOptions.js index b4da24c9d..187ffb6e2 100644 --- a/email_mailbox/src/components/HeaderThreadOptions.js +++ b/email_mailbox/src/components/HeaderThreadOptions.js @@ -95,8 +95,8 @@ class HeaderThreadOptions extends Component {
  • this.props.onClickMarkAsRead()}> {markAsUnread - ? string.mailbox.mark_as_read - : string.mailbox.mark_as_unread} + ? string.mailbox.mark_as_unread + : string.mailbox.mark_as_read}
  • {!this.props.itemsChecked && ( diff --git a/email_mailbox/src/components/HeaderThreadOptionsWrapper.js b/email_mailbox/src/components/HeaderThreadOptionsWrapper.js index 0ccc56999..3ac1a8f71 100644 --- a/email_mailbox/src/components/HeaderThreadOptionsWrapper.js +++ b/email_mailbox/src/components/HeaderThreadOptionsWrapper.js @@ -179,7 +179,7 @@ class HeaderThreadOptionsWrapper extends Component { () => { this.props.onMarkRead( this.props.threadsSelected, - !this.props.markAsUnread + this.props.markAsUnread ); } ); diff --git a/email_mailbox/src/components/settinggeneral.scss b/email_mailbox/src/components/settinggeneral.scss index 5f351dadb..6771fc36d 100644 --- a/email_mailbox/src/components/settinggeneral.scss +++ b/email_mailbox/src/components/settinggeneral.scss @@ -87,13 +87,12 @@ } #settings-general-usefullinks{ -.cptx-useful-link{ - color: #0091ff; - font-size: 13px; - font-weight: 400; - margin-top: 7px; - text-decoration: none; -} + .cptx-useful-link{ + color: #0091ff; + font-size: 13px; + font-weight: 400; + text-decoration: none; + } } /* THEME diff --git a/email_mailbox/src/containers/Email.js b/email_mailbox/src/containers/Email.js index 859c54fb5..1b301341a 100644 --- a/email_mailbox/src/containers/Email.js +++ b/email_mailbox/src/containers/Email.js @@ -19,10 +19,11 @@ import { checkFileDownloaded } from './../utils/ipc'; import { + markEmailUnread, + removeEmails, unsendEmail, updateEmailLabels, - updateEmailOnSuccess, - removeEmails + updateEmailOnSuccess } from './../actions/index'; import { EmailStatus, @@ -180,6 +181,13 @@ const mapDispatchToProps = (dispatch, ownProps) => { } }); }, + onMarkUnread: ev => { + ev.stopPropagation(); + const labelId = ownProps.mailboxSelected.id; + dispatch(markEmailUnread(labelId, email.threadId, email.id, true)).then( + () => ownProps.onBackOption() + ); + }, onOpenEmailSource: ev => { ev.stopPropagation(); sendOpenEmailSource(email.key); diff --git a/email_mailbox/src/containers/HeaderThreadOptions.js b/email_mailbox/src/containers/HeaderThreadOptions.js index 8e8b3c15d..52e2b6364 100644 --- a/email_mailbox/src/containers/HeaderThreadOptions.js +++ b/email_mailbox/src/containers/HeaderThreadOptions.js @@ -37,7 +37,7 @@ const makeMapStateToProps = () => { }); const labels = getLabelsIncluded(state, threadsLabelIds); const markAsUnread = ownProps.itemsChecked - ? shouldMarkAsUnread(threads, ownProps.itemsChecked) + ? !shouldMarkAsUnread(threads, ownProps.itemsChecked) : true; const allSelected = ownProps.itemsChecked ? threadIds.size === ownProps.itemsChecked.size From 328eb94fa0a83c2ad74a6d35291abc6ce3afc919 Mon Sep 17 00:00:00 2001 From: erikaperugachi Date: Fri, 26 Apr 2019 10:56:46 -0500 Subject: [PATCH 2/4] Fix update inbox draft. Close #866 --- email_mailbox/src/utils/electronEventInterface.js | 1 + 1 file changed, 1 insertion(+) diff --git a/email_mailbox/src/utils/electronEventInterface.js b/email_mailbox/src/utils/electronEventInterface.js index 242aa3c88..c4b9ad715 100644 --- a/email_mailbox/src/utils/electronEventInterface.js +++ b/email_mailbox/src/utils/electronEventInterface.js @@ -896,6 +896,7 @@ ipcRenderer.on( case 'draft-edited': { emitter.emit(Event.STORE_LOAD, { labelIds: [LabelType.sent.id, LabelType.draft.id], + badgeLabelIds: [LabelType.draft.id], threadIds: [threadId] }); break; From 488dc2bceabab0781bd42f835ad824836ec23b2d Mon Sep 17 00:00:00 2001 From: erikaperugachi Date: Fri, 26 Apr 2019 12:48:55 -0500 Subject: [PATCH 3/4] Show recipients name, as short view. Close #865 --- email_mailbox/src/components/Email.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/email_mailbox/src/components/Email.js b/email_mailbox/src/components/Email.js index 25ad03dd3..c903aff34 100644 --- a/email_mailbox/src/components/Email.js +++ b/email_mailbox/src/components/Email.js @@ -185,10 +185,14 @@ const renderEmailInfoExpand = props => ( ); const showContacts = contacts => { - return contacts.reduce( - (result, contact) => `${result} ${contact.name || contact.email}`, - '' - ); + return contacts.reduce((result, contact, index) => { + if (contacts.length > 1) { + const name = contact.name || contact.email; + const firstname = `${index !== 0 ? ', ' : ''}${name.split(' ')[0]}`; + return `${result}${firstname}`; + } + return `${result} ${contact.name || contact.email}`; + }, ''); }; const renderEmailStatus = status => { From e60579ec2ae6c5d8958caede6dd086de934bc814 Mon Sep 17 00:00:00 2001 From: erikaperugachi Date: Fri, 26 Apr 2019 15:08:21 -0500 Subject: [PATCH 4/4] Update version 0.17.15 --- electron_app/package.json | 2 +- email_mailbox/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/electron_app/package.json b/electron_app/package.json index ff811ddac..f64d21a33 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -1,6 +1,6 @@ { "name": "criptext", - "version": "0.17.14", + "version": "0.17.15", "author": { "name": "Criptext Inc", "email": "support@criptext.com", diff --git a/email_mailbox/package.json b/email_mailbox/package.json index af47338a4..a50ffacfc 100644 --- a/email_mailbox/package.json +++ b/email_mailbox/package.json @@ -1,6 +1,6 @@ { "name": "email_mailbox", - "version": "0.17.14", + "version": "0.17.15", "private": true, "dependencies": { "@criptext/electron-better-ipc": "^0.1.2-rc5",