Эх сурвалжийг харах

Contact sorting: Ignore tilde

Danilo Bargen 7 жил өмнө
parent
commit
f18c75af99

+ 4 - 2
src/threema/container.ts

@@ -123,8 +123,10 @@ class Receivers implements threema.Container.Receivers {
         data.sort((a: threema.Receiver, b: threema.Receiver) => {
             if (a.id.startsWith('*') && !b.id.startsWith('*')) { return 1; }
             if (!a.id.startsWith('*') && b.id.startsWith('*')) { return -1; }
-            if (a.displayName < b.displayName) { return -1; }
-            if (a.displayName > b.displayName) { return 1; }
+            const left = a.displayName.startsWith('~') ? a.displayName.substr(1) : a.displayName;
+            const right = b.displayName.startsWith('~') ? b.displayName.substr(1) : b.displayName;
+            if (left < right) { return -1; }
+            if (left > right) { return 1; }
             return 0;
         });
         this.contacts = new Map(data.map((c) => {