Skip to content
Merged

Fixes #867

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion electron_app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "criptext",
"version": "0.17.14",
"version": "0.17.15",
"author": {
"name": "Criptext Inc",
"email": "support@criptext.com",
Expand Down
2 changes: 1 addition & 1 deletion email_mailbox/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 6 additions & 4 deletions email_mailbox/src/actions/emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
addContacts,
addFiles,
unsendEmailFiles,
updateEmailIdsThread
updateEmailIdsThread,
updateThreadsSuccess
} from './index';
import { EmailStatus, SocketCommand } from '../utils/const';
import {
Expand Down Expand Up @@ -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
};
};

Expand Down Expand Up @@ -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
}
Expand Down
14 changes: 10 additions & 4 deletions email_mailbox/src/components/Email.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -184,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 => {
Expand Down Expand Up @@ -269,6 +274,7 @@ renderEmailInfoExpand.propTypes = {
onDeletePermanently: PropTypes.func,
onForward: PropTypes.func,
onMarkAsSpam: PropTypes.func,
onMarkUnread: PropTypes.func,
onOpenEmailSource: PropTypes.func,
onPrintEmail: PropTypes.func,
onReplyEmail: PropTypes.func,
Expand Down
8 changes: 7 additions & 1 deletion email_mailbox/src/components/EmailActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ const EmailActions = props => {
</li>
)}

<li>
<li
onClick={ev => {
props.onMarkUnread(ev);
props.onToggleMenu(ev);
}}
>
<span>{string.mailbox.mark_as_unread}</span>
</li>
{!props.isSpam && (
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions email_mailbox/src/components/HeaderThreadOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ class HeaderThreadOptions extends Component {
<li onClick={() => this.props.onClickMarkAsRead()}>
<span>
{markAsUnread
? string.mailbox.mark_as_read
: string.mailbox.mark_as_unread}
? string.mailbox.mark_as_unread
: string.mailbox.mark_as_read}
</span>
</li>
{!this.props.itemsChecked && (
Expand Down
2 changes: 1 addition & 1 deletion email_mailbox/src/components/HeaderThreadOptionsWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class HeaderThreadOptionsWrapper extends Component {
() => {
this.props.onMarkRead(
this.props.threadsSelected,
!this.props.markAsUnread
this.props.markAsUnread
);
}
);
Expand Down
13 changes: 6 additions & 7 deletions email_mailbox/src/components/settinggeneral.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions email_mailbox/src/containers/Email.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import {
checkFileDownloaded
} from './../utils/ipc';
import {
markEmailUnread,
removeEmails,
unsendEmail,
updateEmailLabels,
updateEmailOnSuccess,
removeEmails
updateEmailOnSuccess
} from './../actions/index';
import {
EmailStatus,
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion email_mailbox/src/containers/HeaderThreadOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions email_mailbox/src/utils/electronEventInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down