Page MenuHomePhabricator

[Cashtab] Hide messages from unknown senders behind button
AbandonedPublic

Authored by kieran709 on May 10 2022, 18:32.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Summary

A setting should be added to allow users to hide messages from addresses not in their contacts list behind a 'show message' button. Related to T2418.

Test Plan

cd web/cashtab && npm start
in the browser:
observe that all messages are visible by default
navigate to settings tab and toggle 'show messages' off
receive a cashtab message from an address not in contact list
receive an encrypted message from an address not in contact list
receive a message from an address that IS in contact list
receive an encrypted message from an address that IS in the contact list

from the home tab:
observe that mesages from contacts are displayed
observe that the 'show message' button is displaying for messages that aren't from contacts
click the 'show message' button on both the encrypted and unencrypted message
observe that the messages are displayed, along with a warning that the sender is not a contact

note: changes are planned for this diff

Diff Detail

Repository
rABC Bitcoin ABC
Branch
hide-unknown-sender-msgs
Lint
Lint Warnings
SeverityLocationCodeMessage
Warningweb/cashtab/src/components/Configure/Configure.js:1808SPELL1Possible Spelling Mistake
Unit
No Test Coverage
Build Status
Buildable 18986
Build 37734: Build Diffcashtab-tests
Build 37733: arc lint + arc unit

Event Timeline

Failed tests logs:

====== CashTab Unit Tests: Validation utils Recognizes a valid cashtab settings object ======
Error: expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false
    at Object.<anonymous> (/work/web/cashtab/src/utils/__tests__/validation.test.js:267:11)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:60:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

Each failure log is accessible here:
CashTab Unit Tests: Validation utils Recognizes a valid cashtab settings object

Failed tests logs:

====== CashTab Unit Tests: Validation utils Recognizes a valid cashtab settings object ======
Error: expect(received).toBe(expected) // Object.is equality

Expected: true
Received: false
    at Object.<anonymous> (/work/web/cashtab/src/utils/__tests__/validation.test.js:267:11)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:60:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Wallet with BCH balances and tokens ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Wallet with BCH balances and tokens 1`

- Snapshot  - 1
+ Received  + 1

@@ -489,11 +489,11 @@
              <path
                d="M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0zm152-237H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224z"
              />
            </svg>
          </span>
-          Show Msgs From Unkown Sender
+          Show Msgs From Unknown Sender
        </div>
        <button
          aria-checked={true}
          className="ant-switch ant-switch-small ant-switch-checked"
          onClick={[Function]}
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:43:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)
====== CashTab Unit Tests:  Without wallet defined ======
Error: expect(received).toMatchSnapshot()

Snapshot name: `Without wallet defined 1`

- Snapshot  - 1
+ Received  + 1

@@ -489,11 +489,11 @@
              <path
                d="M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0zm152-237H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224z"
              />
            </svg>
          </span>
-          Show Msgs From Unkown Sender
+          Show Msgs From Unknown Sender
        </div>
        <button
          aria-checked={true}
          className="ant-switch ant-switch-small ant-switch-checked"
          onClick={[Function]}
    at Object.<anonymous> (/work/web/cashtab/src/components/Configure/__tests__/Configure.test.js:63:18)
    at Promise.then.completed (/work/web/cashtab/node_modules/jest-circus/build/utils.js:391:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/work/web/cashtab/node_modules/jest-circus/build/utils.js:316:10)
    at _callCircusTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:218:40)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at _runTest (/work/web/cashtab/node_modules/jest-circus/build/run.js:155:3)
    at _runTestsForDescribeBlock (/work/web/cashtab/node_modules/jest-circus/build/run.js:66:9)
    at run (/work/web/cashtab/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:170:21)
    at jestAdapter (/work/web/cashtab/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:82:19)
    at runTestInternal (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:389:16)
    at runTest (/work/web/cashtab/node_modules/jest-runner/build/runTest.js:475:34)
    at Object.worker (/work/web/cashtab/node_modules/jest-runner/build/testWorker.js:133:12)

Each failure log is accessible here:
CashTab Unit Tests: Validation utils Recognizes a valid cashtab settings object
CashTab Unit Tests: Wallet with BCH balances and tokens
CashTab Unit Tests: Without wallet defined

Fixed isValidCashtabSetting in validation.test.js

  1. Default behavior should be not to change a setting, so this logic should be reversed

image.png (149×470 px, 17 KB)

e.g. the setting option should be "Hide messages from unknown senders" and it should be off by default.

  1. The 'reply to message' button should not be visible if the message is not shown

image.png (140×469 px, 12 KB)

  1. Clicking "show message" should have an elegant effect to expand and reveal the msg, not content jumping. May be able to do this with only css transition properties. Don't use a collapse component. If it won't work with pure css, then create a task to do this separately.
  1. Create a task to get rid of all these classNames in the <GeneralSettingsItem> components + replace with styled components
This revision now requires changes to proceed.May 16 2022, 15:59

Default behaviour is changed, setting is now 'Hide messages from unkown senders', and its default state is off. The Reply to Message button is not shown if the message is hidden. Clicking 'show message' includes an transition effect on max-height. Updated snapshots and rebased to master.

This seems to impact the ability to receive encrypted msgs.

user story

arc patch 11440
npm start

Cashtab loads showing an encrypted msg received yesterday as in the screenshot

Send another encrypted msg to the tested wallet, issue repeats

I didn't change the showMessages toggle so must be something in the logic changes to Tx.js

image.png (506×485 px, 50 KB)

This revision now requires changes to proceed.May 25 2022, 18:48

This seems to impact the ability to receive encrypted msgs.

user story

arc patch 11440
npm start

Cashtab loads showing an encrypted msg received yesterday as in the screenshot

Send another encrypted msg to the tested wallet, issue repeats

I didn't change the showMessages toggle so must be something in the logic changes to Tx.js

image.png (506×485 px, 50 KB)

I'm seeing this in prod today too actually -- so it's a separate issue, disregard.

This seems to impact the ability to receive encrypted msgs.

user story

arc patch 11440
npm start

Cashtab loads showing an encrypted msg received yesterday as in the screenshot

Send another encrypted msg to the tested wallet, issue repeats

I didn't change the showMessages toggle so must be something in the logic changes to Tx.js

image.png (506×485 px, 50 KB)

In testing, this also seems related to T2459, so does not need its own task

image.png (179×479 px, 11 KB)

  • User should be able to see that this message is hidden because it is from an unknown sender

image.png (218×476 px, 20 KB)

  • Add padding between "Hide Message" and "Reply to Message" buttons
  • while we are at it, let's get a task in to change the text of "Reply to Message" button to just "Reply"
  • and while we're at that, in this diff please change text "Show Message" / "Hide Message" to "Show" / "Hide"

image.png (440×481 px, 31 KB)

  • It looks like this diff is hiding the "Reply to message" button from messages that do come from known senders