mirror of
https://github.com/chatmail/core.git
synced 2026-04-23 00:16:34 +03:00
fix(jsonrpc): Use Core's logic for computing VcardContact.color (#7294)
Before, the color was computed from the address, but as we've switched to fingerprint-based contact colors, this logic became stale. Now `deltachat::contact::get_color()` is used. A test would be nice to have, but as now all the logic is in Core, this isn't critical as there are Core tests at least.
This commit is contained in:
@@ -753,6 +753,14 @@ pub(crate) fn buf_decompress(buf: &[u8]) -> Result<Vec<u8>> {
|
||||
Ok(mem::take(decompressor.get_mut()))
|
||||
}
|
||||
|
||||
/// Returns the given `&str` if already lowercased to avoid allocation, otherwise lowercases it.
|
||||
pub(crate) fn to_lowercase(s: &str) -> Cow<'_, str> {
|
||||
match s.chars().all(char::is_lowercase) {
|
||||
true => Cow::Borrowed(s),
|
||||
false => Cow::Owned(s.to_lowercase()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Increments `*t` and checks that it equals to `expected` after that.
|
||||
pub(crate) fn inc_and_check<T: PrimInt + AddAssign + std::fmt::Debug>(
|
||||
t: &mut T,
|
||||
|
||||
Reference in New Issue
Block a user