mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
rename MutedUntilTimestamp to Until
This commit is contained in:
@@ -1425,7 +1425,7 @@ pub unsafe extern "C" fn dc_set_chat_mute_duration(
|
||||
let muteDuration = match duration {
|
||||
0 => MuteDuration::NotMuted,
|
||||
-1 => MuteDuration::Forever,
|
||||
_ => MuteDuration::MutedUntilTimestamp(time() + duration),
|
||||
_ => MuteDuration::Until(time() + duration),
|
||||
};
|
||||
|
||||
let ffi_context = &*context;
|
||||
@@ -2535,7 +2535,7 @@ pub unsafe extern "C" fn dc_chat_get_remaining_mute_duration(chat: *mut dc_chat_
|
||||
match ffi_chat.chat.mute_duration {
|
||||
MuteDuration::NotMuted => 0,
|
||||
MuteDuration::Forever => -1,
|
||||
MuteDuration::MutedUntilTimestamp(timestamp) => timestamp - time(),
|
||||
MuteDuration::Until(timestamp) => timestamp - time(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
src/chat.rs
12
src/chat.rs
@@ -691,7 +691,7 @@ impl Chat {
|
||||
match self.mute_duration {
|
||||
MuteDuration::NotMuted => false,
|
||||
MuteDuration::Forever => true,
|
||||
MuteDuration::MutedUntilTimestamp(timestamp) => timestamp > time(),
|
||||
MuteDuration::Until(timestamp) => timestamp > time(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1921,7 +1921,7 @@ pub fn shall_attach_selfavatar(context: &Context, chat_id: ChatId) -> Result<boo
|
||||
pub enum MuteDuration {
|
||||
NotMuted,
|
||||
Forever,
|
||||
MutedUntilTimestamp(i64),
|
||||
Until(i64)
|
||||
}
|
||||
|
||||
impl rusqlite::types::ToSql for MuteDuration {
|
||||
@@ -1929,7 +1929,7 @@ impl rusqlite::types::ToSql for MuteDuration {
|
||||
let duration = match &self {
|
||||
MuteDuration::NotMuted => 0,
|
||||
MuteDuration::Forever => -1,
|
||||
MuteDuration::MutedUntilTimestamp(timestamp) => *timestamp as i64,
|
||||
MuteDuration::Until(timestamp) => *timestamp as i64,
|
||||
};
|
||||
let val = rusqlite::types::Value::Integer(duration as i64);
|
||||
let out = rusqlite::types::ToSqlOutput::Owned(val);
|
||||
@@ -1949,7 +1949,7 @@ impl rusqlite::types::FromSql for MuteDuration {
|
||||
if val <= time() {
|
||||
MuteDuration::NotMuted
|
||||
} else {
|
||||
MuteDuration::MutedUntilTimestamp(val)
|
||||
MuteDuration::Until(val)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2880,7 +2880,7 @@ mod tests {
|
||||
set_muted(
|
||||
&t.ctx,
|
||||
chat_id,
|
||||
MuteDuration::MutedUntilTimestamp(time() + 3600),
|
||||
MuteDuration::Until(time() + 3600),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@@ -2891,7 +2891,7 @@ mod tests {
|
||||
set_muted(
|
||||
&t.ctx,
|
||||
chat_id,
|
||||
MuteDuration::MutedUntilTimestamp(time() - 3600),
|
||||
MuteDuration::Until(time() - 3600),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
|
||||
Reference in New Issue
Block a user