Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
96a4cd9
Reactions: keys, table and repository
svaka2000 Nov 22, 2026
8f749e9
Reactions: a service that saves and summarizes them
svaka2000 Nov 22, 2026
363242f
Reactions: react to a direct message
svaka2000 Nov 22, 2026
adb17e1
Reactions: react to a group chat message
svaka2000 Nov 22, 2026
bc79ac5
Group chat: a send keeps the history when S3 can't read it
svaka2000 Nov 22, 2026
5b99316
Group chat: two message writes at once keep both changes
svaka2000 Nov 22, 2026
7eb0e35
Reactions: document the routes and frames
svaka2000 Nov 22, 2026
9a3bf22
Group chat docs: a send reads its messages strictly
svaka2000 Nov 22, 2026
af1dba2
Group chat docs: message writes take a lock per group
svaka2000 Nov 22, 2026
fd1a44e
Mentors can't send or receive direct messages
svaka2000 Nov 19, 2026
457eb00
Push: a DM's notification shows its words, not the page's markers or …
svaka2000 Nov 23, 2026
1b7fb8d
Reactions: say who may make the six reaction requests
svaka2000 Nov 26, 2026
4b74634
Chat socket: drop client SENDs to every /topic destination
svaka2000 Nov 23, 2026
c1a3ab3
Mentors use only their team's group, and the team manages its mentors
svaka2000 Nov 19, 2026
68224a8
Mentors list and download shared files only in their team's group
svaka2000 Nov 20, 2026
fd20fdb
Mentors: the older chat, the UI Builder and a mentor's own list follo…
svaka2000 Nov 26, 2026
5e00000
Reactions: one-statement deletes, reactor names in one query, lowerca…
svaka2000 Nov 26, 2026
39e4061
Mentors: the chat socket's group events follow the rules too
svaka2000 Nov 26, 2026
c791798
Reactions: a DM's reactions frame goes out after the commit, read aga…
svaka2000 Nov 26, 2026
3e38849
Reactions: a table that can't be made is logged as an error
svaka2000 Nov 26, 2026
d6c2bfe
Docs: list the reaction tests before the chat regression tests
svaka2000 Nov 26, 2026
6818679
Older chat: only a group's members, teachers and admins read /api/chat
svaka2000 Nov 26, 2026
d9a74b4
Group chat tests: build the send test's controller from its construct…
svaka2000 Nov 26, 2026
6217936
Group files: answer 503 when S3 can't take the write
svaka2000 Nov 20, 2026
b30e611
Group chat: a restart keeps the history when S3 can't check it
svaka2000 Nov 22, 2026
f344706
Group chat: a send whose read times out answers 503 like a shared file
svaka2000 Nov 22, 2026
1bc72b0
Group chat docs: the start-up check writes only over a missing file
svaka2000 Nov 22, 2026
6a48a14
Group files: note that a write that timed out may still be stored
svaka2000 Nov 22, 2026
a8f1c65
Group chat: a send, edit or delete answers 503 when S3 can't save it
svaka2000 Nov 26, 2026
ee2af19
Group chat docs: sends, edits and deletes save their messages strictly
svaka2000 Nov 26, 2026
258b8f6
Group chat: a send or edit answers with the messages it saved
svaka2000 Nov 26, 2026
320171c
Group chat: a delete of a message that isn't saved answers 404 and te…
svaka2000 Nov 26, 2026
1cc5536
Group chat: a line that doesn't read as a message is kept when the fi…
svaka2000 Nov 26, 2026
8dfea9a
Group chat docs: a send or edit returns the history as it was saved
svaka2000 Nov 26, 2026
aac4ab9
Group chat docs: a delete of a message that isn't saved answers 404
svaka2000 Nov 26, 2026
d5c3852
Group chat docs: a line that doesn't read as a message is kept
svaka2000 Nov 26, 2026
3ff3444
Older chat: a mentor outside the group hears why a post is refused
svaka2000 Nov 26, 2026
db22511
Unread count: a mentor's leaves out the groups they may not use
svaka2000 Nov 26, 2026
8f478f0
Chat socket: only a mentor's events load their account
svaka2000 Nov 26, 2026
de44f73
Mentor docs: the unread count, the socket's sign-in roles, one test c…
svaka2000 Nov 26, 2026
7ecc349
Groups: check who adds or removes members, edits or deletes a group
svaka2000 Nov 26, 2026
95a2479
Group grades: only teachers, admins and the group's graders change them
svaka2000 Nov 26, 2026
b567f30
Group grades: only members, graders and staff read them
svaka2000 Nov 26, 2026
34de53d
Merge #296: Group chat: a lock per group so two sends at once can't l…
svaka2000 Nov 26, 2026
dd7982a
Merge #297: Group chat: a send returns 503 instead of wiping the hist…
svaka2000 Nov 26, 2026
c4ea6d7
Merge #298: Group chat: a restart no longer wipes a chat when S3 fail…
svaka2000 Nov 26, 2026
5d7a4c2
Merge #299: Group chat files: 503 instead of 500 when S3 can't store …
svaka2000 Nov 26, 2026
6697c9d
Merge fix/group-chat-strict-write: a send, edit or delete returns 503…
svaka2000 Nov 26, 2026
8d14a47
Merge fix/group-chat-answer-saved: a send or edit answers with the me…
svaka2000 Nov 26, 2026
44b3e59
Merge fix/group-chat-delete-unknown: deleting a message that isn't sa…
svaka2000 Nov 26, 2026
c4b030e
Merge fix/group-chat-keep-unreadable-lines: a line that doesn't read …
svaka2000 Nov 26, 2026
bb610c5
Merge #302: Chat reactions: react to a DM or group message with an emoji
svaka2000 Nov 26, 2026
9117d9d
Merge #293: Phone notifications: show a DM's words, not its markers o…
svaka2000 Nov 26, 2026
02ee508
Merge #295: Chat socket: drop client SENDs to every /topic destination
svaka2000 Nov 26, 2026
fc5bd65
Merge #303: Mentors: no direct messages, and only the groups they're …
svaka2000 Nov 26, 2026
c535fbb
Mentors: reactions follow the mentor rules
svaka2000 Nov 26, 2026
cdfbf65
Merge #309: Groups: check who adds or removes members, edits or delet…
svaka2000 Nov 26, 2026
ba0ccf3
Merge #310: Group grades: only teachers, admins and the group's grade…
svaka2000 Nov 26, 2026
dc5b8cc
Merge #312: Group grades: only members, graders, teachers and admins …
svaka2000 Nov 26, 2026
8fc7ef6
Group chat: a delete still tells the group when its reactions can't b…
svaka2000 Nov 26, 2026
a96152d
Merge the group chat branch's latest commit: a delete still tells the…
svaka2000 Nov 26, 2026
6aa4b6a
Reactions: a DM delete no longer rolls back when its reactions can't …
svaka2000 Nov 26, 2026
3fb778b
Merge the group chat branch's latest commit: a direct message delete …
svaka2000 Nov 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ Entity-removal helpers (run before any large cleanup):
- Course groups are the canonical uppercase list `CSA, CSP, CSH, CSSE`, configured as `courses.class-groups` plus `courses.periods[NAME]` in [application.properties](src/main/resources/application.properties) and bound by [CourseGroupProperties.java](src/main/java/com/open/spring/mvc/groups/CourseGroupProperties.java). That one config block drives both the `Groups` rows seeded by `ModelInit` and the class list `ClassGroupMembershipService` validates against, so course names and bell periods only need changing in one place. A single period can be overridden in `.env` (`courses.periods[CSA]=4`) because Spring merges map entries per key, whereas overriding `courses.class-groups` replaces the entire list. List order matters — it is the order memberships are returned in. Startup fails if a listed group has no period. Profile class selection syncs via `PUT /api/groups/class-memberships` (`GroupsApiController` → `ClassGroupMembershipService.syncMemberships`), which only adds/removes membership in those four groups and leaves all other groups untouched.
- Realtime chat uses STOMP over a **second connector on port 8589**: broker config in `WebSocketBrokerConfig.java` (`/ws-chat`, `/app`, `/topic`), port gating in `ChatWebSocketPortFilter.java`, presence in `GroupChatPresenceService.java`. The native `/websocket` endpoint in `mvc/mortevision/nativesocket/WebSocketConfig.java` is separate.
- Gotcha: Java package is `mvc.groups` (plural) but templates live in `templates/group/` (singular); static JS exists both as legacy files in `static/js/group-*.js` and packaged versions in `static/js/group/*.js` — prefer the latter.
- Mentors (`ROLE_MENTOR` without a teacher or admin role) are limited by `MentorRules` (static methods, `mvc/groups`) and `MentorAccess` (loads a group's members and whether it is a class group): no direct message that includes a mentor; a mentor uses only a non-class group they belong to with at least 2 members who aren't mentors; only the team or a teacher adds or removes a mentor, and a mentor adds no one. Refusals are 403 with a `reason`. The mentor rules leave everyone else's answers alone; the next line says who else may change a group. A new route that reads or writes a group's chat, or opens a direct message, must ask `MentorAccess` or `MentorRules` too, as the older `/api/chat` and the UI Builder's message-owner do. Membership checks use `GroupsJpaRepository.findMembersOf`, since `spring.jpa.open-in-view=false` stops `Groups.groupMembers` loading in the chat controller. Tests: `./mvnw test -Dtest='*Mentor*Test'`.
- Changing a group (`GroupsApiController`): adding or removing a member of an existing group (`POST` and `DELETE /api/groups/{id}/members/{personId}`) is for its members, teachers and admins (`managesGroup`), since a group has no owner. Outside the mentor rules, anyone may join or leave a group that isn't a class group. On these routes only teachers and admins add or remove people in a class group; students join and leave theirs through the classes on their Profile (`PUT /api/groups/class-memberships`). Changing a group's name, period or course (`PUT /api/groups/{id}`) is for teachers and admins. A class group keeps its name, and a new name can't be another group's or a class group's name, because Profile's class sync, a course's video call room and the assignment course sync find groups by name. No group name, made or renamed, can contain "/", since group chat's S3 folders use it. Deleting (`DELETE /api/groups/{id}`) is admin-only and never a class group, the same rule the Messages page uses to show Delete. Test: `GroupMembershipAccessTest`.
- A group's grades (`/api/groups/{id}/grades`): reading them (`GET`) is for its members, teachers, admins and whoever grades one of its submissions (`seesGroupGrades`). Replacing or clearing them (`PUT`, `DELETE`) is for teachers and admins, since that changes every assignment's entry. Adding one assignment's entry (`POST`, which also copies it into each member's `gradesJson`) is for them and for whoever grades the group on that assignment (`gradesGroupOn`): its creators and graders (`AssignmentAuthorizationService.canManage`) and the graders of the group's submission to it. Test: `GroupGradesAccessTest`.
- [docs/group-chat-architecture.md](docs/group-chat-architecture.md) covers every groups and chat route, the WebSocket event contexts, S3 message storage (keyed by group name, not id) and the known issues. Over the WebSocket there is no Spring Security context, so a service that needs the signed-in account (like `GroupChatIdentityService`) only works from REST. The socket does read the `jwt_java_spring` cookie when it opens (`ChatSocketIdentityInterceptor`, same checks as `JwtRequestFilter`, and only when the request's `Origin` is in the REST CORS list, since a cross-site GET carries the cookie but no Origin), but only for `DirectMessageTopicGuard`: only a conversation's participants can subscribe to `/topic/dm/{id}`, and wildcard subscriptions, `/user/...` destinations and client SENDs to DM topics are dropped. It sets no Principal, on purpose, so `GroupChatWebSocketController` still ignores events. HTTP: `api/groups.http`.
- A client's SEND to any `/topic/...` destination is dropped too, group topics included, because the simple broker relays it to every subscriber. Only the server publishes there (the prefix is `WebSocketBrokerConfig.BROKER_PREFIX`).

## Assignment grading

Expand Down
16 changes: 16 additions & 0 deletions api/groups.http
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ Content-Type: application/json

{"filename": "notes/hello.txt", "base64Data": "Z29vZGJ5ZQ=="}

### 13g. React to a message with a Like -> 200 with {messageId, reactions}, and a reactionsServer frame on /topic/group/{id}
# Any UUID is accepted: Spring doesn't read the S3 file to check the message, and a reaction
# on a message that doesn't exist is never shown.
PUT {{baseUrl}}/api/groups/chat/{{createGroup.response.body.$.id}}/messages/3f2c8a8e-5b1d-4c7e-9a52-8f0e6d4b2a10/reactions/like

### 13h. List the chat's reactions -> 200 with {"3f2c8a8e-...": [{"reaction": "like", "people": [{uid, name}]}]}
GET {{baseUrl}}/api/groups/chat/{{createGroup.response.body.$.id}}/reactions

### 13i. Take the Like back -> 200 with an empty reactions list
DELETE {{baseUrl}}/api/groups/chat/{{createGroup.response.body.$.id}}/messages/3f2c8a8e-5b1d-4c7e-9a52-8f0e6d4b2a10/reactions/like

### 13j. A key that isn't one of the six is refused -> 400
# Direct messages have the same three routes under /api/dm/conversations/{id}: GET .../reactions,
# and PUT or DELETE .../messages/{messageId}/reactions/{reaction}, for participants only.
PUT {{baseUrl}}/api/groups/chat/{{createGroup.response.body.$.id}}/messages/3f2c8a8e-5b1d-4c7e-9a52-8f0e6d4b2a10/reactions/thumbsup

### 14. Remove yourself from the test group -> 200

DELETE {{baseUrl}}/api/groups/{{createGroup.response.body.$.id}}/members/{{me.response.body.$.id}}
Expand Down
Loading