Skip to content

Commit

Permalink
Fix for displaying quote based messages in conversation
Browse files Browse the repository at this point in the history
In conversation, messages with single quote (') or double quote(") quote
wasn't rendered correct. It was difficult for journalist to read those
messages. This commit is fixing that problem of parsing quote based
messages and improves readability of the text in the conversation.

Resolves: #175
  • Loading branch information
ultimatecoder committed Nov 17, 2018
1 parent 267957d commit d5a2831
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def __init__(self, text):
super().__init__()
layout = QVBoxLayout()
self.setLayout(layout)
message = QLabel(html.escape(text))
message = QLabel(html.escape(text, quote=False))
message.setWordWrap(True)
layout.addWidget(message)

Expand Down
10 changes: 10 additions & 0 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,16 @@ def test_SpeechBubble_html_init():
mock_label.assert_called_once_with('<b>hello</b>')


def test_SpeechBubble_with_apostrophe_in_text():
"""Check Speech Bubble is displaying text with apostrophe correctly."""
with mock.patch('securedrop_client.gui.widgets.QLabel') as mock_label, \
mock.patch('securedrop_client.gui.widgets.QVBoxLayout'), \
mock.patch('securedrop_client.gui.widgets.SpeechBubble.setLayout'):
message = "I'm sure, you are reading my message."
SpeechBubble(message)
mock_label.assert_called_once_with(message)


def test_ConversationWidget_init_left():
"""
Check the ConversationWidget is configured correctly for align-left.
Expand Down

0 comments on commit d5a2831

Please sign in to comment.