diff options
author | Max Kostikov <max@kostikov.co> | 2018-09-15 01:20:49 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2018-09-15 01:20:49 +0200 |
commit | 8d89c4bbcef4e11db6c031c8f5af1323eb055e49 (patch) | |
tree | 87364eb208bb4679d5c431f05acaacba6c32d84c /include/zot.php | |
parent | 85d8225cc061f8654f70e879d0afca680c734a02 (diff) | |
download | volse-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.php | 20 |
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'); |