From 794860befe422d5851f32c4c99c1f29495a749d7 Mon Sep 17 00:00:00 2001 From: Igbanam Ogbuluijah Date: Sun, 10 Oct 2021 08:10:37 +0100 Subject: [PATCH] Fix the message list bug (#216) With the current version of Himalaya, the Vim front breaks because it can't find headers.subject in the JSON output from Himalaya. The JSON output today from Himalaya representing a message looks like so ```json { "uid": 12345, "flags": [], "subject": "Subject", "subject_len": 7, "sender": "Sender", "sender_len": 6, "date": "2020-12-11 06:38:19" }, ``` This reverts some of the changes in b9a9d0e, but not all of them. --- vim/autoload/himalaya/msg.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vim/autoload/himalaya/msg.vim b/vim/autoload/himalaya/msg.vim index f51362c4..83cc8b80 100644 --- a/vim/autoload/himalaya/msg.vim +++ b/vim/autoload/himalaya/msg.vim @@ -14,8 +14,8 @@ function! s:format_msg_for_list(msg) let flag_flagged = index(a:msg.flags, "Flagged") == -1 ? " " : "!" let flag_replied = index(a:msg.flags, "Answered") == -1 ? " " : "↵" let msg.flags = printf("%s %s %s", flag_new, flag_replied, flag_flagged) - let msg.subject = a:msg.headers.subject - let msg.sender = a:msg.headers.from[0] + let msg.subject = a:msg.subject + let msg.sender = a:msg.sender let msg.date = a:msg.date return msg endfunction @@ -67,11 +67,11 @@ function! himalaya#msg#read() \printf("Fetching message %d", s:msg_id), \1, \) - let attachment = len(msg.attachments) > 0 ? " []" : "" + let attachment = msg.hasAttachment ? " []" : "" execute printf("silent! edit Himalaya read message [%d]%s", s:msg_id, attachment) setlocal modifiable silent execute "%d" - call append(0, split(substitute(msg.body.plain, "\r", "", "g"), "\n")) + call append(0, split(substitute(msg.content, "\r", "", "g"), "\n")) silent execute "$d" setlocal filetype=himalaya-msg-read let &modified = 0