Skip to content

Commit 36d6051

Browse files
author
Erika Perugachi
authored
Merge pull request #307 from erikaperugachi/unsend
Unsend
2 parents 89128d4 + 9e53605 commit 36d6051

File tree

15 files changed

+94
-82
lines changed

15 files changed

+94
-82
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.5.0",
3+
"version": "0.6.0",
44
"author": {
55
"name": "Criptext Inc.",
66
"email": "[email protected]",

electron_app/src/models.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ const createEmailColumns = table => {
102102
table.string('subject').notNullable();
103103
table.text('content').notNullable();
104104
table.string('preview', LARGE_STRING_SIZE).notNullable();
105-
table.timestamp('date').notNullable();
105+
table.dateTime('date').notNullable();
106106
table.integer('status').notNullable();
107107
table.boolean('unread').notNullable();
108108
table.boolean('secure').notNullable();
109109
table.boolean('isMuted').notNullable();
110-
table.timestamp('unsendDate');
110+
table.dateTime('unsendDate');
111111
};
112112

113113
const createEmailLabelColumns = table => {

electron_app/src/windows/menu.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ const template = [
6565
label: 'Close',
6666
accelerator: 'CmdOrCtrl+W',
6767
role: 'close'
68+
},
69+
{
70+
label: 'Developer',
71+
type: 'submenu',
72+
submenu: [
73+
{
74+
label: 'Toggle Developer Tools',
75+
accelerator:
76+
process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
77+
click(item, focusedWindow) {
78+
if (focusedWindow) focusedWindow.webContents.toggleDevTools();
79+
}
80+
}
81+
]
6882
}
6983
]
7084
}
@@ -120,7 +134,7 @@ if (process.platform === 'darwin') {
120134
]
121135
});
122136
// Window menu.
123-
template[2].submenu.push(
137+
template[3].submenu.push(
124138
{
125139
type: 'separator'
126140
},

email_mailbox/src/actions/emails.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import {
1010
} from '../utils/electronInterface';
1111
import { loadContacts } from './contacts';
1212
import { updateLabelSuccess } from './labels';
13-
import { EmailStatus, unsentText } from '../utils/const';
13+
import { EmailStatus } from '../utils/const';
1414
import { getCriptextRecipients } from '../utils/EmailUtils';
15-
import { removeHTMLTags } from '../utils/StringUtils';
1615

1716
export const addEmails = emails => {
1817
return {
@@ -124,19 +123,20 @@ export const unsendEmail = params => {
124123
await updateEmail({
125124
key,
126125
status: EmailStatus.UNSEND,
127-
content: unsentText,
128-
preview: removeHTMLTags(unsentText),
126+
content: '',
127+
preview: '',
129128
unsendDate: Date.now()
130129
});
131-
dispatch(unsendEmailOnSuccess(emailId));
130+
dispatch(unsendEmailOnSuccess(emailId, Date.now()));
132131
}
133132
} catch (e) {
134133
// To do
135134
}
136135
};
137136
};
138137

139-
export const unsendEmailOnSuccess = emailId => ({
138+
export const unsendEmailOnSuccess = (emailId, unsendDate) => ({
140139
type: Email.UNSEND,
141-
emailId
140+
emailId,
141+
unsendDate
142142
});

email_mailbox/src/components/ButtonUnsend.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const ButtonUnsend = props => (
88
'button-unsend ' +
99
(props.displayLoading ? 'button-unsend-loading' : 'button-unsend-normal')
1010
}
11-
onClick={props.onClick}
11+
onClick={ev => props.onClick(ev)}
1212
>
13-
{props.displayLoading ? renderLoading() : renderButton(props.onClick)}
13+
{props.displayLoading ? renderLoading() : renderButton()}
1414
</button>
1515
);
1616

email_mailbox/src/components/ButtonUnsendWrapper.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ class ButtonUnsendWrapper extends Component {
1414
return (
1515
<ButtonUnsend
1616
displayLoading={this.state.displayLoading}
17-
onClick={this.onClick}
18-
{...this.props}
17+
onClick={this.handleClick}
1918
/>
2019
);
2120
}
2221

23-
onClick = () => {
22+
handleClick = ev => {
23+
if (ev) ev.stopPropagation();
2424
this.setState({
2525
displayLoading: true
2626
});
27-
this.props.onClicked(true);
27+
this.props.onClick(true);
2828
};
2929
}
3030

3131
ButtonUnsendWrapper.propTypes = {
3232
displayPopOver: PropTypes.bool,
33-
onClicked: PropTypes.func,
33+
onClick: PropTypes.func,
3434
onTogglePopOver: PropTypes.func
3535
};
3636

email_mailbox/src/components/Email.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const renderEmailCollapse = props => (
2020
<div
2121
className={
2222
'email-container email-container-collapse ' +
23-
(props.isUnsend ? 'email-unsent' : 'email-normal')
23+
(props.isUnsend ? 'email-unsend' : 'email-normal')
2424
}
2525
onClick={props.onToggleEmail}
2626
>
@@ -99,7 +99,7 @@ const renderEmailExpand = props => (
9999
</div>
100100
<div className="email-info-content-actions">
101101
{props.isFromMe && !props.isUnsend ? (
102-
<ButtonUnsend onClicked={props.unsendButtonOnClicked} />
102+
<ButtonUnsend onClick={props.onClickUnsendButton} />
103103
) : null}
104104
<i
105105
className="icon-replay"
@@ -219,7 +219,7 @@ renderEmailExpand.propTypes = {
219219
onTogglePopOverEmailActions: PropTypes.func,
220220
onTooglePopOverEmailMoreInfo: PropTypes.func,
221221
staticOpen: PropTypes.func,
222-
unsendButtonOnClicked: PropTypes.func
222+
onClickUnsendButton: PropTypes.func
223223
};
224224

225225
renderMuteIcon.propTypes = {

email_mailbox/src/components/EmailWrapper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class EmailWrapper extends Component {
2323
onToggleEmail={this.onToggleEmail}
2424
onTooglePopOverEmailMoreInfo={this.handleTooglePopOverEmailMoreInfo}
2525
onTogglePopOverEmailActions={this.handleTogglePopOverEmailActions}
26-
unsendButtonOnClicked={this.setHideView}
26+
onClickUnsendButton={this.handleClickUnsendButton}
2727
{...this.props}
2828
/>
2929
);
@@ -62,14 +62,14 @@ class EmailWrapper extends Component {
6262
});
6363
};
6464

65-
setHideView = value => {
65+
handleClickUnsendButton = value => {
6666
this.setState(
6767
{
68-
hideView: value
68+
hideView: !value
6969
},
7070
async () => {
7171
await this.props.unsendEmail();
72-
this.setState({ hideView: !value });
72+
this.setState({ hideView: value });
7373
}
7474
);
7575
};

email_mailbox/src/components/PanelWrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class PanelWrapper extends Component {
6666
}
6767
});
6868

69-
addEvent(Event.EMAIL_TRACKING_UPDATE, (threadId, status) => {
69+
addEvent(Event.EMAIL_TRACKING_UPDATE, (threadId, status, date) => {
7070
if (status === EmailStatus.OPENED) {
7171
props.onMarkThreadAsOpen(threadId);
7272
}
@@ -84,7 +84,7 @@ class PanelWrapper extends Component {
8484
});
8585
}
8686
if (isRenderingThread) {
87-
props.onUnsendEmail(threadId);
87+
props.onUnsendEmail(threadId, date);
8888
}
8989
}
9090
});

email_mailbox/src/components/email.scss

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,15 @@
33
.email-container{
44
align-items: center;
55
background-color: white;
6+
border: solid 1px #dcdde0;
67
border-radius: 4px;
78
display: flex;
8-
font-family: NunitoSans;
99
margin-bottom: 6px;
1010
position: relative;
11-
width: 100%;
11+
width: calc(100% - 2px);
1212

1313
&.email-unsend {
14-
i {
15-
color: #d0021b;
16-
}
17-
.button-expand {
18-
border-color: #ff99a5;
19-
}
20-
.email-text {
21-
font-style: italic;
22-
color: #acacac;
23-
}
14+
border: solid 1px #eeb6b7;
2415
}
2516

2617
hr{
@@ -120,17 +111,9 @@
120111
}
121112

122113
.email-container-collapse{
123-
width: calc(100% - 2px);
124-
125-
&.email-normal{
126-
border: solid 1px #dcdde0;
127-
}
128-
129-
&.email-unsent{
130-
border: solid 1px rgba(221, 64, 64, 0.48);
131-
114+
&.email-unsend{
132115
.email-preview-content{
133-
color: #eea3a3;
116+
color: #eeb6b7;
134117
font-style: italic;
135118
}
136119
}
@@ -149,10 +132,15 @@
149132
}
150133

151134
.email-container-expand{
152-
box-shadow: 0 2px 4px 0 rgba(175, 175, 175, 0.35);
153135
height: auto;
154136
flex-direction: column;
155137

138+
&.email-unsend {
139+
.email-text {
140+
font-style: italic;
141+
}
142+
}
143+
156144
> div{
157145
margin: 0 17px;
158146
width: calc(100% - 34px);
@@ -210,9 +198,13 @@
210198
font-weight: 200;
211199

212200
&[disabled]{
213-
opacity: 0.2;
201+
opacity: 0.3;
214202
pointer-events: none;
215203
}
204+
205+
>div{
206+
margin: 10px 0;
207+
}
216208
}
217209

218210
.email-files{

0 commit comments

Comments
 (0)