Loading
Add time-based scheduling to targeted messages
What does this MR do and why?
This MR adds time-based scheduling capabilities to targeted messages, allowing administrators to specify when admin notifications should be displayed to users.
What it does:
- Adds
starts_atandends_attimestamp columns to thetargeted_messagestable with a database constraint ensuring start time is before end time - Creates a new Vue component (
DatetimePicker) that combines date and time selection for the UI - Integrates datetime fields into the targeted message form with proper validation
- Ensures messages can only be scheduled for future dates (not in the past)
Why it's needed: This enables time-bound admin notifications—administrators can now create messages that automatically display during specific time windows rather than being permanently active. For example, you could schedule a maintenance notification to appear only during a scheduled maintenance window, or a promotional message for a specific campaign period.
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
![]() |
![]() |
How to set up and validate locally
- Run the database migration:
bin/rails db:migrate
- Access the admin panel:
- Go to
http://localhost:3000/admin/targeted_messages - Sign in as an admin user if needed
- Go to
- Create a new targeted message:
- Click "Add targeted message" button
- You'll see the form with:
- Target Type dropdown
- Starts at field (date + time picker)
- Ends at field (date + time picker)
- Upload CSV for namespace IDs
- Edit an existing message:
- Click edit on any targeted message
- The datetime fields should pre-populate with existing values
- Modify and save to verify updates work
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #581707 (closed)
Edited by Harsh Sagar



