Skip to content

Conversation

@ayca-cevdet
Copy link
Contributor

@ayca-cevdet ayca-cevdet commented Jan 26, 2026

Summary

Checklist

General

Client

Motivation and Context

It fixes the issue #12029.
There was a timing issue occurred by having a delay for updating the message. Currently if user hits enter or clicks on send button quickly, the message was sent as 'cut in half'.

Description

I added a delay in creatingPost function to wait for update message events to emit successfully before sending it.

Steps for Testing

  1. Go to a random DM
  2. Write something and hit enter immediately, quickly
  3. Repeat few more times
  4. See messages are sent correctly in full

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Screenshots

Summary by CodeRabbit

  • Bug Fixes
    • Introduced a short delay before sending messages to synchronize with the editor’s processing, preventing premature posts.
    • Updated tests to wait for the new delay so asynchronous success/error paths are reliably validated.

✏️ Tip: You can customize this high-level summary in your review settings.

@ayca-cevdet ayca-cevdet requested a review from a team as a code owner January 26, 2026 19:36
@github-project-automation github-project-automation bot moved this to Work In Progress in Artemis Development Jan 26, 2026
@github-actions github-actions bot added client Pull requests that update TypeScript code. (Added Automatically!) communication Pull requests that affect the corresponding module labels Jan 26, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

Walkthrough

Adds a 250ms delay before creating a post in the message inline input component to wait for the markdown editor's textChangedEmitDelay; corresponding unit tests updated to advance time by 300ms to accommodate the delay.

Changes

Cohort / File(s) Summary
Message Input Timing Fix
src/main/webapp/app/communication/message/message-inline-input/message-inline-input.component.ts
Wraps posting creation in a 250ms setTimeout to ensure the editor's text change has propagated before setting posting.content and calling createPost; success/error handling unchanged.
Tests: Async Tick Adjustment
src/main/webapp/app/communication/message/message-inline-input/message-inline-input.component.spec.ts
Advances tick() calls to tick(300) in tests to wait for the introduced 250ms delay before asserting createPost behavior for success and error paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main fix: resolving the message cut-in-half timing issue. It accurately reflects the core change in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/communication/sending-message-timing-issue

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

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

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 26, 2026
@helios-aet helios-aet bot temporarily deployed to artemis-test1.artemis.cit.tum.de January 26, 2026 20:00 Inactive
@github-actions
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report223 ran220 passed1 skipped2 failed1h 45m 44s 568ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to write message in channel❌ failure2m 20s 223ms
e2e/exam/ExamTestRun.spec.ts
ts.Exam test run › Delete a test run › Deletes a test run❌ failure2m 42s 653ms

@atharvamp atharvamp temporarily deployed to artemis-test2.artemis.cit.tum.de January 27, 2026 13:03 — with GitHub Actions Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/webapp/app/communication/message/message-inline-input/message-inline-input.component.spec.ts (1)

203-217: Rename test or switch to creation test data to match test name.

The test at lines 203-217 is named "should clear draft after successful post creation", but the beforeEach (line 143) uses directMessageUser1—an existing message with id: 9. This triggers the update path, not the creation path. The test is functionally correct (update has no tick(300) delay), but the name is misleading.

Either:

  1. Rename to "should clear draft after successful post update" to reflect actual behavior, or
  2. Switch to metisPostToCreateUser1 and add tick(300) to test the creation path as the name implies.
🧹 Nitpick comments (1)
src/main/webapp/app/communication/message/message-inline-input/message-inline-input.component.spec.ts (1)

69-76: Consider adding a comment to explain the 300ms delay.

The tick(300) accommodates the 250ms delay in the component's confirm() method, but this relationship isn't immediately obvious. A brief comment would help future maintainers understand why this specific value is used and prevent accidental breakage if the component's delay changes.

         component.confirm();
+        // Wait for the 250ms textChangedEmitDelay in the component before the service call
         tick(300);

@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de January 27, 2026 13:59 Inactive
@helios-aet helios-aet bot temporarily deployed to artemis-test5.artemis.cit.tum.de January 27, 2026 14:27 Inactive
@helios-aet helios-aet bot temporarily deployed to artemis-test6.artemis.cit.tum.de January 27, 2026 14:40 Inactive
@github-actions
Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report223 ran218 passed1 skipped4 failed1h 49m 42s 935ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/course/CourseMessages.spec.ts
ts.Course messages › Channel messages › Write/edit/delete message in channel › Student should be able to write message in channel❌ failure2m 22s 883ms
e2e/exercise/modeling/ModelingExerciseManagement.spec.ts
ts.Modeling Exercise Management › Create Modeling Exercise › Create a new modeling exercise❌ failure2m 4s 91ms
e2e/exam/test-exam/TestExamParticipation.spec.ts
ts.Test exam participation › Early Hand-in › Using exercise sidebar to navigate within exam❌ failure4m 45s 470ms
ts.Test exam participation › Early Hand-in › Using exercise overview to navigate within exam❌ failure4m 42s 393ms

Copy link

@atharvamp atharvamp left a comment

Choose a reason for hiding this comment

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

Tested on TS6, works as intended. Messages are no longer cut off after clicking enter.

Copy link
Member

@anian03 anian03 left a comment

Choose a reason for hiding this comment

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

Tested o TS6. While the issue no longer persists, I'm not sure if this is the best solution as it makes the web app seem slower. Do you know if there is a way to wait until the test update was complete? That way it would be ≤200ms, no always exactly 250ms

Copy link

@NadiaCurumi NadiaCurumi left a comment

Choose a reason for hiding this comment

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

Tested on TS6
Messges are not cut in half when pressing send.

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de January 28, 2026 09:15 Inactive
Copy link

@lana-ati lana-ati left a comment

Choose a reason for hiding this comment

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

Tested during working session on TS3. Worked as expected.

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de January 28, 2026 09:42 Inactive
Copy link

@kristi-balla kristi-balla left a comment

Choose a reason for hiding this comment

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

tested on t3, works as expected

Copy link

@oTaczkowski oTaczkowski left a comment

Choose a reason for hiding this comment

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

Tested on TS3, everything works.

Copy link

@hanna20022005 hanna20022005 left a comment

Choose a reason for hiding this comment

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

tested on ts3 using tsest user 18, works as intended ^^

2026-01-28.10-50-21.mp4

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

Labels

client Pull requests that update TypeScript code. (Added Automatically!) communication Pull requests that affect the corresponding module ready for review

Projects

Status: Work In Progress
Status: Todo

Development

Successfully merging this pull request may close these issues.

Communication: Artemis cuts off half my message when clicking enter

9 participants