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

Downlod replies #114

Merged
merged 6 commits into from
Nov 7, 2018
Merged

Downlod replies #114

merged 6 commits into from
Nov 7, 2018

Conversation

joshuathayer
Copy link
Contributor

@joshuathayer joshuathayer commented Nov 6, 2018

Building off #99, also spawn a thread for downloading and processing Replies from the journalist.

Aside from some minor refactoring to pull out common code between the Message the Reply fetching threads, there's not much novel here. It follows the Message-fetching model pretty closely.

Closes #108

@@ -246,6 +246,13 @@ def find_new_submissions(session):
return submissions


def find_new_replies(session):
submissions = session.query(Reply) \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

s/submissions/replies

"""Mark reply as downloaded in the database. The file itself will be
stored in the data directory.
"""
submission_db_object = session.query(Reply) \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same, s/submission/reply

@redshiftzero
Copy link
Contributor

@joshuathayer and I reviewed this in person, looks good! Will test in Qubes and plan to merge this in for inclusion in the first securedrop-client deb

(To the interested observer, the advantage of having these separate reply and message threads is parallel download/decrypt happening for replies and messages, cc: #106)

@redshiftzero
Copy link
Contributor

hey so I was on this branch and I hit this error:

Running app with home directory: /var/folders/gv/2r10zvfj303fyd5_6yn_p0b80000gn/T/tmp.EEN4XTsi
Traceback (most recent call last):
  File "/Users/redshiftzero/Documents/Github/securedrop-client/securedrop_client/gui/main.py", line 158, in on_source_changed
    self.show_conversation_for(self.current_source)
  File "/Users/redshiftzero/Documents/Github/securedrop-client/securedrop_client/gui/main.py", line 189, in show_conversation_for
    "<Reply not yet downloaded>")
  File "/Users/redshiftzero/Documents/Github/securedrop-client/securedrop_client/gui/main.py", line 167, in add_item_content_or
    adder(item.content)
  File "/Users/redshiftzero/Documents/Github/securedrop-client/securedrop_client/models.py", line 24, in content
    return self.data.get(fn_no_ext)
  File "/Users/redshiftzero/Documents/Github/securedrop-client/securedrop_client/data.py", line 16, in get
    msg = fh.read()
  File "/Users/redshiftzero/.virtualenvs/securedrop-client-l0Id-Ywn/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: unexpected end of data

The decrypted replies are getting written to the data directory but they are only one byte long.. I have to run but I will work on debugging this first thing tomorrow (if someone else notices the issue, please comment!)

@joshuathayer
Copy link
Contributor Author

@redshiftzero, I can take a look at this problem this morning.

@redshiftzero
Copy link
Contributor

figured it out, it was indeed non-Qubes only due to the development test data: freedomofpress/securedrop#3927 resolves

Copy link
Contributor

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

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

✅ tested in Qubes and non-Qubes (macOS) successfully

@redshiftzero redshiftzero merged commit 29de99b into master Nov 7, 2018
@redshiftzero redshiftzero deleted the download_replies branch November 7, 2018 23:49
legoktm pushed a commit that referenced this pull request Dec 15, 2023
Now we are passing the given timeout value in any API call to
the proxy object in Qubes.
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.

Add reply downloading, decryption, and display in conversation view
2 participants