Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(api): correct timestamp usage (#67)

Hampus288477a5b3d6
diff --git a/fluxer_api/src/models/CallInfo.ts b/fluxer_api/src/models/CallInfo.ts
index ae33b12c9..b9b0f3a64 100644
--- a/fluxer_api/src/models/CallInfo.ts
+++ b/fluxer_api/src/models/CallInfo.ts
@@ -26,7 +26,7 @@ export class CallInfo {
constructor(call: MessageCall) {
this.participantIds = call.participant_ids ?? new Set();
- this.endedTimestamp = call.ended_timestamp ?? null;
+ this.endedTimestamp = call.ended_timestamp ? new Date(call.ended_timestamp) : null;
}
toMessageCall(): MessageCall {
diff --git a/fluxer_api/src/models/Embed.ts b/fluxer_api/src/models/Embed.ts
index a5a9a98b5..ed7e595b5 100644
--- a/fluxer_api/src/models/Embed.ts
+++ b/fluxer_api/src/models/Embed.ts
@@ -45,7 +45,7 @@ export class Embed {
this.title = embed.title ?? null;
this.description = embed.description ?? null;
this.url = embed.url ?? null;
- this.timestamp = embed.timestamp ?? null;
+ this.timestamp = embed.timestamp ? new Date(embed.timestamp) : null;
this.color = embed.color ?? null;
this.author = embed.author ? new EmbedAuthor(embed.author) : null;
this.provider = embed.provider ? new EmbedProvider(embed.provider) : null;
diff --git a/fluxer_api/src/models/MessageSnapshot.ts b/fluxer_api/src/models/MessageSnapshot.ts
index 07e61a235..df90c6ad2 100644
--- a/fluxer_api/src/models/MessageSnapshot.ts
+++ b/fluxer_api/src/models/MessageSnapshot.ts
@@ -38,8 +38,8 @@ export class MessageSnapshot {
constructor(snapshot: CassandraMessageSnapshot) {
this.content = snapshot.content ?? null;
- this.timestamp = snapshot.timestamp;
- this.editedTimestamp = snapshot.edited_timestamp ?? null;
+ this.timestamp = new Date(snapshot.timestamp);
+ this.editedTimestamp = snapshot.edited_timestamp ? new Date(snapshot.edited_timestamp) : null;
this.mentionedUserIds = snapshot.mention_users ?? new Set();
this.mentionedRoleIds = snapshot.mention_roles ?? new Set();
this.mentionedChannelIds = snapshot.mention_channels ?? new Set();
diff --git a/fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql b/fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql
new file mode 100644
index 000000000..edd91398e
--- /dev/null
+++ b/fluxer_devops/cassandra/migrations/20260107131535_add_edited_timestamp_to_message_snapshot.cql
@@ -0,0 +1 @@
+ALTER TYPE fluxer.message_snapshot ADD edited_timestamp timestamp;