HomePhabricator
Diffusion Comm 3fdb12d33cde

[web] Call `create_thread` from `CommunityCreationModal` on form submission

Tags
None
Referenced Files
F541697: ab425e.png
May 16 2023, 3:09 PM
File Not Attached
F541696: e7805b.png
May 16 2023, 3:09 PM
File Not Attached
F541695: 705b95.png
May 16 2023, 3:09 PM
File Not Attached
Subscribers
None

Description

[web] Call create_thread from CommunityCreationModal on form submission

Summary:
We send a request to the create_thread endpoint with the community name and announcement setting selected by the user in CommunityCreationModal.

We show a spinner when the request is loading.

We display an error message and style the button if the request fails. The error message and styling is cleared when:

  1. The user makes a change to any of the inputs (name or announcement).
  2. The user clicks the button and re-attempts submitting the form.

If the request succeeds, we navigate to the newly created community root thread.

In subsequent diff we will bring up an "Add members" modal (after a small delay?) after displaying the newly created thread.

Test Plan:
Tested "happy case" by creating multiple communities and ensuring that they were created as expected by checked threads table and navigating to them in the web app.

705b95.png (2×620 px, 179 KB)

Also modified threadCreationResponder to immediately throw new ServerError("Error") to simulate request failure case. Ensured that errorMessage + button styling appeared as expected. Then updated the endpoint to return successfully, retried request, and ensured it went through as expected.

e7805b.png (1×1 px, 115 KB)

ab425e.png (2×1 px, 157 KB)

Reviewers: ashoat, ginsu

Reviewed By: ashoat

Subscribers: tomek

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

Details

Provenance
atulAuthored on May 16 2023, 3:08 PM
Reviewer
ashoat
Differential Revision
D7847: [web] Call `create_thread` from `CommunityCreationModal` on form submission
Parents
rCOMM7b3dc8969c6d: [lib] fix pinned content for non-media messages
Branches
Unknown
Tags
Unknown