Add "mention" class to mention links
This commit is contained in:
parent
2bfb6253f8
commit
a8ae3b6c81
1 changed files with 3 additions and 3 deletions
|
@ -59,7 +59,7 @@ pub fn replace_mentions(
|
|||
// Replace with a link
|
||||
let url = profile.actor_id(instance_url).unwrap();
|
||||
format!(
|
||||
r#"{}<a href="{}" target="_blank" rel="noreferrer">@{}</a>"#,
|
||||
r#"{}<a class="mention" href="{}" target="_blank" rel="noreferrer">@{}</a>"#,
|
||||
caps["space"].to_string(),
|
||||
url,
|
||||
profile.username,
|
||||
|
@ -120,8 +120,8 @@ mod tests {
|
|||
let result = replace_mentions(&mention_map, INSTANCE_HOST, INSTANCE_URL, text);
|
||||
|
||||
let expected_result = concat!(
|
||||
r#"<a href="https://server1.com/users/user1" target="_blank" rel="noreferrer">@user1</a> "#,
|
||||
r#"<a href="https://server2.com/actors/user2" target="_blank" rel="noreferrer">@user2</a> "#,
|
||||
r#"<a class="mention" href="https://server1.com/users/user1" target="_blank" rel="noreferrer">@user1</a> "#,
|
||||
r#"<a class="mention" href="https://server2.com/actors/user2" target="_blank" rel="noreferrer">@user2</a> "#,
|
||||
r#"sometext @notmention @test@unknown.org"#,
|
||||
);
|
||||
assert_eq!(result, expected_result);
|
||||
|
|
Loading…
Reference in a new issue