From f3e34d40d2baed774a30de85ecb19591a1b55c30 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Tue, 14 Jul 2020 00:22:15 -0500 Subject: [PATCH] Updated featured group_lists to be randomized on init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - featured group_lists to be randomized on init --- app/javascript/gabsocial/reducers/group_lists.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/gabsocial/reducers/group_lists.js b/app/javascript/gabsocial/reducers/group_lists.js index 9ea14367..5d630694 100644 --- a/app/javascript/gabsocial/reducers/group_lists.js +++ b/app/javascript/gabsocial/reducers/group_lists.js @@ -40,7 +40,10 @@ export default function groupLists(state = initialState, action) { }); case GROUPS_FETCH_SUCCESS: return state.withMutations((mutable) => { - mutable.setIn([action.tab, 'items'], ImmutableList(action.groups.map(item => item.id))) + let list = ImmutableList(action.groups.map(item => item.id)) + if (action.tab === 'featured') list = list.sortBy(Math.random) + + mutable.setIn([action.tab, 'items'], list) mutable.setIn([action.tab, 'isLoading'], false) mutable.setIn([action.tab, 'isFetched'], true) })