Skip to content

Make newlines visible in deleted messages#304

Merged
eivl merged 3 commits into
masterfrom
deleted-messages-visible-line-endings
Mar 1, 2020
Merged

Make newlines visible in deleted messages#304
eivl merged 3 commits into
masterfrom
deleted-messages-visible-line-endings

Conversation

@SebastiaanZ
Copy link
Copy Markdown
Contributor

This pull requests makes the newlines in deleted messages visible using the symbol. This should make it easier to correctly judge the deleted messages that show up in our deleted messages front-end.

Screenshot

linebreak_example


In addition, I've kaizened the colour filter that translates integer representations of colours to their RGB hex-value. The Discord dark theme shows black colours (int: 0; hex: #000000) as white (#FFFFFF) to make reading text having that color easier against the dark background. This pull request makes sure our front-end displays the same behavior.


This pull request closes #302

#302

This commit makes newlines in deleted messages visible in the deleted
messages front-end and makes sure they are not stripped during the
conversion to HTML. To represent newlines, I've chosen a commonly
used symbol: `↵`.

In addition, I've kaizened the colour filter that translates integer
representations of colours to their RGB hex-value. The Discord dark
theme shows black colours (int: 0; hex: #000000) as white instead, to
make reading them against the dark background easier. This commit
makes sure our front-end displays the same behavior.

This closes #302
@SebastiaanZ SebastiaanZ added enhancement area: frontend Related to site content and user interaction labels Oct 31, 2019
@jchristgit jchristgit self-requested a review November 4, 2019 20:07
@jchristgit jchristgit self-assigned this Nov 4, 2019
Copy link
Copy Markdown

@aeros aeros left a comment

Choose a reason for hiding this comment

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

I definitely approve of the unit test output changes, particularly with organizing them into subtests, and iterating over a tuple of actual and expected results instead of a wall of self.assertEqual(). Here's a couple of minor suggested improvements along the same lines (making the tests more readable and easier to debug), feel free to rename the vars or reformat:

Comment on lines +32 to +34
for colour, hex_value in test_values:
with self.subTest(colour=colour, hex_value=hex_value):
self.assertEqual(deletedmessage_filters.hex_colour(colour), hex_value)
Copy link
Copy Markdown

@aeros aeros Nov 7, 2019

Choose a reason for hiding this comment

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

         for colour, hex_value in test_values:
             actual_hex = deletedmessage_filters.hex_colour(colour)
             with self.subTest(colour=colour, actual_hex=actual_hex, 
                                             expected_hex=hex_value):
                 self.assertEqual(actual_hex, expected_hex)

This has no functional difference, but it would make it easier to tell at a glance what the issue was if/when the tests fail. I find that making use of the var names also helps to self-document the exact purpose of the tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't the AssertionError message for an assertEqual test already contain both values?

Comment on lines +64 to +66
for input_, expected_output in test_values:
with self.subTest(input=input_, expected_output=expected_output):
self.assertEqual(deletedmessage_filters.visible_newlines(input_), expected_output)
Copy link
Copy Markdown

@aeros aeros Nov 7, 2019

Choose a reason for hiding this comment

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

        for text, expected_output in test_values:
            actual_output = deletedmessage_filters.visible_newlines(text)
            with self.subTest(text=text, actual_output=actual_output, 
                                            expected_output=expected_output):
                self.assertEqual(actual_output, expected_output)

@MarkKoz MarkKoz added type: feature New feature or request and removed type: enhancement labels Dec 15, 2019
@jb3 jb3 requested review from a team, Inveracity, ikuyarihS and jb3 and removed request for a team and Inveracity February 2, 2020 20:18
Copy link
Copy Markdown
Contributor

@lemonsaurus lemonsaurus left a comment

Choose a reason for hiding this comment

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

I think we should get this merged.

Copy link
Copy Markdown
Contributor

@eivl eivl left a comment

Choose a reason for hiding this comment

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

Approved on the basis that we are sure that we only need to check for pure black.

@SebastiaanZ SebastiaanZ requested a review from a team as a code owner March 1, 2020 11:42
@eivl eivl merged commit 5e4027b into master Mar 1, 2020
@eivl eivl deleted the deleted-messages-visible-line-endings branch March 1, 2020 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: frontend Related to site content and user interaction type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make newlines visible in the deleted messages front-end

7 participants