Sort recent emoji in descending order
Fixes https://github.com/vector-im/riot-web/issues/14594
This commit is contained in:
parent
08f88550b1
commit
c578f40ad8
1 changed files with 2 additions and 2 deletions
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import SettingsStore, {SettingLevel} from "../settings/SettingsStore";
|
import SettingsStore, {SettingLevel} from "../settings/SettingsStore";
|
||||||
import {sortBy} from "lodash";
|
import {orderBy} from "lodash";
|
||||||
|
|
||||||
interface ILegacyFormat {
|
interface ILegacyFormat {
|
||||||
[emoji: string]: [number, number]; // [count, date]
|
[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
|
// 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);
|
return sorted.slice(0, limit).map(([emoji]) => emoji);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue