Skip to content

Commit

Permalink
Merge pull request #2292 from freedomofpress/backport-2291
Browse files Browse the repository at this point in the history
[0.14.0] Backport "[0.14.0] Hide continue button on delete dialog if no sources selected."
  • Loading branch information
legoktm authored Nov 14, 2024
2 parents 5cebb54 + 557a1a5 commit 963432a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/securedrop_client/gui/source/delete/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ def _get_source_names(self, sources: list[Source]) -> str:
def _show_warning_nothing_selected(self) -> None:
"""
Helper. Display warning if no sources are selected for deletion.
Disables "Continue" button so user must close or cancel dialog.
Hides "Continue" button so user must close or cancel dialog.
"""
self.continue_button.setEnabled(False)
self.continue_button.setVisible(False)
self.cancel_button.setFocus()
self.cancel_button.setDefault(True)
self.body.setText(_("No sources have been selected."))
Expand Down
3 changes: 2 additions & 1 deletion client/tests/gui/source/delete/test_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ def test_no_sources_shows_error_text(self, dialog):

assert dialog.text() == "No sources have been selected."

def test_no_sources_continue_button_disabled(self, dialog):
def test_no_sources_continue_button_not_shown(self, dialog):
if len(dialog.sources) > 0:
pytest.skip("Skip if sources")

assert not dialog.continue_button.isEnabled()
assert not dialog.continue_button.isVisible()

def test_correct_format_body_text(self):
"""
Expand Down

0 comments on commit 963432a

Please sign in to comment.