Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
radicle-types: Migrate to `radicle_localtime`
Lorenz Leutgeb committed 1 month ago
commit 6a9906aa0e39b2a4b2b5bd5aec975429342addfd
parent 8271a9d
5 files changed +7 -17
modified Cargo.lock
@@ -2922,12 +2922,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"

[[package]]
-
name = "localtime"
-
version = "1.3.1"
-
source = "registry+https://github.com/rust-lang/crates.io-index"
-
checksum = "016a009e0bb8ba6e3229fb74bf11a8fe6ef24542cc6ef35ef38863ac13f96d87"
-

-
[[package]]
name = "lock_api"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4336,11 +4330,11 @@ dependencies = [
 "axum",
 "base64 0.22.1",
 "infer",
-
 "localtime",
 "log",
 "mime-infer",
 "radicle",
 "radicle-job",
+
 "radicle-localtime",
 "radicle-surf",
 "serde",
 "serde_json",
modified crates/radicle-types/Cargo.toml
@@ -10,11 +10,9 @@ doctest = false
anyhow = { version = "1.0.90" }
axum = { version = "0.8.1", default-features = false, features = ["json"] }
base64 = { version = "0.22.1" }
-
localtime = { version = "1.3.1" }
log = { version = "0.4.22" }
infer = { version = "0.19.0" }
mime-infer = { version = "3.0.0" }
-
radicle-localtime = { version = "0.1.0", features = ["serde"] }
radicle = { version = "0.22" }
radicle-job = { version = "0.5.2" }
radicle-localtime = { version = "0.1.0", features = ["serde"] }
modified crates/radicle-types/src/cobs/repo.rs
@@ -1,4 +1,4 @@
-
use localtime::LocalTime;
+
use radicle_localtime::LocalTime;

#[derive(Debug, PartialEq, Eq, Clone, serde::Serialize, serde::Deserialize, ts_rs::TS)]
#[serde(tag = "status")]
@@ -42,7 +42,6 @@ impl From<radicle::node::SyncStatus> for SyncStatus {
pub struct SyncedAt {
    #[ts(as = "String")]
    pub oid: radicle::git::Oid,
-
    #[serde(with = "radicle::serde_ext::localtime::time")]
    #[ts(type = "number")]
    pub timestamp: LocalTime,
}
modified crates/radicle-types/src/domain/inbox/models/notification.rs
@@ -26,7 +26,7 @@ pub enum SetStatusNotifications {
#[serde(rename = "camelCase")]
pub struct NotificationRow {
    pub row_id: node::notifications::NotificationId,
-
    pub timestamp: localtime::LocalTime,
+
    pub timestamp: radicle_localtime::LocalTime,
    /// Node Id that provided us with this notification.
    pub remote: storage::RemoteId,
    pub old: Option<git::Oid>,
@@ -134,7 +134,7 @@ pub struct Issue {
    pub update: RefUpdate,
    pub title: String,
    #[ts(type = "number")]
-
    pub timestamp: localtime::LocalTime,
+
    pub timestamp: radicle_localtime::LocalTime,
    pub status: cobs::issue::State,
    pub actions: Vec<ActionWithAuthor<cobs::issue::Action>>,
    #[ts(as = "String")]
@@ -164,7 +164,7 @@ pub struct Patch {
    pub id: cob::ObjectId,
    pub update: RefUpdate,
    #[ts(type = "number")]
-
    pub timestamp: localtime::LocalTime,
+
    pub timestamp: radicle_localtime::LocalTime,
    pub title: String,
    pub status: models::patch::State,
    pub actions: Vec<ActionWithAuthor<models::patch::Action>>,
modified crates/radicle-types/src/traits/thread.rs
@@ -1,6 +1,5 @@
use std::fs;

-
use localtime::LocalTime;

use radicle::cob;
use radicle::git;
@@ -132,7 +131,7 @@ pub trait Thread: Profile {
                id.into(),
                None,
                new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
-
                LocalTime::now().into(),
+
                cob::Timestamp::from_secs(radicle_localtime::LocalTime::now().as_secs()),
            ),
            aliases,
        ))
@@ -175,7 +174,7 @@ pub trait Thread: Profile {
                new.reply_to,
                new.location.map(|l| l.into()),
                new.embeds.into_iter().map(Into::into).collect::<Vec<_>>(),
-
                LocalTime::now().into(),
+
                cob::Timestamp::from_secs(radicle_localtime::LocalTime::now().as_secs()),
            ),
            aliases,
        ))