Skip to content

Commit 7ce1b9a

Browse files
author
Erika Perugachi
authored
Merge pull request #867 from erikaperugachi/ui
Fixes
2 parents 96e16ca + e60579e commit 7ce1b9a

File tree

11 files changed

+46
-24
lines changed

11 files changed

+46
-24
lines changed

electron_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "criptext",
3-
"version": "0.17.14",
3+
"version": "0.17.15",
44
"author": {
55
"name": "Criptext Inc",
66
"email": "[email protected]",

email_mailbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "email_mailbox",
3-
"version": "0.17.14",
3+
"version": "0.17.15",
44
"private": true,
55
"dependencies": {
66
"@criptext/electron-better-ipc": "^0.1.2-rc5",

email_mailbox/src/actions/emails.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import {
1616
addContacts,
1717
addFiles,
1818
unsendEmailFiles,
19-
updateEmailIdsThread
19+
updateEmailIdsThread,
20+
updateThreadsSuccess
2021
} from './index';
2122
import { EmailStatus, SocketCommand } from '../utils/const';
2223
import {
@@ -48,11 +49,11 @@ export const muteNotifications = emailId => {
4849
};
4950
};
5051

51-
export const markEmailUnreadSuccess = (emailId, unreadValue) => {
52+
export const markEmailUnreadSuccess = (emailId, unread) => {
5253
return {
5354
type: Email.MARK_UNREAD,
5455
emailId,
55-
unread: unreadValue
56+
unread
5657
};
5758
};
5859

@@ -110,11 +111,12 @@ export const muteEmail = (emailId, valueToSet) => {
110111
};
111112
};
112113

113-
export const markEmailUnread = (emailId, valueToSet) => {
114+
export const markEmailUnread = (labelId, threadId, emailId, valueToSet) => {
114115
return async dispatch => {
115116
try {
116117
await updateEmail({ id: emailId, unread: !!valueToSet });
117118
dispatch(markEmailUnreadSuccess(emailId, valueToSet));
119+
dispatch(updateThreadsSuccess(labelId, [threadId], valueToSet));
118120
} catch (e) {
119121
// To do
120122
}

email_mailbox/src/components/Email.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ const renderEmailInfoExpand = props => (
170170
onReplyAll={props.onReplyAll}
171171
onForward={props.onForward}
172172
onMarkAsSpam={props.onMarkAsSpam}
173+
onMarkUnread={props.onMarkUnread}
173174
onDelete={props.onDelete}
174175
onDeletePermanently={props.handleClickPermanentlyDeleteEmail}
175176
onToggleMenu={props.onTogglePopOverEmailActions}
@@ -184,10 +185,14 @@ const renderEmailInfoExpand = props => (
184185
);
185186

186187
const showContacts = contacts => {
187-
return contacts.reduce(
188-
(result, contact) => `${result} ${contact.name || contact.email}`,
189-
''
190-
);
188+
return contacts.reduce((result, contact, index) => {
189+
if (contacts.length > 1) {
190+
const name = contact.name || contact.email;
191+
const firstname = `${index !== 0 ? ', ' : ''}${name.split(' ')[0]}`;
192+
return `${result}${firstname}`;
193+
}
194+
return `${result} ${contact.name || contact.email}`;
195+
}, '');
191196
};
192197

193198
const renderEmailStatus = status => {
@@ -269,6 +274,7 @@ renderEmailInfoExpand.propTypes = {
269274
onDeletePermanently: PropTypes.func,
270275
onForward: PropTypes.func,
271276
onMarkAsSpam: PropTypes.func,
277+
onMarkUnread: PropTypes.func,
272278
onOpenEmailSource: PropTypes.func,
273279
onPrintEmail: PropTypes.func,
274280
onReplyEmail: PropTypes.func,

email_mailbox/src/components/EmailActions.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ const EmailActions = props => {
5151
</li>
5252
)}
5353

54-
<li>
54+
<li
55+
onClick={ev => {
56+
props.onMarkUnread(ev);
57+
props.onToggleMenu(ev);
58+
}}
59+
>
5560
<span>{string.mailbox.mark_as_unread}</span>
5661
</li>
5762
{!props.isSpam && (
@@ -95,6 +100,7 @@ EmailActions.propTypes = {
95100
onDeletePermanently: PropTypes.func,
96101
onForward: PropTypes.func,
97102
onMarkAsSpam: PropTypes.func,
103+
onMarkUnread: PropTypes.func,
98104
onOpenEmailSource: PropTypes.func,
99105
onPrintEmail: PropTypes.func,
100106
onReplyAll: PropTypes.func,

email_mailbox/src/components/HeaderThreadOptions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class HeaderThreadOptions extends Component {
9595
<li onClick={() => this.props.onClickMarkAsRead()}>
9696
<span>
9797
{markAsUnread
98-
? string.mailbox.mark_as_read
99-
: string.mailbox.mark_as_unread}
98+
? string.mailbox.mark_as_unread
99+
: string.mailbox.mark_as_read}
100100
</span>
101101
</li>
102102
{!this.props.itemsChecked && (

email_mailbox/src/components/HeaderThreadOptionsWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class HeaderThreadOptionsWrapper extends Component {
179179
() => {
180180
this.props.onMarkRead(
181181
this.props.threadsSelected,
182-
!this.props.markAsUnread
182+
this.props.markAsUnread
183183
);
184184
}
185185
);

email_mailbox/src/components/settinggeneral.scss

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,12 @@
8787
}
8888

8989
#settings-general-usefullinks{
90-
.cptx-useful-link{
91-
color: #0091ff;
92-
font-size: 13px;
93-
font-weight: 400;
94-
margin-top: 7px;
95-
text-decoration: none;
96-
}
90+
.cptx-useful-link{
91+
color: #0091ff;
92+
font-size: 13px;
93+
font-weight: 400;
94+
text-decoration: none;
95+
}
9796
}
9897

9998
/* THEME

email_mailbox/src/containers/Email.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ import {
1919
checkFileDownloaded
2020
} from './../utils/ipc';
2121
import {
22+
markEmailUnread,
23+
removeEmails,
2224
unsendEmail,
2325
updateEmailLabels,
24-
updateEmailOnSuccess,
25-
removeEmails
26+
updateEmailOnSuccess
2627
} from './../actions/index';
2728
import {
2829
EmailStatus,
@@ -180,6 +181,13 @@ const mapDispatchToProps = (dispatch, ownProps) => {
180181
}
181182
});
182183
},
184+
onMarkUnread: ev => {
185+
ev.stopPropagation();
186+
const labelId = ownProps.mailboxSelected.id;
187+
dispatch(markEmailUnread(labelId, email.threadId, email.id, true)).then(
188+
() => ownProps.onBackOption()
189+
);
190+
},
183191
onOpenEmailSource: ev => {
184192
ev.stopPropagation();
185193
sendOpenEmailSource(email.key);

email_mailbox/src/containers/HeaderThreadOptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const makeMapStateToProps = () => {
3737
});
3838
const labels = getLabelsIncluded(state, threadsLabelIds);
3939
const markAsUnread = ownProps.itemsChecked
40-
? shouldMarkAsUnread(threads, ownProps.itemsChecked)
40+
? !shouldMarkAsUnread(threads, ownProps.itemsChecked)
4141
: true;
4242
const allSelected = ownProps.itemsChecked
4343
? threadIds.size === ownProps.itemsChecked.size

0 commit comments

Comments
 (0)