Skip to content

Commit

Permalink
Merge pull request #2291 from freedomofpress/2290-hide-unclickable-bu…
Browse files Browse the repository at this point in the history
…tton

[0.14.0] Hide continue button on delete dialog if no sources selected.
  • Loading branch information
zenmonkeykstop authored Nov 13, 2024
2 parents fbf91f4 + dfbbfca commit a6e2140
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 a6e2140

Please sign in to comment.