]> git.mxchange.org Git - friendica.git/commitdiff
mod/message return to conversation if message deleted
authorJonny Tischbein <jonny_tischbein@systemli.org>
Tue, 2 Oct 2018 11:16:43 +0000 (13:16 +0200)
committerJonny Tischbein <jonny_tischbein@systemli.org>
Tue, 2 Oct 2018 11:16:43 +0000 (13:16 +0200)
mod/message.php

index e2380fdb5c5c7d5504588fba97b86f937c2d5a80..bf1895f67dec3693066a5ae999062d3401eb6e7b 100644 (file)
@@ -165,11 +165,23 @@ function message_content(App $a)
 
                $cmd = $a->argv[1];
                if ($cmd === 'drop') {
+                       $r = DBA::SelectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
+                       if(!DBA::isResult($r)){
+                               info(L10n::t('Conversation not founded.') . EOL);
+                               goaway('/message');
+                       }
+
                        if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
                                info(L10n::t('Message deleted.') . EOL);
                        }
 
-                       goaway('/message' );
+                       $rr = DBA::SelectFirst('mail', ['id'], ['convid' => $r['convid'], 'uid' => local_user()]);
+                       if(!DBA::isResult($rr)){
+                               info(L10n::t('Conversation removed.') . EOL);
+                               goaway('/message');
+                       }
+
+                       goaway('/message/'.$rr['id'] );
                } else {
                        $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                                intval($a->argv[2]),