diff --git a/securedrop_client/gui/widgets.py b/securedrop_client/gui/widgets.py index 33079f0dae..521fda56b2 100644 --- a/securedrop_client/gui/widgets.py +++ b/securedrop_client/gui/widgets.py @@ -658,7 +658,9 @@ def on_source_changed(self): self.source_conversations[source.uuid] = conversation_wrapper self.set_conversation(conversation_wrapper) - self.source_list.mark_seen.emit(source.uuid) + + if self.controller.authenticated: + self.source_list.mark_seen.emit(source.uuid) def delete_conversation(self, source_uuid: str) -> None: """ @@ -1009,6 +1011,7 @@ def __init__(self, controller: Controller, source: Source, mark_seen_signal: pyq self.controller = controller self.controller.source_deleted.connect(self._on_source_deleted) self.controller.source_deletion_failed.connect(self._on_source_deletion_failed) + self.controller.authentication_state.connect(self._on_authentication_changed) mark_seen_signal.connect(self._on_mark_seen) # Store source @@ -1115,7 +1118,8 @@ def update(self): self.paperclip.hide() self.star.update(self.source.is_starred) - self.seen = self.source.seen + # When not authenticated we always show the source as having been seen + self.seen = True if not self.controller.is_authenticated else self.source.seen self.update_styles() except sqlalchemy.exc.InvalidRequestError as e: logger.debug(f"Could not update SourceWidget for source {self.source_uuid}: {e}") @@ -1162,6 +1166,15 @@ def update_styles(self) -> None: self.preview.setObjectName("SourceWidget_preview_unread") self.setStyleSheet(self.SOURCE_CSS) + @pyqtSlot(bool) + def _on_authentication_changed(self, authenticated: bool) -> None: + """ + When the user logs out, show source as seen. + """ + if not authenticated: + self.seen = True + self.update_styles() + @pyqtSlot(str) def _on_mark_seen(self, source_uuid: str): if self.source_uuid != source_uuid: