Răsfoiți Sursa

In build_mentions(), avoid adding a user handle more than once.

default 2 ani în urmă
părinte
comite
74ce67a631
1 a modificat fișierele cu 7 adăugiri și 3 ștergeri
  1. 7 3
      html.c

+ 7 - 3
html.c

@@ -1111,12 +1111,16 @@ xs_str *build_mentions(snac *snac, const xs_dict *msg)
 
 
                 if (xs_list_len(l2) >= 3) {
                 if (xs_list_len(l2) >= 3) {
                     xs *s1 = xs_fmt("%s@%s ", name, xs_list_get(l2, 2));
                     xs *s1 = xs_fmt("%s@%s ", name, xs_list_get(l2, 2));
-                    s = xs_str_cat(s, s1);
+
+                    if (xs_str_in(s, s1) == -1)
+                        s = xs_str_cat(s, s1);
                 }
                 }
             }
             }
             else {
             else {
-                s = xs_str_cat(s, name);
-                s = xs_str_cat(s, " ");
+                if (xs_str_in(s, name) == -1) {
+                    s = xs_str_cat(s, name);
+                    s = xs_str_cat(s, " ");
+                }
             }
             }
         }
         }
     }
     }