HomePhabricator
Diffusion Comm 5a8aad609b04

[lib] Prevent spoiler text from appearing in MessagePreview

Tags
None
Referenced Files
F259299: Native Dark After.png
Dec 5 2022, 12:41 PM
File Not Attached
F259298: Native Dark Before.png
Dec 5 2022, 12:41 PM
File Not Attached
F259300: Native Light After.png
Dec 5 2022, 12:41 PM
File Not Attached
F259301: Native Light Before.png
Dec 5 2022, 12:41 PM
File Not Attached
F259296: Web After.png
Dec 5 2022, 12:41 PM
File Not Attached
F259297: Web Before.png
Dec 5 2022, 12:41 PM
File Not Attached
Subscribers
None

Description

[lib] Prevent spoiler text from appearing in MessagePreview

Summary:
With the implementation of Spoilers on both web and native, we want to prevent the spoiler text from being revealed in MessagePreview on both platforms. This diff handles replacing the text enclosed with spoiler characters with three black squares, as discussed in the parent tasks for Spoilers, ENG-1472. We previously thought about replacing the spoilers with black square emojis.

The idea with this diff is to "intercept" the raw message text before it is parsed for markdown rules, so we can replace the text enclosed within || ... || before the spoiler characters are removed for the message preview.

Context Diff

Addresses ENG-2193
Addresses ENG-2055

Test Plan:
[Web]:

  1. Restart keyserver and web
  2. Observe how spoilers are displayed in the message preview before the change
  3. Observe after the change
  4. Ensure other markdown functions as before

Web Before.png (1×2 px, 321 KB)

Web After.png (1×2 px, 318 KB)

[Native]:

  1. Restart keyserver and native
  2. Observe how spoilers are displayed in the message preview before the change
  3. Observe after the change
  4. Ensure other markdown functions as before
  5. Check how the change looks in both light and dark mode

 Native Light Before.png (2×1 px, 254 KB)

 Native Light After.png (2×1 px, 254 KB)

 Native Dark Before.png (2×1 px, 250 KB)

 Native Dark After.png (2×1 px, 251 KB)

Reviewers: atul, ginsu, ashoat

Reviewed By: ashoat

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D5715

Details

Provenance
rohanAuthored on Dec 5 2022, 10:34 AM
Reviewer
ashoat
Differential Revision
D5715: [lib] Prevent spoiler text from appearing in MessagePreview
Parents
rCOMM333cd87889de: [web] Disable 'change password' button until text inputs are not empty
Branches
Unknown
Tags
Unknown