Skip to content

Commit c14d760

Browse files
author
Allie Crevier
committed
show preview and correct style for replies
1 parent fb745f2 commit c14d760

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

securedrop_client/gui/widgets.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,6 @@ def setup(self, controller):
844844
# Handle source related messages.
845845
self.controller.message_ready.connect(self.set_snippet)
846846
self.controller.reply_ready.connect(self.set_snippet)
847-
self.controller.reply_succeeded.connect(self.set_snippet)
848847
self.controller.file_ready.connect(self.set_snippet)
849848

850849
def update(self, sources: List[Source]):
@@ -1765,16 +1764,17 @@ def _set_reply_state(self, status: str) -> None:
17651764
elif status == 'PENDING':
17661765
self.setStyleSheet(self.CSS_REPLY_PENDING)
17671766

1768-
@pyqtSlot(str)
1769-
def _on_reply_success(self, message_id: str) -> None:
1767+
@pyqtSlot(str, str)
1768+
def _on_reply_success(self, message_id: str, new_reply_id: str) -> None:
17701769
"""
17711770
Conditionally update this ReplyWidget's state if and only if the message_id of the emitted
17721771
signal matches the message_id of this widget.
17731772
"""
17741773
if message_id == self.message_id:
1775-
logger.debug('Message {} succeeded'.format(message_id))
1774+
self.message_id = new_reply_id
17761775
self._set_reply_state('SUCCEEDED')
17771776

1777+
17781778
@pyqtSlot(str)
17791779
def _on_reply_failure(self, message_id: str) -> None:
17801780
"""

securedrop_client/logic.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ class Controller(QObject):
101101
sync_events = pyqtSignal(str)
102102

103103
"""
104-
Signal that notifies that a reply was accepted by the server. Emits the reply's
105-
UUID and content as a string.
104+
Signal that notifies that a reply was accepted by the server. Emits the reply's draft UUID and
105+
UUID as a string.
106106
"""
107-
reply_succeeded = pyqtSignal([str, str, str])
107+
reply_succeeded = pyqtSignal([str, str])
108108

109109
"""
110110
Signal that notifies that a reply failed to be accepted by the server. Emits the reply's UUID
@@ -782,7 +782,8 @@ def on_reply_success(self, reply_uuid: str) -> None:
782782
self.gui.clear_error_status() # remove any permanent error status message
783783
self.session.commit()
784784
reply = storage.get_reply(self.session, reply_uuid)
785-
self.reply_succeeded.emit(reply.source.uuid, reply_uuid, reply.content)
785+
self.reply_succeeded.emit(reply_uuid, reply.uuid)
786+
self.reply_ready.emit(reply.source.uuid, reply.uuid, reply.content)
786787

787788
def on_reply_failure(
788789
self,

0 commit comments

Comments
 (0)