Skip to content

Commit

Permalink
remove redundant check, add TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Alun Turner committed Jun 13, 2023
1 parent 50a450c commit e8bd655
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/wysiwyg/src/composer_model/mentions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ where
let (start, end) = self.safe_selection();
let range = self.state.dom.find_range(start, end);

// use the display text or the presence of a `data-mention-type => at-room` attribute to decide the mention type
let new_node = if text == "@room".into()
|| attributes.iter().any(|(k, v)| {
k == &S::from("data-mention-type") && v == &S::from("at-room")
}) {
// use the display text decide the mention type
// TODO extract this into a util function if it is reused when parsing the html prior to editing a message
// TODO decide if this do* function should be separated to handle mention vs at-room mention
// TODO handle invalid mention urls after permalink parsing methods have been created
let new_node = if text == "@room".into() {
DomNode::new_at_room_mention(attributes)
} else {
DomNode::new_mention(url, text, attributes)
Expand Down

0 comments on commit e8bd655

Please sign in to comment.