Added GroupPinnedStatuses
• Added: - GroupPinnedStatuses - controllers for timeline, creation, deletion - redux actions, reducers for creation, deletion - timeline fetching in timelines action - options to pin, unpin in status options popover for group admin
This commit is contained in:
@@ -63,6 +63,14 @@ export const GROUP_UPDATE_ROLE_REQUEST = 'GROUP_UPDATE_ROLE_REQUEST';
|
||||
export const GROUP_UPDATE_ROLE_SUCCESS = 'GROUP_UPDATE_ROLE_SUCCESS';
|
||||
export const GROUP_UPDATE_ROLE_FAIL = 'GROUP_UPDATE_ROLE_FAIL';
|
||||
|
||||
export const GROUP_PIN_STATUS_REQUEST = 'GROUP_PIN_STATUS_REQUEST'
|
||||
export const GROUP_PIN_STATUS_SUCCESS = 'GROUP_PIN_STATUS_SUCCESS'
|
||||
export const GROUP_PIN_STATUS_FAIL = 'GROUP_PIN_STATUS_FAIL'
|
||||
|
||||
export const GROUP_UNPIN_STATUS_REQUEST = 'GROUP_UNPIN_STATUS_REQUEST'
|
||||
export const GROUP_UNPIN_STATUS_SUCCESS = 'GROUP_UNPIN_STATUS_SUCCESS'
|
||||
export const GROUP_UNPIN_STATUS_FAIL = 'GROUP_UNPIN_STATUS_FAIL ='
|
||||
|
||||
export const GROUP_TIMELINE_SORT = 'GROUP_TIMELINE_SORT'
|
||||
export const GROUP_TIMELINE_TOP_SORT = 'GROUP_TIMELINE_TOP_SORT'
|
||||
|
||||
@@ -587,6 +595,83 @@ export function updateRoleFail(groupId, id, error) {
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export function pinGroupStatus(groupId, statusId) {
|
||||
return (dispatch, getState) => {
|
||||
if (!me) return
|
||||
|
||||
dispatch(pinGroupStatusRequest(groupId))
|
||||
|
||||
api(getState).post(`/api/v1/groups/${groupId}/pin`, { statusId }).then((response) => {
|
||||
dispatch(pinGroupStatusSuccess(groupId, statusId))
|
||||
}).catch((error) => {
|
||||
dispatch(pinGroupStatusFail(groupId, statusId, error))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function pinGroupStatusRequest(groupId) {
|
||||
return {
|
||||
type: GROUP_PIN_STATUS_REQUEST,
|
||||
groupId,
|
||||
}
|
||||
}
|
||||
|
||||
export function pinGroupStatusSuccess(groupId, statusId) {
|
||||
return {
|
||||
type: GROUP_PIN_STATUS_SUCCESS,
|
||||
groupId,
|
||||
statusId,
|
||||
}
|
||||
}
|
||||
|
||||
export function pinGroupStatusFail(groupId, statusId, error) {
|
||||
return {
|
||||
type: GROUP_PIN_STATUS_FAIL,
|
||||
groupId,
|
||||
statusId,
|
||||
error,
|
||||
}
|
||||
}
|
||||
|
||||
export function unpinGroupStatus(groupId, statusId) {
|
||||
return (dispatch, getState) => {
|
||||
if (!me) return
|
||||
|
||||
dispatch(unpinGroupStatusRequest(groupId))
|
||||
|
||||
api(getState).post(`/api/v1/groups/${groupId}/unpin`, { statusId }).then((response) => {
|
||||
dispatch(unpinGroupStatusSuccess(groupId, statusId))
|
||||
}).catch((error) => {
|
||||
dispatch(unpinGroupStatusFail(groupId, statusId, error))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export function unpinGroupStatusRequest(groupId) {
|
||||
return {
|
||||
type: GROUP_UNPIN_STATUS_REQUEST,
|
||||
groupId,
|
||||
}
|
||||
}
|
||||
|
||||
export function unpinGroupStatusSuccess(groupId, statusId) {
|
||||
return {
|
||||
type: GROUP_UNPIN_STATUS_SUCCESS,
|
||||
groupId,
|
||||
statusId,
|
||||
}
|
||||
}
|
||||
|
||||
export function unpinGroupStatusFail(groupId, statusId, error) {
|
||||
return {
|
||||
type: GROUP_UNPIN_STATUS_FAIL,
|
||||
groupId,
|
||||
statusId,
|
||||
error,
|
||||
}
|
||||
}
|
||||
|
||||
export const sortGroups = (tab, sortType) => (dispatch, getState) => {
|
||||
const groupIdsByTab = getState().getIn(['group_lists', tab, 'items'], ImmutableList()).toJS()
|
||||
const allGroups = getState().get('groups', ImmutableMap()).toJS()
|
||||
|
||||
@@ -173,6 +173,7 @@ export const expandAccountFeaturedTimeline = accountId => expandTimeline(`accoun
|
||||
export const expandAccountMediaTimeline = (accountId, { maxId, limit, mediaType } = {}) => expandTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { max_id: maxId, only_media: true, limit: limit || 20, media_type: mediaType });
|
||||
export const expandListTimeline = (id, { maxId } = {}, done = noOp) => expandTimeline(`list:${id}`, `/api/v1/timelines/list/${id}`, { max_id: maxId }, done);
|
||||
export const expandGroupTimeline = (id, { sortBy, maxId, onlyMedia } = {}, done = noOp) => expandTimeline(`group:${id}`, `/api/v1/timelines/group/${id}`, { sort_by: sortBy, max_id: maxId, only_media: onlyMedia }, done);
|
||||
export const expandGroupFeaturedTimeline = (groupId, done = noOp) => expandTimeline(`group:${groupId}:pinned`, `/api/v1/timelines/group_pins/${groupId}`, {}, done);
|
||||
export const expandGroupCollectionTimeline = (collectionType, { sortBy, maxId } = {}, done = noOp) => expandTimeline(`group_collection:${collectionType}`, `/api/v1/timelines/group_collection/${collectionType}`, { sort_by: sortBy, max_id: maxId }, done);
|
||||
export const expandHashtagTimeline = (hashtag, { maxId, tags } = {}, done = noOp) => {
|
||||
return expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`, {
|
||||
|
||||
Reference in New Issue
Block a user