Skip to content

Commit

Permalink
show all sources as read when offline
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Oct 22, 2020
1 parent 06db93b commit 9514473
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,10 +1010,11 @@ def __init__(self, controller: Controller, source: Source, mark_seen_signal: pyq
self.controller.source_deleted.connect(self._on_source_deleted)
self.controller.source_deletion_failed.connect(self._on_source_deletion_failed)
mark_seen_signal.connect(self._on_mark_seen)
self.controller.authentication_state.connect(self._on_authentication_changed)

# Store source
self.source = source
self.seen = self.source.seen
self.seen = True
self.source_uuid = self.source.uuid
self.last_updated = self.source.last_updated

Expand Down Expand Up @@ -1162,6 +1163,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:
Expand Down

0 comments on commit 9514473

Please sign in to comment.