mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 06:16:30 +03:00
--wip-- [skip ci]
This commit is contained in:
@@ -175,6 +175,7 @@ async fn set_msg_id_reaction(
|
|||||||
contact_id: ContactId,
|
contact_id: ContactId,
|
||||||
timestamp: i64,
|
timestamp: i64,
|
||||||
reaction: &Reaction,
|
reaction: &Reaction,
|
||||||
|
rfc724_mid: Option<&str>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if reaction.is_empty() {
|
if reaction.is_empty() {
|
||||||
// Simply remove the record instead of setting it to empty string.
|
// Simply remove the record instead of setting it to empty string.
|
||||||
@@ -191,11 +192,11 @@ async fn set_msg_id_reaction(
|
|||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
.execute(
|
.execute(
|
||||||
"INSERT INTO reactions (msg_id, contact_id, reaction)
|
"INSERT INTO reactions (msg_id, contact_id, reaction, rfc724_mid)
|
||||||
VALUES (?1, ?2, ?3)
|
VALUES (?1, ?2, ?3, ?4)
|
||||||
ON CONFLICT(msg_id, contact_id)
|
ON CONFLICT(msg_id, contact_id)
|
||||||
DO UPDATE SET reaction=excluded.reaction",
|
DO UPDATE SET reaction=excluded.reaction, rfc724_mid=excluded.rfc724_mid",
|
||||||
(msg_id, contact_id, reaction.as_str()),
|
(msg_id, contact_id, reaction.as_str(), rfc724_mid),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
let mut chat = Chat::load_from_db(context, chat_id).await?;
|
let mut chat = Chat::load_from_db(context, chat_id).await?;
|
||||||
@@ -245,6 +246,7 @@ pub async fn send_reaction(context: &Context, msg_id: MsgId, reaction: &str) ->
|
|||||||
ContactId::SELF,
|
ContactId::SELF,
|
||||||
reaction_msg.timestamp_sort,
|
reaction_msg.timestamp_sort,
|
||||||
&reaction,
|
&reaction,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(reaction_msg_id)
|
Ok(reaction_msg_id)
|
||||||
@@ -276,9 +278,13 @@ pub(crate) async fn set_msg_reaction(
|
|||||||
timestamp: i64,
|
timestamp: i64,
|
||||||
reaction: Reaction,
|
reaction: Reaction,
|
||||||
is_incoming_fresh: bool,
|
is_incoming_fresh: bool,
|
||||||
|
rfc724_mid: Option<&str>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if let Some((msg_id, _)) = rfc724_mid_exists(context, in_reply_to).await? {
|
if let Some((msg_id, _)) = rfc724_mid_exists(context, in_reply_to).await? {
|
||||||
set_msg_id_reaction(context, msg_id, chat_id, contact_id, timestamp, &reaction).await?;
|
set_msg_id_reaction(
|
||||||
|
context, msg_id, chat_id, contact_id, timestamp, &reaction, rfc724_mid,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
if is_incoming_fresh
|
if is_incoming_fresh
|
||||||
&& !reaction.is_empty()
|
&& !reaction.is_empty()
|
||||||
|
|||||||
@@ -1482,6 +1482,7 @@ async fn add_parts(
|
|||||||
sort_timestamp,
|
sort_timestamp,
|
||||||
Reaction::from(reaction_str.as_str()),
|
Reaction::from(reaction_str.as_str()),
|
||||||
is_incoming_fresh,
|
is_incoming_fresh,
|
||||||
|
Some(rfc724_mid),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1068,6 +1068,15 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid);
|
|||||||
migration_version,
|
migration_version,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
inc_and_check(&mut migration_version, 124)?;
|
||||||
|
if dbversion < migration_version {
|
||||||
|
sql.execute_migration(
|
||||||
|
"ALTER TABLE reactions ADD COLUMN rfc724_mid TEXT;",
|
||||||
|
migration_version,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_version = sql
|
let new_version = sql
|
||||||
|
|||||||
Reference in New Issue
Block a user