Skip to content

Commit

Permalink
Only consider text of message content for equality comparison.
Browse files Browse the repository at this point in the history
  • Loading branch information
andymandias committed Oct 22, 2024
1 parent 031b564 commit 31aeb85
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion data/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ fn parse_user_and_channel_fragments(text: &str, channel_users: &[User]) -> Vec<F
})
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, Eq, Serialize, Deserialize)]
pub enum Content {
Plain(String),
Fragments(Vec<Fragment>),
Expand All @@ -520,6 +520,12 @@ impl Content {
}
}

impl PartialEq for Content {
fn eq(&self, other: &Self) -> bool {
self.text() == other.text()
}
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum Fragment {
Text(String),
Expand Down

0 comments on commit 31aeb85

Please sign in to comment.