Page MenuHomePhabricator

[native] Warn the user when deleting a chat that has contained chats
ClosedPublic

Authored by patryk on Jul 21 2023, 7:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jul 4, 12:11 PM
Unknown Object (File)
Mon, Jul 1, 3:17 AM
Unknown Object (File)
Mon, Jul 1, 2:08 AM
Unknown Object (File)
Sat, Jun 29, 4:32 PM
Unknown Object (File)
Fri, Jun 28, 9:19 PM
Unknown Object (File)
Mon, Jun 24, 2:42 PM
Unknown Object (File)
Sat, Jun 15, 8:01 PM
Unknown Object (File)
Fri, Jun 14, 7:39 AM
Subscribers

Details

Summary

Part of ENG-4319.

Before deletion, the user is warned about possible contained chats. For subchannel deletion, the modal looks like this:
iOS:

131415.png (956×453 px, 136 KB)

Andriod:
456.png (718×340 px, 60 KB)

When deleting a whole community, message changes:
iOS:
101112.png (956×453 px, 138 KB)

Android:
123.png (718×340 px, 60 KB)

When there are no contained chats, the confirmation modal does not pop up.

Depends on D8526.

Test Plan

Same as D8530 test plan.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

patryk held this revision as a draft.
patryk edited the test plan for this revision. (Show Details)
patryk added reviewers: bartek, tomek, inka.
patryk attached a referenced file: F648099: 131415.png. (Show Details)
patryk attached a referenced file: F648100: 456.png. (Show Details)
patryk attached a referenced file: F648101: 101112.png. (Show Details)
patryk attached a referenced file: F648102: 123.png. (Show Details)
native/chat/settings/delete-thread.react.js
146 ↗(On Diff #28930)

This shouldn't say community when you are deleting a normal chat

ashoat requested changes to this revision.Jul 27 2023, 1:47 PM

This code has a lot of issues

native/chat/settings/delete-thread.react.js
62 ↗(On Diff #28930)

Why is this ?boolean? In what scenario will it be null or undefined?

77 ↗(On Diff #28930)

This is not idiomatic React.

  1. I'm not sure if this.props is even set when this is called
  2. Even if it is set, your approach here is based on the value at construction, which may change later. Instead, you should implement a function getDeletionTargetText that checks the value at invocation time
143 ↗(On Diff #28930)

Why the ? after this.props? I'm pretty sure this.props is always set inside a React class component

143–155 ↗(On Diff #28930)

You can reduce indentation and simplify the code here. See here

146 ↗(On Diff #28930)

I agree – see comment here

284 ↗(On Diff #28930)

This condition appears to technically be correct, but undefined > 0 is not a very "readable" condition... most JS developers have no idea how this evaluates. Can you rework the condition so it's more clear?

This revision now requires changes to proceed.Jul 27 2023, 1:47 PM
patryk added inline comments.
native/chat/settings/delete-thread.react.js
62 ↗(On Diff #28930)

I initially intended to make this prop optional in case someone wanted to reuse this component elsewhere. However, this approach may be slightly over-engineered -> will remove it in a next diff.

patryk edited the summary of this revision. (Show Details)

Rework code, use new Alert wrapper.

Accepting, but please address inline comment before landing

native/chat/settings/delete-thread.react.js
142–148 ↗(On Diff #29257)

This appears to be the same as on web. Please factor this out instead of using copy-paste. You should endeavor to use copy-paste as little as possible (ideally never do it)

This revision is now accepted and ready to land.Jul 31 2023, 10:34 AM

Use getThreadsToDeleteText function from lib.