diff --git a/app/javascript/gabsocial/components/sidebar_panel_group.js b/app/javascript/gabsocial/components/sidebar_panel_group.js
index 42360fd2..822cdbb4 100644
--- a/app/javascript/gabsocial/components/sidebar_panel_group.js
+++ b/app/javascript/gabsocial/components/sidebar_panel_group.js
@@ -18,14 +18,14 @@ class SidebarPanelGroup extends React.PureComponent {
promotions,
} = this.props
- if (!!promotions && promotions.count() > 0 && Array.isArray(layout) && !!me) {
+ if (Array.isArray(promotions) && Array.isArray(layout) && !!me) {
const sidebarPromotionPageId = `${page}.sidebar`
- const promotion = promotions.find((p) => p.get('timeline_id') === sidebarPromotionPageId)
+ const promotion = promotions.find((promotion) => promotion.timeline_id === sidebarPromotionPageId)
if (!!promotion) {
- const correctedPosition = promotion.get('position') - 1 > layout.length ? layout.length - 1 : promotion.get('position')
+ const correctedPosition = promotion.position - 1 > layout.length ? layout.length - 1 : promotion.position
if (!layout.find(p => p.key === 'status-promotion-panel')) {
- layout.splice(correctedPosition, 0, )
+ layout.splice(correctedPosition, 0, )
}
}
}
diff --git a/app/javascript/gabsocial/components/status_list.js b/app/javascript/gabsocial/components/status_list.js
index b208c5e2..cb49b8d9 100644
--- a/app/javascript/gabsocial/components/status_list.js
+++ b/app/javascript/gabsocial/components/status_list.js
@@ -49,13 +49,13 @@ class StatusList extends ImmutablePureComponent {
promotions,
} = this.props
- if (!!promotions && promotions.count() > 0) {
+ if (Array.isArray(promotions)) {
promotions.forEach((promotion) => {
- if (promotion.get('timeline_id') === timelineId &&
- statusIds.count() >= promotion.get('position') &&
- !promotedStatuses[promotion.get('status_id')]) {
- onFetchStatus(promotion.get('status_id'))
+ if (promotion.timeline_id === timelineId &&
+ statusIds.count() >= promotion.position &&
+ !promotedStatuses[promotion.status_id]) {
+ onFetchStatus(promotion.status_id)
}
})
@@ -203,13 +203,13 @@ class StatusList extends ImmutablePureComponent {
/>
)
} else {
- if (!!promotions && promotions.count() > 0) {
- const promotion = promotions.find((p) => (p.get('position') === i && p.get('timeline_id') === timelineId))
+ if (Array.isArray(promotions)) {
+ const promotion = promotions.find((promotion) => (promotion.position === i && promotion.timeline_id === timelineId))
if (promotion) {
scrollableContent.push(
{
id: timelineId
})
- const promotedStatuses = (!!promotions && promotions.count() > 0) ?
+ const promotedStatuses = Array.isArray(promotions) ?
promotions.map((promotion) => {
const s = {}
- s[promotion.get('status_id')] = state.getIn(['statuses', promotion.get('status_id')])
+ s[promotion.status_id] = state.getIn(['statuses', promotion.status_id])
return s
}) : []
diff --git a/app/javascript/gabsocial/reducers/promotions.js b/app/javascript/gabsocial/reducers/promotions.js
index ada579a0..3a372108 100644
--- a/app/javascript/gabsocial/reducers/promotions.js
+++ b/app/javascript/gabsocial/reducers/promotions.js
@@ -1,14 +1,10 @@
-import {
- List as ImmutableList,
- fromJS,
-}from 'immutable'
import {
PROMOTIONS_FETCH_REQUEST,
PROMOTIONS_FETCH_SUCCESS,
PROMOTIONS_FETCH_FAIL,
} from '../actions/promotions'
-const initialState = ImmutableList()
+const initialState = []
export default function promotions(state = initialState, action) {
switch (action.type) {
@@ -16,7 +12,7 @@ export default function promotions(state = initialState, action) {
case PROMOTIONS_FETCH_FAIL:
return initialState
case PROMOTIONS_FETCH_SUCCESS:
- return fromJS(action.items)
+ return action.items
default:
return state
}