Skip to content

Commit

Permalink
Fix /message/reply/ JSON bugs, add /api/0/message/reply/composer.jhtm…
Browse files Browse the repository at this point in the history
…l view
  • Loading branch information
BjarniRunar committed Oct 24, 2014
1 parent 55e97fc commit af4e3b3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
13 changes: 9 additions & 4 deletions mailpile/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,16 @@ def _metadata(self, msg_info):
}

# Ephemeral messages do not have URLs
if '-' not in msg_info[MailIndex.MSG_MID]:
if '-' in msg_info[MailIndex.MSG_MID]:
expl['flags'].update({
'ephemeral': True,
'draft': True,
})
else:
expl['urls'] = {
'thread': self.urlmap.url_thread(msg_info[MailIndex.MSG_MID]),
'source': self.urlmap.url_source(msg_info[MailIndex.MSG_MID]),
}
else:
expl['flags']['ephemeral'] = True

# Support rich snippets
if expl['body']['snippet'].startswith('{'):
Expand Down Expand Up @@ -746,7 +749,9 @@ def _metadata(self, msg_info):

# Extra behavior for editable messages
if 'draft' in expl['flags']:
if self.idx.config.is_editable_message(msg_info):
if 'ephemeral' in expl['flags']:
pass
elif self.idx.config.is_editable_message(msg_info):
expl['urls']['editing'] = self.urlmap.url_edit(expl['mid'])
else:
del expl['flags']['draft']
Expand Down
2 changes: 1 addition & 1 deletion mailpile/mailutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def clear_from_parse_cache(self):
ClearParseCache(cache_id=self.msg_idx_pos)

def get_msg_info(self, field=None, uncached=False):
if uncached or not self.msg_info:
if (uncached or not self.msg_info) and not self.ephemeral_mid:
self.msg_info = self.index.get_msg_at_idx_pos(self.msg_idx_pos)
if field is None:
return self.msg_info
Expand Down
2 changes: 1 addition & 1 deletion static/default/html/message/draft.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#}
{% set found_editable = [] %}
{% set found_requested = [] %}
{% for mid in result.thread_ids %}
{% for mid in (result.thread_ids or result.message_ids) %}
{% set message = result.data.messages.get(mid) %}
{% set metadata = result.data.metadata[mid] %}
{% if message %}
Expand Down
1 change: 1 addition & 0 deletions static/default/html/message/reply-composer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "message/draft.html" %}

0 comments on commit af4e3b3

Please sign in to comment.