Skip to content

Commit e1fe28c

Browse files
Erika Perugachinot-gabriel
authored andcommitted
Thread (#402)
* Arrive new email and show in your own thread when this thread is open * Add Spam label when new email arrive with param: labels["Spam"]. Close #375 * Update css * Update version 0.11.2
1 parent 0aecf57 commit e1fe28c

File tree

6 files changed

+29
-12
lines changed

6 files changed

+29
-12
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.11.1",
3+
"version": "0.11.2",
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.11.1",
3+
"version": "0.11.2",
44
"private": true,
55
"dependencies": {
66
"animejs": "^2.2.0",

email_mailbox/src/app.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,11 @@ button{
638638
&:focus{
639639
outline: 0;
640640
}
641+
642+
&:disabled {
643+
opacity: 0.5;
644+
pointer-events: none;
645+
}
641646
}
642647

643648
.button-a{

email_mailbox/src/components/PanelWrapper.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,26 @@ class PanelWrapper extends Component {
144144

145145
initEventHandlers = props => {
146146
addEvent(Event.NEW_EMAIL, emailParams => {
147-
const { isToMe, labels } = emailParams;
148-
const isRenderingMailbox =
149-
this.state.sectionSelected.type === SectionType.MAILBOX;
147+
const { emailId, isToMe, labels, threadId } = emailParams;
148+
const currentSectionType = this.state.sectionSelected.type;
149+
const isRenderingMailbox = currentSectionType === SectionType.MAILBOX;
150+
const isRenderingThread = currentSectionType === SectionType.THREAD;
150151
const currentLabelId =
151152
LabelType[this.state.sectionSelected.params.mailboxSelected].id;
152153
const isNewEmailInMailbox = labels.indexOf(currentLabelId) > -1;
153-
if (isNewEmailInMailbox && isRenderingMailbox) {
154+
const currentThreadId = this.state.sectionSelected.params
155+
.threadIdSelected;
156+
if (isRenderingMailbox && isNewEmailInMailbox) {
154157
props.onLoadThreads({
155158
labelId: Number(currentLabelId),
156159
clear: true
157160
});
161+
} else if (isRenderingThread && threadId === currentThreadId) {
162+
props.onLoadEmails(threadId);
163+
props.onUpdateEmailIdsThread({
164+
threadId,
165+
emailIdToAdd: emailId
166+
});
158167
}
159168
if (isToMe) {
160169
props.onUpdateUnreadEmailsBadge({

email_mailbox/src/components/SettingGeneral.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const ResendConfirmationRecoveryEmailLink = ({
220220
onComplete={onResendConfirmationCountdownEnd}
221221
>
222222
<button className="button-b" onClick={onClickResendConfirmationLink}>
223-
Resend Link
223+
<span>Resend Link</span>
224224
</button>
225225
</Countdown>
226226
);
@@ -231,9 +231,9 @@ const renderer = ({ minutes, seconds, completed, children }) => {
231231
return children;
232232
}
233233
return (
234-
<span className="button-b disabled">
235-
{`Resend Link available in ${minutes}:${seconds}`}
236-
</span>
234+
<button className="button-b" disabled={true}>
235+
<span>{`Resend Link available in ${minutes}:${seconds}`}</span>
236+
</button>
237237
);
238238
};
239239

email_mailbox/src/utils/electronEventInterface.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ const handleNewMessageEvent = async ({ rowid, params }) => {
107107
fileKey,
108108
files,
109109
from,
110+
labels,
110111
messageType,
111112
metadataKey,
112113
subject,
@@ -116,6 +117,9 @@ const handleNewMessageEvent = async ({ rowid, params }) => {
116117
} = params;
117118
const recipientId = EmailUtils.getRecipientIdFromEmailAddressTag(from);
118119
const [prevEmail] = await getEmailByKey(metadataKey);
120+
const isSpam = labels
121+
? labels.find(label => label === LabelType.spam.text)
122+
: undefined;
119123
const InboxLabel = LabelType.inbox.id;
120124
const SentLabel = LabelType.sent.id;
121125
const isToMe = EmailUtils.checkEmailIsTo({ to, cc, bcc, type: 'to' });
@@ -166,14 +170,13 @@ const handleNewMessageEvent = async ({ rowid, params }) => {
166170
})
167171
: null;
168172

169-
const labels = [];
173+
const labels = isSpam ? [LabelType.spam.id] : [];
170174
if (isToMe) {
171175
labels.push(InboxLabel);
172176
}
173177
if (isFromMe) {
174178
labels.push(SentLabel);
175179
}
176-
177180
const emailData = {
178181
email,
179182
labels,

0 commit comments

Comments
 (0)