English
Checkpoint
What must work
Run in Source/Chatex.Web:
powershell
npm run buildpowershell
npm test -- --watch=falsepowershell
npm run lintpowershell
npm run format:checkFrom the repository root, the whole project:
powershell
./Run.ps1 testThe client is complete. Compare it with the reference:
powershell
git diff --no-index --stat Source/Chatex.Web/src D:\Work\Chatex-Reference\Source\Chatex.Web\srcpowershell
git diff --no-index --stat Source/Chatex.Web/public D:\Work\Chatex-Reference\Source\Chatex.Web\publicBoth print nothing, and so do the configuration files of topic 15. The folders node_modules, dist and .angular are local build output and are ignored by Git.
Commit:
powershell
git add .powershell
git commit -m "Add the chat info panel, adding members, user profiles and the settings page"Module 5 is complete: Chatex has a full browser client. Module 6 tests and builds it in CI and deploys it with the API to an Ubuntu server.
Common mistakes
Table 21.2. Common mistakes in chat info and settings
| Symptom | Cause | Fix |
|---|---|---|
the info button leads back to /chats | the info child route is missing under chats/:chatId | add it as in the final app.routes.ts |
the panel never appears, although the URL ends in /info | the conversation page has no <router-outlet /> for its children | keep the outlet after the conversation's section |
| a new photo shows only after a reload | the cached blob URL was not invalidated | call blobs.invalidate(avatarUrl.user(id)) (or .chat(id)) after the upload |
| the profile form loses the user's typing when the profile changes elsewhere | the effect resets the form even when it is dirty | reset only while profile.pristine |
| after leaving a chat, the toast "You no longer have access to this chat" appears | chats.remove(id) announces the removal | call remove(id, false) when the user left or deleted the chat here |
| the member list does not update when someone joins | the effect does not depend on memberCount | read this.chat()?.memberCount in the effect |
Self-check questions
- Why is the settings page split into independent forms? What would one big form make harder?
- Why does the profile effect check
pristinebefore resetting the form? - What has to happen after an avatar upload so that every avatar of the user on screen changes?
- Why does changing the password end the session on the client too?
- Why is the chat info panel a child route and not a dialog?
- How does the panel get
:chatIdof its parent route? - How does one component become a full screen, a drawer and a docked column?
- Why does the panel compute the member actions in the class instead of the template?
- How does the member list notice that someone joined while the panel is open?
- Which checks does the client make before an action, and why does the server still decide?
Exercises
- Delete instead of leave. For a channel owner who is the only member, offer "Delete channel" in the toast that
owner_must_transfershows. Which information does the panel need to know that nobody else could take over? - Copy the invite link. Add a "Copy link" item for public chats that copies
https://<host>/chats/<id>with the CDKClipboardand shows a toast. What does a user who is not a member see when they open the link? - A component test. Write
settings.page.spec.tswith fakes forAuthService,ProfileApi,ToastServiceandDialogs: entering a wrong current password must show "The current password is wrong." under the field when the API answers400with the codewrong_password.