From 118cbd5994d11b5cd6b0c9a4248a66ae2b63d0f9 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 28 Jun 2023 16:22:22 -0500 Subject: [PATCH] status.get('x') --> status.x --- app/soapbox/actions/emoji-reacts.ts | 4 ++-- app/soapbox/actions/interactions.ts | 20 ++++++++++---------- app/soapbox/actions/timelines.ts | 2 +- app/soapbox/components/status-action-bar.tsx | 4 ++-- app/soapbox/reducers/admin.ts | 2 +- app/soapbox/reducers/notifications.ts | 2 +- app/soapbox/reducers/statuses.ts | 16 ++++++++-------- app/soapbox/reducers/timelines.ts | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/soapbox/actions/emoji-reacts.ts b/app/soapbox/actions/emoji-reacts.ts index 746a7372f8..ce18e41c47 100644 --- a/app/soapbox/actions/emoji-reacts.ts +++ b/app/soapbox/actions/emoji-reacts.ts @@ -77,7 +77,7 @@ const emojiReact = (status: Status, emoji: string, custom?: string) => dispatch(emojiReactRequest(status, emoji, custom)); 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) { dispatch(importFetchedStatus(response.data)); dispatch(emojiReactSuccess(status, emoji)); @@ -93,7 +93,7 @@ const unEmojiReact = (status: Status, emoji: string) => dispatch(unEmojiReactRequest(status, emoji)); return api(getState) - .delete(`/api/v1/pleroma/statuses/${status.get('id')}/reactions/${emoji}`) + .delete(`/api/v1/pleroma/statuses/${status.id}/reactions/${emoji}`) .then(response => { dispatch(importFetchedStatus(response.data)); dispatch(unEmojiReactSuccess(status, emoji)); diff --git a/app/soapbox/actions/interactions.ts b/app/soapbox/actions/interactions.ts index 13689b5030..68a6d9cacf 100644 --- a/app/soapbox/actions/interactions.ts +++ b/app/soapbox/actions/interactions.ts @@ -91,7 +91,7 @@ const reblog = (status: StatusEntity) => 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 // interested in how the original is modified, hence passing it skipping the wrapper dispatch(importFetchedStatus(response.data.reblog)); @@ -107,7 +107,7 @@ const unreblog = (status: StatusEntity) => 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)); }).catch(error => { dispatch(unreblogFail(status, error)); @@ -240,7 +240,7 @@ const dislike = (status: StatusEntity) => 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)); }).catch(function(error) { dispatch(dislikeFail(status, error)); @@ -253,7 +253,7 @@ const undislike = (status: StatusEntity) => 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)); }).catch(error => { dispatch(undislikeFail(status, error)); @@ -311,7 +311,7 @@ const bookmark = (status: StatusEntity) => (dispatch: AppDispatch, getState: () => RootState) => { 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(bookmarkSuccess(status, response.data)); toast.success(messages.bookmarkAdded, { @@ -327,7 +327,7 @@ const unbookmark = (status: StatusEntity) => (dispatch: AppDispatch, getState: () => RootState) => { 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(unbookmarkSuccess(status, response.data)); toast.success(messages.bookmarkRemoved); @@ -564,7 +564,7 @@ const pin = (status: StatusEntity) => 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(pinSuccess(status)); }).catch(error => { @@ -575,14 +575,14 @@ const pin = (status: StatusEntity) => const pinToGroup = (status: StatusEntity, group: Group) => (dispatch: AppDispatch, getState: () => RootState) => { 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))); }; const unpinFromGroup = (status: StatusEntity, group: Group) => (dispatch: AppDispatch, getState: () => RootState) => { 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))); }; @@ -611,7 +611,7 @@ const unpin = (status: StatusEntity) => 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(unpinSuccess(status)); }).catch(error => { diff --git a/app/soapbox/actions/timelines.ts b/app/soapbox/actions/timelines.ts index 21e36798fe..d6dd70db3d 100644 --- a/app/soapbox/actions/timelines.ts +++ b/app/soapbox/actions/timelines.ts @@ -114,7 +114,7 @@ const dequeueTimeline = (timelineId: string, expandFunc?: (lastStatusId: string) const deleteFromTimelines = (id: string) => (dispatch: AppDispatch, getState: () => RootState) => { 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); dispatch({ diff --git a/app/soapbox/components/status-action-bar.tsx b/app/soapbox/components/status-action-bar.tsx index 47f7691023..a42fac13bf 100644 --- a/app/soapbox/components/status-action-bar.tsx +++ b/app/soapbox/components/status-action-bar.tsx @@ -305,7 +305,7 @@ const StatusActionBar: React.FC = ({ }; const handleBlockClick: React.EventHandler = (e) => { - const account = status.get('account') as Account; + const account = status.account as Account; dispatch(openModal('CONFIRM', { icon: require('@tabler/icons/ban.svg'), @@ -327,7 +327,7 @@ const StatusActionBar: React.FC = ({ const handleEmbed = () => { dispatch(openModal('EMBED', { - url: status.get('url'), + url: status.url, onError: (error: any) => toast.showAlertForError(error), })); }; diff --git a/app/soapbox/reducers/admin.ts b/app/soapbox/reducers/admin.ts index 7228a115ed..bf2fd0818d 100644 --- a/app/soapbox/reducers/admin.ts +++ b/app/soapbox/reducers/admin.ts @@ -146,7 +146,7 @@ const minifyReport = (report: AdminReportRecord): ReducerAdminReport => { action_taken_by_account: normalizeId(report.getIn(['action_taken_by_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; }; diff --git a/app/soapbox/reducers/notifications.ts b/app/soapbox/reducers/notifications.ts index f563fce832..8462f873f4 100644 --- a/app/soapbox/reducers/notifications.ts +++ b/app/soapbox/reducers/notifications.ts @@ -93,7 +93,7 @@ const isValid = (notification: APIEntity) => { } // 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; } diff --git a/app/soapbox/reducers/statuses.ts b/app/soapbox/reducers/statuses.ts index 8d8a7d35d1..50bc7e204b 100644 --- a/app/soapbox/reducers/statuses.ts +++ b/app/soapbox/reducers/statuses.ts @@ -263,27 +263,27 @@ export default function statuses(state = initialState, action: AnyAction): State case EMOJI_REACT_REQUEST: return state .updateIn( - [action.status.get('id'), 'pleroma', 'emoji_reactions'], + [action.status.id, 'pleroma', 'emoji_reactions'], emojiReacts => simulateEmojiReact(emojiReacts as any, action.emoji, action.custom), ); case UNEMOJI_REACT_REQUEST: return state .updateIn( - [action.status.get('id'), 'pleroma', 'emoji_reactions'], + [action.status.id, 'pleroma', 'emoji_reactions'], emojiReacts => simulateUnEmojiReact(emojiReacts as any, action.emoji), ); 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: - 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: - return state.setIn([action.status.get('id'), 'reblogged'], true); + return state.setIn([action.status.id, 'reblogged'], true); 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: - return state.setIn([action.status.get('id'), 'reblogged'], false); + return state.setIn([action.status.id, 'reblogged'], false); 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: return state.setIn([action.id, 'muted'], true); case STATUS_UNMUTE_SUCCESS: diff --git a/app/soapbox/reducers/timelines.ts b/app/soapbox/reducers/timelines.ts index db84b6a25a..e71ab1471c 100644 --- a/app/soapbox/reducers/timelines.ts +++ b/app/soapbox/reducers/timelines.ts @@ -212,7 +212,7 @@ const buildReferencesTo = (statuses: ImmutableMap, status: Statu const filterTimelines = (state: State, relationship: APIEntity, statuses: ImmutableMap) => { return state.withMutations(state => { statuses.forEach(status => { - if (status.get('account') !== relationship.id) return; + if (status.account !== relationship.id) return; const references = buildReferencesTo(statuses, status); deleteStatus(state, status.id, status.account!.id, references, relationship.id); });