Skip to content

fix (gql-server): Set typing=false once user edited a message - #24999

Merged
antobinary merged 1 commit into
bigbluebutton:v3.0.x-developfrom
gustavotrott:chat-stop-typing-when-edit
Apr 30, 2026
Merged

antobinary merged 1 commit into
bigbluebutton:v3.0.x-developfrom
gustavotrott:chat-stop-typing-when-edit

Conversation

@gustavotrott

Copy link
Copy Markdown
Contributor

When a user sends a message, the database automatically assumes they stopped typing.

That behavior was not applied when a message was edited, so after editing, the user could still appear as typing.

This PR fixes that by marking the user as having stopped typing as soon as they edit a message.

@gustavotrott gustavotrott added this to the Release 3.0 milestone Apr 29, 2026
@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

A SQL database trigger in bbb_schema.sql has been modified to execute after both INSERT and UPDATE operations on the chat_message table, rather than only after INSERT operations. The trigger invokes the same underlying function (update_chatUser_clear_lastTypingAt_trigger_func()) and maintains identical behavior logic. A blank line was removed as part of formatting cleanup.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: updating the trigger to set typing=false when a message is edited, which matches the changeset's modification to execute the trigger on both INSERT and UPDATE operations.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation for why the database trigger was modified to also execute on UPDATE operations when a message is edited.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bbb-graphql-server/bbb_schema.sql`:
- Line 1328: The trigger update_chatUser_clear_lastTypingAt_trigger currently
fires on any UPDATE of chat_message; restrict it to only edit-related updates by
changing the trigger definition to fire only for the edit columns (e.g., use
UPDATE OF "message", "editedAt" ON chat_message or add a WHEN condition
comparing OLD and NEW for "message" and "editedAt"), so only edits clear
lastTypingAt; keep the trigger body and name unchanged and ensure the new
definition references the chat_message table and the "message" and "editedAt"
columns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a310491a-a653-40ac-b117-f94289a6b438

📥 Commits

Reviewing files that changed from the base of the PR and between 7318c35 and 0583930.

📒 Files selected for processing (1)
  • bbb-graphql-server/bbb_schema.sql

$$ LANGUAGE plpgsql;

CREATE TRIGGER "update_chatUser_clear_lastTypingAt_trigger" AFTER INSERT ON chat_message FOR EACH ROW
CREATE TRIGGER "update_chatUser_clear_lastTypingAt_trigger" AFTER INSERT OR UPDATE ON chat_message FOR EACH ROW

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Scope the UPDATE trigger to edit-related columns only.

On Line 1328, AFTER ... UPDATE fires for any update on chat_message, so unrelated updates can clear lastTypingAt for the sender unexpectedly. Limit update events to edit fields (e.g., "message", "editedAt").

Suggested change
-CREATE TRIGGER "update_chatUser_clear_lastTypingAt_trigger" AFTER INSERT OR UPDATE ON chat_message FOR EACH ROW
+CREATE TRIGGER "update_chatUser_clear_lastTypingAt_trigger"
+AFTER INSERT OR UPDATE OF "message", "editedAt" ON "chat_message"
+FOR EACH ROW
 EXECUTE FUNCTION "update_chatUser_clear_lastTypingAt_trigger_func"();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
CREATE TRIGGER "update_chatUser_clear_lastTypingAt_trigger" AFTER INSERT OR UPDATE ON chat_message FOR EACH ROW
CREATE TRIGGER "update_chatUser_clear_lastTypingAt_trigger"
AFTER INSERT OR UPDATE OF "message", "editedAt" ON "chat_message"
FOR EACH ROW
EXECUTE FUNCTION "update_chatUser_clear_lastTypingAt_trigger_func"();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-server/bbb_schema.sql` at line 1328, The trigger
update_chatUser_clear_lastTypingAt_trigger currently fires on any UPDATE of
chat_message; restrict it to only edit-related updates by changing the trigger
definition to fire only for the edit columns (e.g., use UPDATE OF "message",
"editedAt" ON chat_message or add a WHEN condition comparing OLD and NEW for
"message" and "editedAt"), so only edits clear lastTypingAt; keep the trigger
body and name unchanged and ensure the new definition references the
chat_message table and the "message" and "editedAt" columns.

@ramonlsouza ramonlsouza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antobinary
antobinary merged commit 0bc0b6a into bigbluebutton:v3.0.x-develop Apr 30, 2026
56 of 58 checks passed
@github-actions

Copy link
Copy Markdown

🚨 Automated tests failed

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.

3 participants