Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add action to (re-)generate and export conversation transcript #1624

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

gonzalo-bulnes
Copy link
Contributor

@gonzalo-bulnes gonzalo-bulnes commented Feb 3, 2023

Description

The shortest path to providing an option to export a conversation transcript to journalists.

Context

This is a direct continuation of #1621, the same context applies.

Implementation

  • Takes the existing export dialog as a reference
  • Follows the existing patterns for testing it

Test plan

  1. Start the app
  2. Select a conversation
  3. For good measure download a file or two
  4. Trigger "Export Conversation Transcript" in the conversation menu (a.k.a source menu, kebab menu...)
  • Confirm that the dialog says it will export conversation.txt
  • Confirm the file is exported as expected
  • Confirm that error messages are shown in the same ways as in the existing export dialog

(I can provide guidance for a lightweight tests like I did for #1621, but since exporting doesn't depend on hard to get hardware, I think we should eventually test the feature using an actual USB drive. Edit: here is the patch.)

@gonzalo-bulnes
Copy link
Contributor Author

@cfm I have a few questions about a failing test that doesn't seem related (but probably is, somehow 🤨), but this PR is ready for a first review. 🙂

@gonzalo-bulnes gonzalo-bulnes marked this pull request as ready for review February 3, 2023 10:35
@gonzalo-bulnes gonzalo-bulnes requested a review from a team as a code owner February 3, 2023 10:35
@rocodes rocodes self-assigned this Feb 6, 2023
@rocodes
Copy link
Contributor

rocodes commented Feb 6, 2023

(Just linking to the issues that should resolve the bookworm failures: freedomofpress/securedrop-builder#412, #1623; will do initial review while those get sorted)

@gonzalo-bulnes
Copy link
Contributor Author

@rocodes I added the patch to the PR description in case you want to test this without a Workstation / USB drive. ☝️

@gonzalo-bulnes
Copy link
Contributor Author

@rocodes The Bookworm failures are not a blocker for this PR. They're intentionally not required.

@rocodes
Copy link
Contributor

rocodes commented Feb 7, 2023

Hi @gonzalo-bulnes, thanks for preparing this PR. I have stepped through it and have a quick question before I do a more detailed code review: unlike the ExportDialog from which it inherits, it looks like the ExportTranscriptDialog does not provide user feedback after the USB password prompt. Is this intentional?

For example, entering the wrong password in the password dialog does not show a user-visible error, and entering the correct password successfully exports the conversation transcript and unmounts the drive, but does not inform the user that the action succeeded.

(STR: staging setup, latest .deb from sd-devices built and installed manually; cloned the client repo in sd-app, checked out this branch, and ran it via python -m securedrop_client).

@gonzalo-bulnes
Copy link
Contributor Author

(rebased without changes)

@gonzalo-bulnes
Copy link
Contributor Author

I'm done touching this until you submit your review @rocodes 🙂

Copy link
Contributor

@rocodes rocodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gonzalo-bulnes, thanks for preparing.

  • Print functionality working well
  • I'll retest the export transcript functionality shortly
  • I've left one comment for discussion about export_service
  • I think additional functional testing might be beneficial here. I'm looking into that based on similar tests (for delete source, from the same Qaction menu, or for exporting a file)

securedrop_client/gui/actions.py Outdated Show resolved Hide resolved
@gonzalo-bulnes gonzalo-bulnes force-pushed the export-conversation-transcript branch 2 times, most recently from e9aeb5a to 3796ea9 Compare February 9, 2023 03:41
- Enforces the usage of the export.Service instance as a singleton.
- Removes the need to inject it as a dependency through the widget tree.

References:

- Pattern: logging.getLogger
- The Qubes OS API responses cannot be attributed to any given command
  or query if the API is used concurrently.
  See freedomofpress/securedrop-export#112
@gonzalo-bulnes
Copy link
Contributor Author

(squashed the three commits that your had already reviewed @rocodes — and kept the export.getService() commits apart)

Copy link
Contributor

@rocodes rocodes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test plan

  • Transcript can be exported successfully, confirmation message shown
  • Transcript can be printed successfully
  • Improper export device yields correct error msg
  • Bad device passphrase reprompts for passphrase
  • No/misconfigured printer yields printer error dialog
  • Transcript before files are downloaded shows generic file-counter name (3-source-designator-doc.gz.gpg); transcript after files are downloaded shows decrypted file name (memo.txt)
  • Tests are passing locally and on CI

@rocodes rocodes merged commit b3b3060 into main Feb 9, 2023
@rocodes rocodes deleted the export-conversation-transcript branch February 9, 2023 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants