models: Add request_timestamp field to ScheduledMessage table.

This just records the time when the user created the
request to schedule a message or set a reminder.

This would be unused but is future-proofing against a world
where we decide to edit the strings or UI to show when you
asked for the thing.
This commit is contained in:
Aman Agrawal
2025-04-24 13:28:42 +05:30
committed by Tim Abbott
parent 7907c5f846
commit 9d3279caf4
3 changed files with 20 additions and 1 deletions

View File

@@ -339,7 +339,7 @@ DATE_FIELDS: dict[TableName, list[Field]] = {
"date_deleted",
],
"zerver_savedsnippet": ["date_created"],
"zerver_scheduledmessage": ["scheduled_timestamp"],
"zerver_scheduledmessage": ["scheduled_timestamp", "request_timestamp"],
"zerver_stream": ["date_created"],
"zerver_namedusergroup": ["date_created"],
"zerver_useractivityinterval": ["start", "end"],

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.1.8 on 2025-04-24 05:47
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0697_empty_topic_name_for_dms_from_third_party_imports"),
]
operations = [
migrations.AddField(
model_name="scheduledmessage",
name="request_timestamp",
field=models.DateTimeField(default=django.utils.timezone.now),
),
]

View File

@@ -152,6 +152,7 @@ class ScheduledMessage(models.Model):
delivered = models.BooleanField(default=False)
delivered_message = models.ForeignKey(Message, null=True, on_delete=CASCADE)
has_attachment = models.BooleanField(default=False, db_index=True)
request_timestamp = models.DateTimeField(default=timezone_now)
# Metadata for messages that failed to send when their scheduled
# moment arrived.