Skip to content

Prod sync - #128

Merged
VisenP merged 6 commits into
mainfrom
dev
Mar 28, 2026
Merged

Prod sync#128
VisenP merged 6 commits into
mainfrom
dev

Conversation

@VisenP

@VisenP VisenP commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Antony1060 and others added 4 commits March 13, 2026 18:43
* Replace simple Q&A with threaded message system for contest questions

Contest questions now support multi-message threads between contestants
and management instead of a single question/response pair. Each thread
has its own dedicated page with message history and reply form.

Backend: new contest_chat_messages table, GET/POST message endpoints,
author name resolution on responses, last_message_member_id for status
tracking. Existing questions migrated to chat messages in migration 53.

Frontend: member-side thread list with dedicated thread page,
management-side table with status/member columns and thread detail page.
Messages color-coded by role (contestant vs management).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address PR review feedback

- Fix "waiting" indicator to use last_message_member_id instead of
  last_message_at (which is always set after migration)
- Copy arrays before sorting to avoid mutating react-query cache
- Use BigInt comparison for message sorting instead of Number() cast
- Batch member lookup with eqIn instead of N+1 selectOneFrom queries
- Derive contest from thread.contest_id instead of route param to
  prevent wrong contest name in notifications
- Use getSnowflakeTime() in migration instead of hardcoded epoch
- Remove legacy PATCH endpoint (no old clients to support)
- Remove unused selfMemberId prop from ContestChatSection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address second round of PR review feedback

- Remove hardcoded snowflake bit-shift fallback in frontend sorting,
  use BigInt comparison instead
- Use generateSnowflake() for response message IDs in migration
  instead of question.id + 1n which risks primary key collision
- Allow admins (VIEW_CONTEST) to access GET messages endpoint without
  being a contest member, mirroring the list endpoint behavior
- Allow admins (EDIT_CONTEST) to send messages via POST endpoint
  without contest membership
- Add minLength: 1 to MessageSchema to prevent empty messages
- Convert users array to Map for O(1) lookups in name resolution

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address third round of PR review feedback

- Remove admin-without-membership path in POST messages — admins
  must be contest members to send messages (management UI already
  requires VIEW_PRIVATE membership). This avoids storing user.id
  as author_member_id which breaks name resolution.
- Add fallback in name resolution: if author_member_id not found in
  contest_members, try looking it up directly in users table.
- Drop showAllUsers: true from useAllContestMembers calls in
  management pages to avoid query key cache collisions with other
  pages using the same hook with default options.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* thing

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Antonio F. Trstenjak <antoniostignjedec@gmail.com>
@VisenP
VisenP requested a review from Antony1060 March 26, 2026 09:52
@netlify

netlify Bot commented Mar 26, 2026

Copy link
Copy Markdown

Deploy Preview for steady-gumdrop-d7550d ready!

Name Link
🔨 Latest commit 0d7e77e
🔍 Latest deploy log https://app.netlify.com/projects/steady-gumdrop-d7550d/deploys/69c70e2693e9bb0008079d36
😎 Deploy Preview https://deploy-preview-128--steady-gumdrop-d7550d.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Mar 26, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-pasca-ac7b9b ready!

Name Link
🔨 Latest commit 0d7e77e
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-pasca-ac7b9b/deploys/69c70e266dea5300083bb05d
😎 Deploy Preview https://deploy-preview-128--astonishing-pasca-ac7b9b.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

VisenP and others added 2 commits March 27, 2026 23:19
* Add temporary users locked to specific contests

Admins can bulk-create temporary users from a list of names with a
configurable username prefix (e.g. nap2026_vpavlica). These users
get auto-generated credentials, are locked to their assigned contests,
and see a stripped-down frontend with no dashboard, org picker, or
admin access.

- New "temporary" auth source with username/password login
- temporary_users DB table + migration 0054
- Bulk-create endpoint with name-based username generation and
  diacritics stripping
- Restricted frontend route tree for temporary users
- Temp login page at /temp-login
- CSV download for generated credentials

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Remove unused returnedContests variable

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Apply suggestion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Antonio F. T. <antoniostignjedec@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@VisenP
VisenP merged commit e99daa7 into main Mar 28, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants