jumboteam @KevinTheJedi That script was to hide the "Deleted by Agentname" line mention just above the first thread.
To delete the duplicate records use below query.
DELETE t1
FROM ostno_thread_entry_email AS t1
INNER JOIN ostno_thread_entry_email AS t2
WHERE
t1.id < t2.id AND
t1.thread_entry_id = t2.thread_entry_id;
Below script is to hide the "deleted by agentname" line. add this in header.inc file.
<script>
$(document).ready(function() {
$(".thread-event .type-icon:first").css(
"display", "none");
$(".thread-event .description:first").css(
"display", "none");
});
</script>