forward to wrong page after delete a message in fullview page

After deleting an internal message (either a received or sent message) in fullveiw page, it will be forwarded to home page instead of message received or sent page.

The root cause is, in /actions/messages/delete.php, it use "forward(REFERER);" at the end. But now that the message has been deleted, its original fullview page won't exist, so Elgg will forward to default home page. 

To fix: 

    1. in /mod/messages/views/default/object/messages.php, add a variable to indicate it's a sent or received message, $sendreceive = "inbox"; or $sendreceive = "sent";. Then add $sendreceive in $delete_link as following:

        $delete_link = elgg_view("output/confirmlink", array(
        'href' => "action/messages/delete?guid=" . $message->getGUID() . "&mtype=" . $sendreceive, 
        'text' => "<span class=\"elgg-icon elgg-icon-delete float-alt\"></span>",
        'confirm' => elgg_echo('deleteconfirm'),
        'encode_text' => false,
        ));

    2. in /mod/messages/actions/messages/delete.php, get $mtype = get_input('mtype','inbox'); then change the last forward statement to following:

        //forward(REFERER); 
        forward("messages/{$mtype}/" . elgg_get_logged_in_user_entity()->username);

I think this is a bug. Mine is Elgg 1.8.5, but the source code doesn't change in Elgg 1.8.14.