mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
perf: call getIconbackgrounds once
instead of 20x on topic/topic list load
This commit is contained in:
@@ -607,7 +607,7 @@ describe('User', () => {
|
||||
|
||||
it('should return an icon text and valid background if username and picture is explicitly requested', async () => {
|
||||
const payload = await User.getUserFields(testUid, ['username', 'picture']);
|
||||
const validBackgrounds = await User.getIconBackgrounds(testUid);
|
||||
const validBackgrounds = await User.getIconBackgrounds();
|
||||
assert.strictEqual(payload['icon:text'], userData.username.slice(0, 1).toUpperCase());
|
||||
assert(payload['icon:bgColor']);
|
||||
assert(validBackgrounds.includes(payload['icon:bgColor']));
|
||||
@@ -616,7 +616,7 @@ describe('User', () => {
|
||||
it('should return a valid background, even if an invalid background colour is set', async () => {
|
||||
await User.setUserField(testUid, 'icon:bgColor', 'teal');
|
||||
const payload = await User.getUserFields(testUid, ['username', 'picture']);
|
||||
const validBackgrounds = await User.getIconBackgrounds(testUid);
|
||||
const validBackgrounds = await User.getIconBackgrounds();
|
||||
|
||||
assert(payload['icon:bgColor']);
|
||||
assert(validBackgrounds.includes(payload['icon:bgColor']));
|
||||
|
||||
Reference in New Issue
Block a user