Skip to content

Commit

Permalink
undo changes to adding a reply to the gui
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Apr 3, 2019
1 parent 3ee6885 commit 716f3f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,12 @@ def update_conversation(self, collection: list) -> None:
if conversation_item.filename.endswith('msg.gpg'):
self.add_message(conversation_item)
elif conversation_item.filename.endswith('reply.gpg'):
self.add_reply(conversation_item)
self.controller.session.refresh(conversation_item)
if conversation_item.content is not None:
content = conversation_item.content
else:
content = '<Message not yet available>'
self.add_reply(conversation_item.uuid, content)
else:
self.add_file(self.source, conversation_item)

Expand Down Expand Up @@ -843,18 +848,12 @@ def add_message(self, message: Message) -> None:
self.conversation_layout.addWidget(
MessageWidget(message.uuid, content, self.controller.message_sync.message_ready))

def add_reply(self, reply: Reply) -> None:
def add_reply(self, uuid: str, content: str) -> None:
"""
Add a reply from a journalist.
"""
self.controller.session.refresh(reply)
if reply.content is not None:
content = reply.content
else:
content = '<Reply not yet available>'

self.conversation_layout.addWidget(
ReplyWidget(reply.uuid,
ReplyWidget(uuid,
content,
self.controller.reply_sync.reply_ready,
self.controller.reply_succeeded,
Expand Down
4 changes: 2 additions & 2 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ def test_ConversationView_add_reply(mocker, homedir, session, source):
mock_reply_widget = mocker.patch('securedrop_client.gui.widgets.ReplyWidget',
return_value=mock_reply_widget_res)

cv.add_reply(reply)
cv.add_reply(reply.uuid, content)

# check that we built the widget was called with the correct args
mock_reply_widget.assert_called_once_with(
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def test_ConversationView_add_reply_no_content(mocker, homedir, session, source)
mock_reply_widget = mocker.patch('securedrop_client.gui.widgets.ReplyWidget',
return_value=mock_reply_widget_res)

cv.add_reply(reply)
cv.add_reply(reply.uuid, '<Reply not yet available>')

# check that we built the widget was called with the correct args
mock_reply_widget.assert_called_once_with(
Expand Down

0 comments on commit 716f3f5

Please sign in to comment.