Feature #11689

WhisperBack: Enforce 70 character limit on the user written messages

Added by emmapeel 2016-08-23 00:00:15 . Updated 2018-06-10 12:59:36 .

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Target version:
Start date:
2016-08-22
Due date:
% Done:

100%

Feature Branch:
Type of work:
Code
Blueprint:

Starter:
Affected tool:
WhisperBack
Deliverable for:

Description

We always need to reflow text when answering WhisperBack reports.

It would be great if the paragraphs written by the user are already ‘rewrapped’
when they arrive to frontdesk.

(not the logs, only the description of the user)


Files


Subtasks


Related issues

Related to Tails - Feature #7180: Remove the right pane of WhisperBack Resolved 2014-05-09
Related to Tails - Feature #13299: Make WhisperBack easier to find in the GNOME Overview Resolved 2017-06-30
Has duplicate Tails - Bug #7000: WhisperBack should wrap lines before encrypting reports Duplicate 2014-03-31

History

#1 Updated by intrigeri 2016-08-23 00:13:35

Please make sure that the technical information we’re attaching automatically (e.g. logs) are not reflowed: this makes it harder to read and analyze them.

And then there’s the technical info provided by the user, that will be reformatted according to this proposal. I’m not sure if the improvement brought by this proposal is worth this regression, but I have no strong opinion on that, so I’ll trust frontdesk to know better than me what they need :)

#2 Updated by emmapeel 2016-08-23 01:54:38

intrigeri wrote:
> Please make sure that the technical information we’re attaching automatically (e.g. logs) are not reflowed: this makes it harder to read and analyze them.
>
Yes, the text and description of the error by the user is the text I propose to be reflowed.

Not the logs.

#3 Updated by emmapeel 2016-08-23 02:06:38

  • Description updated

#4 Updated by Anonymous 2017-06-27 14:37:39

  • Description updated

#5 Updated by mercedes508 2017-11-25 18:16:08

  • Status changed from New to Confirmed

#6 Updated by sascha.markus@gmail.com 2018-05-08 20:58:19

Here is a patch to wrap the message.

#7 Updated by sascha.markus@gmail.com 2018-05-08 21:01:49

  • related to Bug #7000: WhisperBack should wrap lines before encrypting reports added

#8 Updated by emmapeel 2018-05-09 08:02:29

  • related to deleted (Bug #7000: WhisperBack should wrap lines before encrypting reports)

#9 Updated by emmapeel 2018-05-09 08:02:32

  • has duplicate Bug #7000: WhisperBack should wrap lines before encrypting reports added

#10 Updated by emmapeel 2018-05-09 08:03:33

  • Status changed from Confirmed to In Progress
  • QA Check set to Ready for QA

It looks it was a duplicated of the other ticket. I leave this one, though, because of the patch.

#11 Updated by emmapeel 2018-05-09 08:04:14

  • Subject changed from WhisperBack: Enforce 80 character limit to WhisperBack: Enforce 80 character limit on the user written messages

#12 Updated by sajolida 2018-05-15 17:06:21

  • Assignee deleted (alant)
  • Target version set to Tails_3.9

This ticket has been assigned to Alan since it’s creation, now that there is a patch I think it should be reviewed by someone else as part of the next major release.

#13 Updated by sajolida 2018-05-15 17:06:31

  • related to Feature #7180: Remove the right pane of WhisperBack added

#14 Updated by sajolida 2018-05-15 17:06:48

  • related to Feature #13299: Make WhisperBack easier to find in the GNOME Overview added

#15 Updated by sajolida 2018-05-15 17:06:59

  • is duplicate of deleted (Bug #7000: WhisperBack should wrap lines before encrypting reports)

#16 Updated by sajolida 2018-05-15 17:07:28

  • has duplicate Bug #7000: WhisperBack should wrap lines before encrypting reports added

#17 Updated by intrigeri 2018-05-24 09:37:56

  • Assignee set to intrigeri
  • Target version changed from Tails_3.9 to Tails_3.8

#18 Updated by intrigeri 2018-05-24 09:45:53

  • Subject changed from WhisperBack: Enforce 80 character limit on the user written messages to WhisperBack: Enforce 70 character limit on the user written messages
  • Assignee changed from intrigeri to sascha.markus@gmail.com
  • % Done changed from 0 to 20
  • QA Check changed from Ready for QA to Dev Needed

Thanks for the patch!

I did an initial code review:

  • Why wrap each line separately instead of wrapping the entire message in one go, which would plausibly produce a nicer, more readable, reflowed output?
  • If we really need to wrap each line separately, then perhaps we should follow the textwrap doc that reads “If you’re just wrapping or filling one or two text strings, the convenience functions should be good enough; otherwise, you should use an instance of TextWrapper for efficiency”.
  • Please wrap at 70 chars so that these lines don’t become too long once prepended by quoting markup later on. Sorry the ticket instructed you to do something different :/

#19 Updated by sascha.markus@gmail.com 2018-05-28 21:24:50

Here is a patch with enforced 70 characters.
It’s still using the line approach.

Besides of the patch I attached:

- The input text

- The output if I put wrap the whole text
- The output using the line by line code.

As everything is in one text input field and can be modified by the user there is no safe way to identify the paragraphs.
This could be changed if split the text into four individual inputs.

#20 Updated by intrigeri 2018-05-29 06:09:18

  • QA Check changed from Dev Needed to Ready for QA

#21 Updated by intrigeri 2018-05-29 07:15:50

  • Assignee changed from intrigeri to emmapeel
  • % Done changed from 20 to 60
  • QA Check changed from Ready for QA to Info Needed

sascha.markus@gmail.com wrote:
> Here is a patch with enforced 70 characters.
> It’s still using the line approach.

Code looks good to me. I’ve applied this locally, wrote an actual commit message, removed trailing whitespace added by your patch. I’ve sent a test report to our help desk and once they send it back to me, if happy I will push :)

Note that (even though I’m not a Python expert) the wrap_text implementation does not look very pythonic to me. I’ve thus applied this on top:

commit dbfbc35468d696e9e529de4d1837c019e08c8625 (HEAD -> master)
Author: intrigeri <intrigeri@boum.org>
Date:   Tue May 29 07:13:23 2018 +0000

    wrap_text: be more pythonic.

diff --git a/whisperBack/utils.py b/whisperBack/utils.py
index d06ad92..e387549 100644
--- a/whisperBack/utils.py
+++ b/whisperBack/utils.py
@@ -234,8 +234,5 @@ def wrap_text(text):
     @return The wrapped text"""

     wrapper = TextWrapper()
-    wrapped = list()
-    for line in text.split('\n'):
-        wrapped_line = wrapper.fill(line)
-        wrapped.append(wrapped_line)
+    wrapped = [wrapper.fill(line) for line in text.split('\n')]
     return '\n'.join(wrapped)

What do you think?

> As everything is in one text input field and can be modified by the user there is no safe way to identify the paragraphs.
> This could be changed if split the text into four individual inputs.

Fair enough!

#22 Updated by sascha.markus@gmail.com 2018-05-29 08:47:31

Indeed my code wasn’t pythonic. Looks much better now.

#23 Updated by intrigeri 2018-05-29 10:28:41

> Indeed my code wasn’t pythonic. Looks much better now.

Thanks for the review! :)

#24 Updated by intrigeri 2018-06-02 14:51:49

  • Status changed from In Progress to Fix committed
  • Assignee deleted (emmapeel)
  • % Done changed from 60 to 100
  • QA Check changed from Info Needed to Pass

Released in WhisperBack 1.7.16 that’s now on our stable and devel branches \o/

#25 Updated by intrigeri 2018-06-09 15:29:20

  • Target version changed from Tails_3.8 to Tails_3.7.1

#26 Updated by intrigeri 2018-06-10 12:57:15

  • Assignee set to BitingBird

#27 Updated by intrigeri 2018-06-10 12:57:50

  • Assignee deleted (BitingBird)

#28 Updated by intrigeri 2018-06-10 12:59:36

  • Status changed from Fix committed to Resolved