Skip to content

Messages and calls: class groups, mentors, reactions, capstone team chat and video calls (combines #2070, #2078, #2080-#2082, #2084, #2088) - #2091

Open
svaka2000 wants to merge 34 commits into
Open-Coding-Society:mainfrom
svaka2000:feat/messages-and-calls
Open

svaka2000 wants to merge 34 commits into
Open-Coding-Society:mainfrom
svaka2000:feat/messages-and-calls

Conversation

@svaka2000

Copy link
Copy Markdown
Contributor

I had seven open PRs for Messages, the capstone team chat and calls, so I put them into one. It's about 86 files, but each old PR's commits are merged in as they were, one merge commit each, so you can still look at them one at a time. The only new changes are one test conflict and two small fixes, under "How I combined them".

What it needs from Spring:

Class groups in Members (was #2088)

  • In a class group (CSSE, CSP, CSA or CSH), only teachers and admins see Add and Remove in Members, because spring#315 makes Spring refuse anyone else. Everyone else sees who is in the class.

A student's Members dialog on CSA, with the member list and no Add or Remove

What a mentor gets in Messages (was #2082)

  • A mentor is an account with ROLE_MENTOR, someone a teacher verified to help a capstone team. Messages hides what Spring won't let them do: no direct messages, no Find or make button for groups, and no adding or removing members. They keep their team groups and alerts.
  • New chat leaves out mentors, since Spring doesn't let anyone start a DM with one. When Spring refuses a send, a new chat or a member change under a mentor rule, the page says why instead of "try again".
  • Members marks who is a mentor.

A mentor's /dm: only their team group, and the Direct messages list says it's off

Reactions (was #2084)

  • You can react to a message in a DM or group chat with one of six emoji. The chips count each reaction, hovering one shows who, and clicking yours takes it back. Spring keeps them.

The row of reactions open under a message's action bar

Team chat on a capstone page (was #2080)

  • A capstone post can show its team's group chat from Messages. The post names the group in capstone_project.team_group and adds {% include projects/capstone/capstone-team-chat.html %}. It's on for our Communication Systems page.

The team chat on the Communication Systems page, with a mentor's message

The team's mentors (was #2081)

  • Under the team chat, the page lists the team's mentors. Teachers, and team members who aren't mentors, can add or remove mentors a teacher verified. Mentors only see the list.

A group member's view: the chat and the Mentors list with Find a mentor

Video calls (was #2070)

  • /calls/ has a call for each group, DM and class: a lobby, everyone's camera, the chat and a People list. A group or DM in /dm gets a Call link.
  • Spring never lets a mentor and a student be in a call without a teacher. Whoever comes second waits in the lobby, and if the last teacher leaves, the mentor is paused. A teacher can pause, remove or end.
  • While calls are off, /calls/ only says so, and the calls code adds nothing to /dm. A test checks that.

A call with three people, the People list and the chat

Push note in the AGENTS docs (was #2078)

  • A pin is saved as a [[pin:…]] marker in the message. The AGENTS docs say a DM's push notification shows that raw marker until spring#314 merges.

How I combined them:

How to try it:

  1. Run Spring from spring#315's branch (it has spring#314 in it), Flask and the site, and sign in as a student.
  2. In /dm, react to a message and reload: it stays. Open Members on your class group: there's no Add or Remove.
  3. Sign in as an account with ROLE_MENTOR (set it in Spring's database) that's in a team group: there's no New chat or Find or make, and Members has no Remove.
  4. Make a group named exactly "OCS Comm and Cap" with a couple of students, then open /capstone/communication-system/ as one of them: the team chat and the Mentors list are there.
  5. For calls (spring#287 is already merged), set calls.enabled=true and the LIVEKIT_ lines in Spring's .env, run LiveKit, turn calls on in _config.yml, then open a group in /dm and click Call.

- /calls/?group=, ?dm= and ?course= open that place's call through
  Spring's /api/calls (spring#287): a lobby with your camera, then a cell
  per person, a toolbar, and the group's chat and people beside it.
- Built from the OCS grammar only (ocs__grid--col2 or --card,
  ocs__embed--video, ocs__avatar, ocs__status-pill, ocs__viewer,
  ocs__split--aside-end), with every word in data/calls.yml.
- The safety rules show on the page: a mentor waits in the lobby until a
  teacher is in, and someone paused sees why.
- A teacher can pause, resume or remove someone, and end the call for
  everyone, each after a confirm.
- Messages gets a Call link in a group's or DM's header, and a line while
  a call is on there, shown only after Spring confirms it.
- Off by default: calls: enabled: false in _config.yml, and a
  spring: false site shows none of it.
- The lobby's Mic and Camera wait while a join is on its way, and a Join
  waits for every device the lobby is still asking for, so each one is
  either sent or stopped.
- While someone waits for a teacher, Join and the toggles stay usable,
  and pressing Join keeps a single watch on the room.
- The lobby's status line sits above the preview, where it is seen, and
  its no-devices line goes once a camera or microphone works.
- While you're paused, everyone else shows as initials instead of frozen
  video.
- A teacher's Manage stays open while people talk and come and go, and
  keyboard focus stays on it when the people list redraws: the list
  redraws only when what it shows changes.
- The sound button can be pressed again after a failed try.
- A device that doesn't come back after a pause is reported.
- A body that can't be read is a CallsApiError too.
- The fake LiveKit stops a paused person's tracks, as livekit-client does.
- The docs show the calls switch as `enabled: true` under `calls:`.
  Written on one line, `calls: enabled: true` isn't valid YAML.
- CallsApi drops its method for Spring's live-calls list, which
  nothing on the page used.
A project post names its team's group in Messages with
capstone_project.team_group and places capstone-team-chat.html where
the chat goes. The page shows that group's chat (Messages'
mountGroupChat) with a link to the group in Messages: to its members,
to a mentor in the group once it has at least 2 members who aren't
mentors, and to teachers and admins. Anyone else gets a note saying
the chat is for the team.

Everyone looks for the group in their own groups first, and only a
teacher who isn't a member searches by name, so a mentor's browser
never calls a route Spring refuses mentors. Without team_group, or on a
Flask-only site, nothing renders. The words are in data/team_chat.yml.
The post names our team's group in Messages, OCS Comm and Cap, as
capstone_project.team_group and places the team chat below the
infograph. Inside the comms-infograph wrapper, infograph.scss would
restyle the chat (every class ending in -title is 2.75rem there).
The Shared panel note says Spring's push text still has raw markers, so a
DM pin pushes the marker. That stays true until Open-Coding-Society/spring#293
merges, so the note names it, in AGENTS.md and AGENTS_MD_DOCUMENTATION.md
alike.
A React button comes first in a message's action bar and opens a menu of
the six reactions (the composer's PopupMenu, ocs__menu). setReactions draws
a message's chips after what it shows and before the action bar; picking
your own reaction, or clicking your chip, takes it back. While a change is
saving, that message's reaction controls wait. A message without an id, a
deleted one and a pin note take none, and deleting a message or clearing
the log closes its menu. The new words are in the UI Builder's text.chat.
Once a conversation's history is drawn, the thread asks Spring for its
reactions and draws each message's chips, and asks again after the socket
reconnects, so reactions left or taken back while offline show. A
reactions frame redraws one message's chips, and a message a frame or your
own change redrew since the load began keeps that newer state. Picking a
reaction sends PUT, picking yours again sends DELETE, and a failure says
"Could not save your reaction. Try again." A read-only pane, or a host
whose API has no reaction calls, asks for none.
… the log's foot

As a column of six named items it was taller than a phone's log has room
for beside a message, so its first items were cut off. Now it is one row of
the six emoji, with each name kept as its button's name but not drawn.
Where there still isn't room under the action bar, it opens above.
The Messages README gets a Reactions section, the reaction routes and
frames under Endpoints, and reactions.js in its file list. AGENTS.md and
AGENTS_MD_DOCUMENTATION.md get the same Messages bullet: how reactions
look and load, that Spring keeps them (Open-Coding-Society/spring#302),
and that the reaction keys change together with Spring's Reaction enum.
…and Open-Coding-Society#2078 change

The calls page (Open-Coding-Society#2070) adds its frame case after the error case, and the
push-note PR (Open-Coding-Society#2078) edits the Shared panel bullet in both AGENTS files.
The reactions frame case now follows the delete case, and the reactions
bullet follows the GitHub cards bullet, so this merges cleanly with either
in any order.
The rows' fade kept itself in effect after it ended (fill mode both),
which made each row its own layer, and the action bar is its own layer
while it fades in. Either way the next message covered the open menu and
took its clicks, even on that message's Delete. The fade now fills only
backwards, and a row with focus in it (an open menu always has it) sits
above the rows after it. The menu's emoji stand upright in Chrome, and
your own reactions wear the grammar's hover tint.
A chip that had focus keeps it when its row is redrawn, and after a
reaction saves, focus that fell off the page goes back to that chip or
the React button. A click elsewhere closes a menu without taking focus
back to its button, which also scrolled the log up to it. The reaction
menu is a horizontal menu (Left and Right step through it) and marks
yours as checked items, and the chip row is left out of the log's live
announcements.
One set of messages changed since a load began was shared by every load,
so a catch-up for a chat you had left reset it and the open chat's older
answer could undo a newer frame. Each change now counts, and a load or
your own PUT's answer that started before a message's last change leaves
that message as it is; a load for a chat that's no longer open asks for
nothing. Read-only panes ignore reaction frames, and a saved reaction
clears only its own failure notice.
Spring lists a group to its mentor only once they're in it and it has
2 members who aren't mentors. So the page never got a team that was too
small, the team-too-small note could never show, and a mentor whose own
groups left the team out was told "A member can add you" even when they
were already in the group.

A mentor who doesn't see the chat now gets one note naming both steps,
and the page no longer counts members itself.
Under the team chat, everyone in it sees who mentors the team. A member
who isn't a mentor, or a teacher, can search for verified mentors
(people search, narrowed to ROLE_MENTOR accounts not in the group yet)
and add or remove them through the group's members routes. A mentor
sees the list only. When Spring refuses a change, the panel shows the
page's words for Spring's reason. Names are always set as text.
"Add at least 2 team members" was wrong for a group that already had
one. It now says the group needs at least 2 members who aren't mentors
before it can have a mentor, and that teammates are added in Messages.
A class group's members come from the classes on each student's Profile, and
spring#309 lets only teachers and admins change them through POST and DELETE
/api/groups/{id}/members/{personId}. Members now shows Add and Remove on a class
group only to them (canChangeMembers). Everyone else sees the list, without the
Action column. With the search hidden, createDialog focuses the close button, so
focus stays in the dialog. isClassGroup now trims the name before comparing, as
Spring's ClassGroupMembershipService does.
Allowances.for(me) mirrors Spring's rules for the page. Spring's
MentorRules keep an account with ROLE_MENTOR and no teacher or admin
role to its team's groups, so that account gets no New chat, no Find or
make, and no Remove or add search in Members. Its empty Direct messages
list says direct messages are off, the empty thread pane says to pick a
group, and Leave says a member can add them back. Allowances also holds
those words and shows or hides the buttons. The page passes its answers
to the shared modules, which never check the mentor role; a test fails
if one does.

New chat leaves out people Spring won't let anyone message, since
Spring refuses any direct message that includes one of them.

A refusal now carries Spring's reason with its status, uploads too. A
send, a New chat start or a member change that Spring refuses for a
mentor rule says why instead of asking to try again. Members marks the
members Spring says are mentors, and a dialog whose fields are all
hidden focuses Close.
…keeps its status

The page passed createThread two texts objects, and the later one (the
commands placeholder) replaced Allowances' words, so a mentor's empty
thread pane still offered New chat and Find a group. They're one object
now, and a test fails if a second appears.

A failed response whose body can't be read now keeps its status, with
no reason, instead of rejecting with the read error.
Spring refuses "message the owner" with mentor_no_direct_messages when
the page's owner or the visitor is a mentor. The block showed its
generic "Couldn't start a message. Try again." for that, so the visitor
kept trying. It now says a mentor would be in the message.
… check reads every module

"Add at least 2 people who aren't mentors" was wrong for a group that
already had one. It now says a group needs at least 2 members who
aren't mentors before it can have a mentor.

The test that keeps the mentor role out of shared code read 5 of the
42 modules. It now reads every one but allowances.js.
…roup rule

Open-Coding-Society#2088 hides Members' Action column on a class group for anyone who isn't
a teacher or admin, so the dialog now toggles the column's header, and
the tests give it one. A student no longer gets Add in a class group, so
the class-group refusal test opens the dialog as a teacher.
…ay pushes keep raw markers until the Spring fix
…chers and admins get Add and Remove in a class group
…e with an emoji

# Conflicts:
#	_projects/systems/messages/tests/thread.test.mjs
…is branch

test_calls_page.rb checks that /dm with calls off is byte for byte what it was
before calls' hook. It pinned upstream main 5b811b0, but main has changed dm.md
since then (the Shared button), and so do the Messages PRs merged here before
calls. It now pins this branch's merge of Open-Coding-Society#2081, the commit just before calls was
merged in.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant