Sort recent emoji in descending order

Fixes https://github.com/vector-im/riot-web/issues/14594
This commit is contained in:
J. Ryan Stinnett 2020-07-17 16:27:21 +01:00
parent 08f88550b1
commit c578f40ad8

View file

@ -16,7 +16,7 @@ limitations under the License.
*/
import SettingsStore, {SettingLevel} from "../settings/SettingsStore";
import {sortBy} from "lodash";
import {orderBy} from "lodash";
interface ILegacyFormat {
[emoji: string]: [number, number]; // [count, date]
@ -68,6 +68,6 @@ export function get(limit = 24) {
}
// perform a stable sort on `count` to keep the recent (date) order as a secondary sort factor
const sorted = sortBy(recents, "1");
const sorted = orderBy(recents, "1", "desc");
return sorted.slice(0, limit).map(([emoji]) => emoji);
}