aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2018-09-15 01:20:49 +0200
committerMax Kostikov <max@kostikov.co>2018-09-15 01:20:49 +0200
commit8d89c4bbcef4e11db6c031c8f5af1323eb055e49 (patch)
tree87364eb208bb4679d5c431f05acaacba6c32d84c /include/zot.php
parent85d8225cc061f8654f70e879d0afca680c734a02 (diff)
downloadvolse-hubzilla-8d89c4bbcef4e11db6c031c8f5af1323eb055e49.tar.gz
volse-hubzilla-8d89c4bbcef4e11db6c031c8f5af1323eb055e49.tar.bz2
volse-hubzilla-8d89c4bbcef4e11db6c031c8f5af1323eb055e49.zip
Save combined view on calling first message in thread
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/zot.php b/include/zot.php
index e8ac2df02..f4feb1022 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -2341,6 +2341,26 @@ function process_mail_delivery($sender, $arr, $deliveries) {
intval($r[0]['id']),
intval($channel['channel_id'])
);
+
+ // If it was a first message in thread
+ $z = q("SELECT * FROM mail WHERE mid = '%s' AND channel_id = %d",
+ dbesc($arr['mid']),
+ intval($channel['channel_id'])
+ );
+ if (! $z) {
+ // Get new first message...
+ $r = q("SELECT mid, conv_guid FROM mail WHERE parent_mid = '%s' AND channel_id = %d ORDER BY id ASC LIMIT 1",
+ dbesc($arr['mid']),
+ intval($channel['channel_id'])
+ );
+ // ...and refer whole thread to it
+ q("UPDATE mail SET parent_mid = '%s', mail_isreply = abs(mail_isreply - 1) WHERE conv_guid = '%s' AND channel_id = %d",
+ dbesc($r[0]['mid']),
+ dbesc($r[0]['conv_guid']),
+ intval($channel['channel_id'])
+ );
+ }
+
$DR->update('mail recalled');
$result[] = $DR->get();
logger('mail_recalled');