commit 74ce67a

default  ·  2024-02-05 08:19:27 +0000 UTC
parent ceda5ba
In build_mentions(), avoid adding a user handle more than once.
1 files changed,  +7, -3
M html.c
M html.c
+7, -3
 1@@ -1111,12 +1111,16 @@ xs_str *build_mentions(snac *snac, const xs_dict *msg)
 2 
 3                 if (xs_list_len(l2) >= 3) {
 4                     xs *s1 = xs_fmt("%s@%s ", name, xs_list_get(l2, 2));
 5-                    s = xs_str_cat(s, s1);
 6+
 7+                    if (xs_str_in(s, s1) == -1)
 8+                        s = xs_str_cat(s, s1);
 9                 }
10             }
11             else {
12-                s = xs_str_cat(s, name);
13-                s = xs_str_cat(s, " ");
14+                if (xs_str_in(s, name) == -1) {
15+                    s = xs_str_cat(s, name);
16+                    s = xs_str_cat(s, " ");
17+                }
18             }
19         }
20     }