Merge branch 'status-get' into 'develop'

status.get('x') --> status.x

See merge request soapbox-pub/soapbox!2580
This commit is contained in:
Alex Gleason 2023-06-28 22:53:50 +00:00
commit a336fa2137
8 changed files with 26 additions and 26 deletions

View file

@ -77,7 +77,7 @@ const emojiReact = (status: Status, emoji: string, custom?: string) =>
dispatch(emojiReactRequest(status, emoji, custom)); dispatch(emojiReactRequest(status, emoji, custom));
return api(getState) return api(getState)
.put(`/api/v1/pleroma/statuses/${status.get('id')}/reactions/${emoji}`) .put(`/api/v1/pleroma/statuses/${status.id}/reactions/${emoji}`)
.then(function(response) { .then(function(response) {
dispatch(importFetchedStatus(response.data)); dispatch(importFetchedStatus(response.data));
dispatch(emojiReactSuccess(status, emoji)); dispatch(emojiReactSuccess(status, emoji));
@ -93,7 +93,7 @@ const unEmojiReact = (status: Status, emoji: string) =>
dispatch(unEmojiReactRequest(status, emoji)); dispatch(unEmojiReactRequest(status, emoji));
return api(getState) return api(getState)
.delete(`/api/v1/pleroma/statuses/${status.get('id')}/reactions/${emoji}`) .delete(`/api/v1/pleroma/statuses/${status.id}/reactions/${emoji}`)
.then(response => { .then(response => {
dispatch(importFetchedStatus(response.data)); dispatch(importFetchedStatus(response.data));
dispatch(unEmojiReactSuccess(status, emoji)); dispatch(unEmojiReactSuccess(status, emoji));

View file

@ -91,7 +91,7 @@ const reblog = (status: StatusEntity) =>
dispatch(reblogRequest(status)); dispatch(reblogRequest(status));
api(getState).post(`/api/v1/statuses/${status.get('id')}/reblog`).then(function(response) { api(getState).post(`/api/v1/statuses/${status.id}/reblog`).then(function(response) {
// The reblog API method returns a new status wrapped around the original. In this case we are only // The reblog API method returns a new status wrapped around the original. In this case we are only
// interested in how the original is modified, hence passing it skipping the wrapper // interested in how the original is modified, hence passing it skipping the wrapper
dispatch(importFetchedStatus(response.data.reblog)); dispatch(importFetchedStatus(response.data.reblog));
@ -107,7 +107,7 @@ const unreblog = (status: StatusEntity) =>
dispatch(unreblogRequest(status)); dispatch(unreblogRequest(status));
api(getState).post(`/api/v1/statuses/${status.get('id')}/unreblog`).then(() => { api(getState).post(`/api/v1/statuses/${status.id}/unreblog`).then(() => {
dispatch(unreblogSuccess(status)); dispatch(unreblogSuccess(status));
}).catch(error => { }).catch(error => {
dispatch(unreblogFail(status, error)); dispatch(unreblogFail(status, error));
@ -240,7 +240,7 @@ const dislike = (status: StatusEntity) =>
dispatch(dislikeRequest(status)); dispatch(dislikeRequest(status));
api(getState).post(`/api/friendica/statuses/${status.get('id')}/dislike`).then(function() { api(getState).post(`/api/friendica/statuses/${status.id}/dislike`).then(function() {
dispatch(dislikeSuccess(status)); dispatch(dislikeSuccess(status));
}).catch(function(error) { }).catch(function(error) {
dispatch(dislikeFail(status, error)); dispatch(dislikeFail(status, error));
@ -253,7 +253,7 @@ const undislike = (status: StatusEntity) =>
dispatch(undislikeRequest(status)); dispatch(undislikeRequest(status));
api(getState).post(`/api/friendica/statuses/${status.get('id')}/undislike`).then(() => { api(getState).post(`/api/friendica/statuses/${status.id}/undislike`).then(() => {
dispatch(undislikeSuccess(status)); dispatch(undislikeSuccess(status));
}).catch(error => { }).catch(error => {
dispatch(undislikeFail(status, error)); dispatch(undislikeFail(status, error));
@ -311,7 +311,7 @@ const bookmark = (status: StatusEntity) =>
(dispatch: AppDispatch, getState: () => RootState) => { (dispatch: AppDispatch, getState: () => RootState) => {
dispatch(bookmarkRequest(status)); dispatch(bookmarkRequest(status));
api(getState).post(`/api/v1/statuses/${status.get('id')}/bookmark`).then(function(response) { api(getState).post(`/api/v1/statuses/${status.id}/bookmark`).then(function(response) {
dispatch(importFetchedStatus(response.data)); dispatch(importFetchedStatus(response.data));
dispatch(bookmarkSuccess(status, response.data)); dispatch(bookmarkSuccess(status, response.data));
toast.success(messages.bookmarkAdded, { toast.success(messages.bookmarkAdded, {
@ -327,7 +327,7 @@ const unbookmark = (status: StatusEntity) =>
(dispatch: AppDispatch, getState: () => RootState) => { (dispatch: AppDispatch, getState: () => RootState) => {
dispatch(unbookmarkRequest(status)); dispatch(unbookmarkRequest(status));
api(getState).post(`/api/v1/statuses/${status.get('id')}/unbookmark`).then(response => { api(getState).post(`/api/v1/statuses/${status.id}/unbookmark`).then(response => {
dispatch(importFetchedStatus(response.data)); dispatch(importFetchedStatus(response.data));
dispatch(unbookmarkSuccess(status, response.data)); dispatch(unbookmarkSuccess(status, response.data));
toast.success(messages.bookmarkRemoved); toast.success(messages.bookmarkRemoved);
@ -564,7 +564,7 @@ const pin = (status: StatusEntity) =>
dispatch(pinRequest(status)); dispatch(pinRequest(status));
api(getState).post(`/api/v1/statuses/${status.get('id')}/pin`).then(response => { api(getState).post(`/api/v1/statuses/${status.id}/pin`).then(response => {
dispatch(importFetchedStatus(response.data)); dispatch(importFetchedStatus(response.data));
dispatch(pinSuccess(status)); dispatch(pinSuccess(status));
}).catch(error => { }).catch(error => {
@ -575,14 +575,14 @@ const pin = (status: StatusEntity) =>
const pinToGroup = (status: StatusEntity, group: Group) => const pinToGroup = (status: StatusEntity, group: Group) =>
(dispatch: AppDispatch, getState: () => RootState) => { (dispatch: AppDispatch, getState: () => RootState) => {
return api(getState) return api(getState)
.post(`/api/v1/groups/${group.id}/statuses/${status.get('id')}/pin`) .post(`/api/v1/groups/${group.id}/statuses/${status.id}/pin`)
.then(() => dispatch(expandGroupFeaturedTimeline(group.id))); .then(() => dispatch(expandGroupFeaturedTimeline(group.id)));
}; };
const unpinFromGroup = (status: StatusEntity, group: Group) => const unpinFromGroup = (status: StatusEntity, group: Group) =>
(dispatch: AppDispatch, getState: () => RootState) => { (dispatch: AppDispatch, getState: () => RootState) => {
return api(getState) return api(getState)
.post(`/api/v1/groups/${group.id}/statuses/${status.get('id')}/unpin`) .post(`/api/v1/groups/${group.id}/statuses/${status.id}/unpin`)
.then(() => dispatch(expandGroupFeaturedTimeline(group.id))); .then(() => dispatch(expandGroupFeaturedTimeline(group.id)));
}; };
@ -611,7 +611,7 @@ const unpin = (status: StatusEntity) =>
dispatch(unpinRequest(status)); dispatch(unpinRequest(status));
api(getState).post(`/api/v1/statuses/${status.get('id')}/unpin`).then(response => { api(getState).post(`/api/v1/statuses/${status.id}/unpin`).then(response => {
dispatch(importFetchedStatus(response.data)); dispatch(importFetchedStatus(response.data));
dispatch(unpinSuccess(status)); dispatch(unpinSuccess(status));
}).catch(error => { }).catch(error => {

View file

@ -114,7 +114,7 @@ const dequeueTimeline = (timelineId: string, expandFunc?: (lastStatusId: string)
const deleteFromTimelines = (id: string) => const deleteFromTimelines = (id: string) =>
(dispatch: AppDispatch, getState: () => RootState) => { (dispatch: AppDispatch, getState: () => RootState) => {
const accountId = getState().statuses.get(id)?.account; const accountId = getState().statuses.get(id)?.account;
const references = getState().statuses.filter(status => status.get('reblog') === id).map(status => [status.get('id'), status.get('account')]); const references = getState().statuses.filter(status => status.reblog === id).map(status => [status.id, status.account]);
const reblogOf = getState().statuses.getIn([id, 'reblog'], null); const reblogOf = getState().statuses.getIn([id, 'reblog'], null);
dispatch({ dispatch({

View file

@ -305,7 +305,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
}; };
const handleBlockClick: React.EventHandler<React.MouseEvent> = (e) => { const handleBlockClick: React.EventHandler<React.MouseEvent> = (e) => {
const account = status.get('account') as Account; const account = status.account as Account;
dispatch(openModal('CONFIRM', { dispatch(openModal('CONFIRM', {
icon: require('@tabler/icons/ban.svg'), icon: require('@tabler/icons/ban.svg'),
@ -327,7 +327,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
const handleEmbed = () => { const handleEmbed = () => {
dispatch(openModal('EMBED', { dispatch(openModal('EMBED', {
url: status.get('url'), url: status.url,
onError: (error: any) => toast.showAlertForError(error), onError: (error: any) => toast.showAlertForError(error),
})); }));
}; };

View file

@ -146,7 +146,7 @@ const minifyReport = (report: AdminReportRecord): ReducerAdminReport => {
action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])), action_taken_by_account: normalizeId(report.getIn(['action_taken_by_account', 'id'])),
assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])), assigned_account: normalizeId(report.getIn(['assigned_account', 'id'])),
statuses: report.get('statuses').map((status: any) => normalizeId(status.get('id'))), statuses: report.get('statuses').map((status: any) => normalizeId(status.id)),
}) as ReducerAdminReport; }) as ReducerAdminReport;
}; };

View file

@ -93,7 +93,7 @@ const isValid = (notification: APIEntity) => {
} }
// Mastodon can return status notifications with a null status // Mastodon can return status notifications with a null status
if (['mention', 'reblog', 'favourite', 'poll', 'status'].includes(notification.type) && !notification.status.get('id')) { if (['mention', 'reblog', 'favourite', 'poll', 'status'].includes(notification.type) && !notification.status.id) {
return false; return false;
} }

View file

@ -263,27 +263,27 @@ export default function statuses(state = initialState, action: AnyAction): State
case EMOJI_REACT_REQUEST: case EMOJI_REACT_REQUEST:
return state return state
.updateIn( .updateIn(
[action.status.get('id'), 'pleroma', 'emoji_reactions'], [action.status.id, 'pleroma', 'emoji_reactions'],
emojiReacts => simulateEmojiReact(emojiReacts as any, action.emoji, action.custom), emojiReacts => simulateEmojiReact(emojiReacts as any, action.emoji, action.custom),
); );
case UNEMOJI_REACT_REQUEST: case UNEMOJI_REACT_REQUEST:
return state return state
.updateIn( .updateIn(
[action.status.get('id'), 'pleroma', 'emoji_reactions'], [action.status.id, 'pleroma', 'emoji_reactions'],
emojiReacts => simulateUnEmojiReact(emojiReacts as any, action.emoji), emojiReacts => simulateUnEmojiReact(emojiReacts as any, action.emoji),
); );
case FAVOURITE_FAIL: case FAVOURITE_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false); return state.get(action.status.id) === undefined ? state : state.setIn([action.status.id, 'favourited'], false);
case DISLIKE_FAIL: case DISLIKE_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'disliked'], false); return state.get(action.status.id) === undefined ? state : state.setIn([action.status.id, 'disliked'], false);
case REBLOG_REQUEST: case REBLOG_REQUEST:
return state.setIn([action.status.get('id'), 'reblogged'], true); return state.setIn([action.status.id, 'reblogged'], true);
case REBLOG_FAIL: case REBLOG_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false); return state.get(action.status.id) === undefined ? state : state.setIn([action.status.id, 'reblogged'], false);
case UNREBLOG_REQUEST: case UNREBLOG_REQUEST:
return state.setIn([action.status.get('id'), 'reblogged'], false); return state.setIn([action.status.id, 'reblogged'], false);
case UNREBLOG_FAIL: case UNREBLOG_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], true); return state.get(action.status.id) === undefined ? state : state.setIn([action.status.id, 'reblogged'], true);
case STATUS_MUTE_SUCCESS: case STATUS_MUTE_SUCCESS:
return state.setIn([action.id, 'muted'], true); return state.setIn([action.id, 'muted'], true);
case STATUS_UNMUTE_SUCCESS: case STATUS_UNMUTE_SUCCESS:

View file

@ -212,7 +212,7 @@ const buildReferencesTo = (statuses: ImmutableMap<string, Status>, status: Statu
const filterTimelines = (state: State, relationship: APIEntity, statuses: ImmutableMap<string, Status>) => { const filterTimelines = (state: State, relationship: APIEntity, statuses: ImmutableMap<string, Status>) => {
return state.withMutations(state => { return state.withMutations(state => {
statuses.forEach(status => { statuses.forEach(status => {
if (status.get('account') !== relationship.id) return; if (status.account !== relationship.id) return;
const references = buildReferencesTo(statuses, status); const references = buildReferencesTo(statuses, status);
deleteStatus(state, status.id, status.account!.id, references, relationship.id); deleteStatus(state, status.id, status.account!.id, references, relationship.id);
}); });