-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(other): screen email: fix adding to trust contact while the email is blo… #1265
fix(other): screen email: fix adding to trust contact while the email is blo… #1265
Conversation
4e5f6c9
to
ab14f8d
Compare
@christer77 please rebase to fix failing tests. |
543849a
to
8b8ffb6
Compare
8b8ffb6
to
3b3122a
Compare
3b3122a
to
2a6f525
Compare
2a6f525
to
8afda19
Compare
8afda19
to
c31c7d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some updates to be done.
88ef6b3
to
ff8bf62
Compare
ff8bf62
to
6e9ef23
Compare
6e9ef23
to
6109e25
Compare
6109e25
to
bc9657f
Compare
bc9657f
to
d1d728c
Compare
e843f56
to
d8d1d71
Compare
d8d1d71
to
f847402
Compare
f847402
to
de710ee
Compare
function get_list_block_sieve() { | ||
sessionStorage.removeItem('list_blocked'); | ||
var detail = Hm_Utils.parse_folder_path(hm_list_path()); | ||
var list_blocked_senders = []; | ||
var page = hm_page_name(); | ||
if (page == 'message_list') { | ||
Hm_Ajax.request( | ||
[ | ||
{ name: 'hm_ajax_hook', value: 'ajax_list_block_sieve' }, | ||
{ name: 'imap_server_id', 'value': detail.server_id}, | ||
], | ||
function (res) { | ||
if (res.ajax_list_block_sieve) { | ||
sessionStorage.setItem('list_blocked', res.ajax_list_block_sieve); | ||
} | ||
} | ||
); | ||
} | ||
}; | ||
|
||
$('.screen-email-unlike').on("click", function() { imap_screen_email(); return false; }); | ||
|
||
$('.screen-email-like').on("click", function() { | ||
var list_blocked_senders = (sessionStorage.getItem('list_blocked') !== null) ? JSON.parse(sessionStorage.getItem('list_blocked')) : []; | ||
var list_email = []; | ||
var list_msg_uid = []; | ||
var email_existing_in_blocked_senders = []; | ||
$('input[type=checkbox]').each(function() { | ||
if (this.checked && this.id.search('imap') != -1) { | ||
let email = $('.'+ this.id +' .from').attr("data-title") | ||
if (email = email.trim()) { | ||
list_email.push(email); | ||
if (list_blocked_senders.length > 0) { | ||
list_blocked_senders.forEach((sender, index) => { | ||
if (sender === email) { | ||
email_existing_in_blocked_senders.push(email); | ||
list_msg_uid.push($(this).parent().parent().attr("data-uid")); | ||
delete list_blocked_senders[index]; | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
}); | ||
add_email_in_contact_trusted(list_email); return false; | ||
|
||
if (email_existing_in_blocked_senders) { | ||
var list_html = "<ol>"; | ||
email_existing_in_blocked_senders.forEach(sender => { | ||
sender = sender.trim(); | ||
list_html += `<li>${sender}</li>`; | ||
}); | ||
list_html += "</ol>"; | ||
const modal = new Hm_Modal({ | ||
modalId: 'emptySubjectBodyModal', | ||
title: 'Warning', | ||
btnSize: 'sm' | ||
}); | ||
|
||
var modalContentHeadline = "Adress mail exist in your Block list"; | ||
modal.addFooterBtn(hm_trans('Add Emails to Trust contact'), 'btn-warning', handleAddEmail); | ||
modal.setContent(modalContentHeadline + list_html + `<p>${hm_trans('If you add these, all will be unblocked.<br>Are you sure you want to add this in your Trust contact?')}</p>`); | ||
modal.open(); | ||
function handleAddEmail() { | ||
list_msg_uid.forEach(function(msg_uid) { | ||
block_unblock_sender(msg_uid, Hm_Utils.parse_folder_path(hm_list_path()), 'sender', 'unblocked'); | ||
}); | ||
modal.hide(); | ||
add_email_in_contact_trusted(list_email); | ||
}; | ||
} else { | ||
add_email_in_contact_trusted(list_email); | ||
} | ||
return false; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christer77 This should not be called when the module "sievefilters" is disabled. Please move it to its appropriate module.
This PR resolves issue's points 4 and 5