mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 03:21:01 +00:00
Merge pull request 'Update crates' (#1134) from update-crates into main
Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/1134
This commit is contained in:
commit
ae7bf2e132
6 changed files with 603 additions and 471 deletions
1034
Cargo.lock
generated
1034
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -24,7 +24,7 @@ activitystreams-ext = "0.1.0-alpha.2"
|
|||
url = "2.2.2"
|
||||
flume = "0.10.13"
|
||||
tokio = { version = "1.19.2", features = ["full"] }
|
||||
futures = "0.3.21"
|
||||
futures = "0.3.25"
|
||||
|
||||
[dependencies.chrono]
|
||||
features = ["serde"]
|
||||
|
|
|
@ -10,7 +10,7 @@ bcrypt = "0.12.1"
|
|||
guid-create = "0.2"
|
||||
itertools = "0.10.3"
|
||||
lazy_static = "1.0"
|
||||
ldap3 = "0.10.5"
|
||||
ldap3 = "0.11.1"
|
||||
migrations_internals= "1.4.0"
|
||||
openssl = "0.10.40"
|
||||
rocket = "0.4.11"
|
||||
|
@ -24,7 +24,7 @@ tantivy = "0.13.3"
|
|||
url = "2.1"
|
||||
walkdir = "2.2"
|
||||
webfinger = "0.4.1"
|
||||
whatlang = "0.16.0"
|
||||
whatlang = "0.16.2"
|
||||
shrinkwraprs = "0.3.0"
|
||||
diesel-derive-newtype = "1.0.0"
|
||||
glob = "0.3.0"
|
||||
|
|
|
@ -756,7 +756,11 @@ impl FromId<DbConn> for Post {
|
|||
let timestamp_secs = published.unix_timestamp();
|
||||
let timestamp_nanos = published.unix_timestamp_nanos()
|
||||
- (timestamp_secs as i128) * 1000i128 * 1000i128 * 1000i128;
|
||||
NaiveDateTime::from_timestamp(timestamp_secs, timestamp_nanos as u32)
|
||||
NaiveDateTime::from_timestamp_opt(
|
||||
timestamp_secs,
|
||||
timestamp_nanos as u32,
|
||||
)
|
||||
.unwrap()
|
||||
}),
|
||||
subtitle: article
|
||||
.summary()
|
||||
|
|
|
@ -94,7 +94,7 @@ macro_rules! gen_to_string {
|
|||
)*
|
||||
$(
|
||||
for val in &$self.$date {
|
||||
$result.push_str(&format!("{}:{} ", stringify!($date), NaiveDate::from_num_days_from_ce(*val as i32).format("%Y-%m-%d")));
|
||||
$result.push_str(&format!("{}:{} ", stringify!($date), NaiveDate::from_num_days_from_ce_opt(*val as i32).unwrap().format("%Y-%m-%d")));
|
||||
}
|
||||
)*
|
||||
}
|
||||
|
@ -180,12 +180,16 @@ impl PlumeQuery {
|
|||
|
||||
if self.before.is_some() || self.after.is_some() {
|
||||
// if at least one range bound is provided
|
||||
let after = self
|
||||
.after
|
||||
.unwrap_or_else(|| i64::from(NaiveDate::from_ymd(2000, 1, 1).num_days_from_ce()));
|
||||
let after = self.after.unwrap_or_else(|| {
|
||||
i64::from(
|
||||
NaiveDate::from_ymd_opt(2000, 1, 1)
|
||||
.unwrap()
|
||||
.num_days_from_ce(),
|
||||
)
|
||||
});
|
||||
let before = self
|
||||
.before
|
||||
.unwrap_or_else(|| i64::from(Utc::today().num_days_from_ce()));
|
||||
.unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce()));
|
||||
let field = Searcher::schema().get_field("creation_date").unwrap();
|
||||
let range =
|
||||
RangeQuery::new_i64_bounds(field, Bound::Included(after), Bound::Included(before));
|
||||
|
@ -202,16 +206,20 @@ impl PlumeQuery {
|
|||
pub fn before<D: Datelike>(&mut self, date: &D) -> &mut Self {
|
||||
let before = self
|
||||
.before
|
||||
.unwrap_or_else(|| i64::from(Utc::today().num_days_from_ce()));
|
||||
.unwrap_or_else(|| i64::from(Utc::now().date_naive().num_days_from_ce()));
|
||||
self.before = Some(cmp::min(before, i64::from(date.num_days_from_ce())));
|
||||
self
|
||||
}
|
||||
|
||||
// documents older than the provided date will be ignored
|
||||
pub fn after<D: Datelike>(&mut self, date: &D) -> &mut Self {
|
||||
let after = self
|
||||
.after
|
||||
.unwrap_or_else(|| i64::from(NaiveDate::from_ymd(2000, 1, 1).num_days_from_ce()));
|
||||
let after = self.after.unwrap_or_else(|| {
|
||||
i64::from(
|
||||
NaiveDate::from_ymd_opt(2000, 1, 1)
|
||||
.unwrap()
|
||||
.num_days_from_ce(),
|
||||
)
|
||||
});
|
||||
self.after = Some(cmp::max(after, i64::from(date.num_days_from_ce())));
|
||||
self
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ pub fn search(query: Option<Form<SearchQuery>>, conn: DbConn, rockets: PlumeRock
|
|||
if str_query.is_empty() {
|
||||
render!(search::index(
|
||||
&(&conn, &rockets).to_context(),
|
||||
&format!("{}", Utc::today().format("%Y-%m-d"))
|
||||
&format!("{}", Utc::now().date_naive().format("%Y-%m-d"))
|
||||
))
|
||||
} else {
|
||||
let res = rockets
|
||||
|
|
Loading…
Reference in a new issue