Skip to content

Commit

Permalink
backup: Drop the receivedAtTimestamp field from Reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
sashaweiss-signal authored Aug 20, 2024
1 parent 2f7f83d commit 2485492
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
8 changes: 0 additions & 8 deletions rust/message-backup/src/backup/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ pub struct Reaction<Recipient> {
#[serde(bound(serialize = "Recipient: serde::Serialize"))]
pub author: Recipient,
pub sent_timestamp: Timestamp,
pub received_timestamp: Option<Timestamp>,
_limit_construction_to_module: (),
}

Expand Down Expand Up @@ -663,7 +662,6 @@ impl<R: Clone, C: Lookup<RecipientId, R>> TryFromWith<proto::Reaction, C> for Re
let proto::Reaction {
authorId,
sentTimestamp,
receivedTimestamp,
emoji,
sortOrder,
special_fields: _,
Expand All @@ -679,15 +677,12 @@ impl<R: Clone, C: Lookup<RecipientId, R>> TryFromWith<proto::Reaction, C> for Re
};

let sent_timestamp = Timestamp::from_millis(sentTimestamp, "Reaction.sentTimestamp");
let received_timestamp = receivedTimestamp
.map(|timestamp| Timestamp::from_millis(timestamp, "Reaction.receivedTimestamp"));

Ok(Self {
emoji,
sort_order: sortOrder,
author,
sent_timestamp,
received_timestamp,
_limit_construction_to_module: (),
})
}
Expand Down Expand Up @@ -740,7 +735,6 @@ mod test {
sortOrder: 3,
authorId: proto::Recipient::TEST_ID,
sentTimestamp: MillisecondsSinceEpoch::TEST_VALUE.0,
receivedTimestamp: Some(MillisecondsSinceEpoch::TEST_VALUE.0),
..Default::default()
}
}
Expand All @@ -753,7 +747,6 @@ mod test {
sort_order: 3,
author: TestContext::test_recipient().clone(),
sent_timestamp: Timestamp::test_value(),
received_timestamp: Some(Timestamp::test_value()),
_limit_construction_to_module: (),
}
}
Expand Down Expand Up @@ -900,7 +893,6 @@ mod test {
|x| x.authorId = proto::Recipient::TEST_ID + 2 => Err(ReactionError::AuthorNotFound(RecipientId(proto::Recipient::TEST_ID + 2)));
"invalid_author_id"
)]
#[test_case(|x| x.receivedTimestamp = None => Ok(()); "no_received_timestamp")]
fn reaction(modifier: fn(&mut proto::Reaction)) -> Result<(), ReactionError> {
let mut reaction = proto::Reaction::test_data();
modifier(&mut reaction);
Expand Down
5 changes: 2 additions & 3 deletions rust/message-backup/src/proto/backup.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package signal.backup;

option java_package = "org.thoughtcrime.securesms.backup.v2.proto";
option swift_prefix = "BackupProto_";

message BackupInfo {
uint64 version = 1;
Expand Down Expand Up @@ -677,11 +678,9 @@ message Reaction {
string emoji = 1;
uint64 authorId = 2;
uint64 sentTimestamp = 3;
// Optional because some clients may not track this data
optional uint64 receivedTimestamp = 4;
// A higher sort order means that a reaction is more recent. Some clients may export this as
// incrementing numbers (e.g. 1, 2, 3), others as timestamps.
uint64 sortOrder = 5;
uint64 sortOrder = 4;
}

message ChatUpdateMessage {
Expand Down

0 comments on commit 2485492

Please sign in to comment.