statuses unit tests
This commit is contained in:
parent
ed62403d96
commit
1396eeb71b
23 changed files with 860 additions and 742 deletions
|
|
@ -26,15 +26,17 @@ export const MASTODON_FOLLOWERS_URL = (
|
|||
|
||||
export const MASTODON_STATUS_URL = (id) => `/api/v1/statuses/${id}`
|
||||
const MASTODON_STATUS_CONTEXT_URL = (id) => `/api/v1/statuses/${id}/context`
|
||||
const MASTODON_STATUS_SOURCE_URL = (id) => `/api/v1/statuses/${id}/source`
|
||||
const MASTODON_STATUS_HISTORY_URL = (id) => `/api/v1/statuses/${id}/history`
|
||||
export const MASTODON_STATUS_SOURCE_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/source`
|
||||
export const MASTODON_STATUS_HISTORY_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/history`
|
||||
const MASTODON_USER_URL = '/api/v1/accounts'
|
||||
const MASTODON_USER_LOOKUP_URL = ({ acct }) =>
|
||||
`/api/v1/accounts/lookup${paramsString({ acct })}`
|
||||
const MASTODON_POLL_URL = (id = '') => `/api/v1/polls/${id}`
|
||||
const MASTODON_STATUS_FAVORITEDBY_URL = (id) =>
|
||||
export const MASTODON_STATUS_FAVORITEDBY_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/favourited_by`
|
||||
const MASTODON_STATUS_REBLOGGEDBY_URL = (id) =>
|
||||
export const MASTODON_STATUS_REBLOGGEDBY_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/reblogged_by`
|
||||
const MASTODON_SEARCH_2 = ({
|
||||
q,
|
||||
|
|
@ -51,7 +53,7 @@ const MASTODON_SEARCH_2 = ({
|
|||
const MASTODON_USER_SEARCH_URL = ({ q, resolve }) =>
|
||||
`/api/v1/accounts/search${paramsString({ q, resolve })}`
|
||||
const MASTODON_KNOWN_DOMAIN_LIST_URL = '/api/v1/instance/peers'
|
||||
const PLEROMA_EMOJI_REACTIONS_URL = (id) =>
|
||||
export const PLEROMA_EMOJI_REACTIONS_URL = (id) =>
|
||||
`/api/v1/pleroma/statuses/${id}/reactions`
|
||||
const PLEROMA_SCROBBLES_URL = (id, { maxId, sinceId, minId, limit, offset }) =>
|
||||
`/api/v1/pleroma/accounts/${id}/scrobbles${paramsString({ maxId, sinceId, minId, limit, offset })}`
|
||||
|
|
@ -174,15 +176,18 @@ export const fetchStatusSource = ({ id, credentials }) =>
|
|||
credentials,
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseSource(data) }))
|
||||
|
||||
export const fetchStatusHistory = ({ status, credentials }) =>
|
||||
export const fetchStatusHistory = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_STATUS_HISTORY_URL(status.id),
|
||||
url: MASTODON_STATUS_HISTORY_URL(id),
|
||||
credentials,
|
||||
}).then(({ data, ...rest }) => {
|
||||
return [...data].reverse().map((item) => {
|
||||
item.originalStatus = status
|
||||
return { ...rest, data: parseStatus(item) }
|
||||
})
|
||||
return {
|
||||
...rest,
|
||||
data: [...data].reverse().map((item) => {
|
||||
item.originalStatus = status
|
||||
return parseStatus(item)
|
||||
}),
|
||||
}
|
||||
})
|
||||
|
||||
export const listEmojiPacks = ({ page, pageSize, credentials }) =>
|
||||
|
|
|
|||
|
|
@ -29,11 +29,12 @@ const MFA_DISABLE_OTP_URL = '/api/pleroma/accounts/mfa/totp'
|
|||
|
||||
const MASTODON_DISMISS_NOTIFICATION_URL = (id) =>
|
||||
`/api/v1/notifications/${id}/dismiss`
|
||||
const MASTODON_FAVORITE_URL = (id) => `/api/v1/statuses/${id}/favourite`
|
||||
const MASTODON_UNFAVORITE_URL = (id) => `/api/v1/statuses/${id}/unfavourite`
|
||||
const MASTODON_RETWEET_URL = (id) => `/api/v1/statuses/${id}/reblog`
|
||||
const MASTODON_UNRETWEET_URL = (id) => `/api/v1/statuses/${id}/unreblog`
|
||||
const MASTODON_DELETE_URL = (id) => `/api/v1/statuses/${id}`
|
||||
export const MASTODON_FAVORITE_URL = (id) => `/api/v1/statuses/${id}/favourite`
|
||||
export const MASTODON_UNFAVORITE_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/unfavourite`
|
||||
export const MASTODON_RETWEET_URL = (id) => `/api/v1/statuses/${id}/reblog`
|
||||
export const MASTODON_UNRETWEET_URL = (id) => `/api/v1/statuses/${id}/unreblog`
|
||||
export const MASTODON_DELETE_URL = (id) => `/api/v1/statuses/${id}`
|
||||
export const MASTODON_FOLLOW_URL = (id) => `/api/v1/accounts/${id}/follow`
|
||||
export const MASTODON_UNFOLLOW_URL = (id) => `/api/v1/accounts/${id}/unfollow`
|
||||
|
||||
|
|
@ -68,25 +69,29 @@ export const MASTODON_UNMUTE_USER_URL = (id) => `/api/v1/accounts/${id}/unmute`
|
|||
export const MASTODON_REMOVE_USER_FROM_FOLLOWERS_URL = (id) =>
|
||||
`/api/v1/accounts/${id}/remove_from_followers`
|
||||
export const MASTODON_USER_NOTE_URL = (id) => `/api/v1/accounts/${id}/note`
|
||||
const MASTODON_BOOKMARK_STATUS_URL = (id) => `/api/v1/statuses/${id}/bookmark`
|
||||
const MASTODON_UNBOOKMARK_STATUS_URL = (id) =>
|
||||
export const MASTODON_BOOKMARK_STATUS_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/bookmark`
|
||||
export const MASTODON_UNBOOKMARK_STATUS_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/unbookmark`
|
||||
const MASTODON_POST_STATUS_URL = '/api/v1/statuses'
|
||||
const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media'
|
||||
const MASTODON_VOTE_URL = (id) => `/api/v1/polls/${id}/votes`
|
||||
const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials'
|
||||
const MASTODON_REPORT_USER_URL = '/api/v1/reports'
|
||||
const MASTODON_PIN_OWN_STATUS = (id) => `/api/v1/statuses/${id}/pin`
|
||||
const MASTODON_UNPIN_OWN_STATUS = (id) => `/api/v1/statuses/${id}/unpin`
|
||||
const MASTODON_MUTE_CONVERSATION = (id) => `/api/v1/statuses/${id}/mute`
|
||||
const MASTODON_UNMUTE_CONVERSATION = (id) => `/api/v1/statuses/${id}/unmute`
|
||||
export const MASTODON_PIN_OWN_STATUS_URL = (id) => `/api/v1/statuses/${id}/pin`
|
||||
export const MASTODON_UNPIN_OWN_STATUS_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/unpin`
|
||||
export const MASTODON_MUTE_CONVERSATION_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/mute`
|
||||
export const MASTODON_UNMUTE_CONVERSATION_URL = (id) =>
|
||||
`/api/v1/statuses/${id}/unmute`
|
||||
export const MASTODON_DOMAIN_BLOCKS_URL = '/api/v1/domain_blocks'
|
||||
const MASTODON_ANNOUNCEMENTS_URL = '/api/v1/announcements'
|
||||
const MASTODON_ANNOUNCEMENTS_DISMISS_URL = (id) =>
|
||||
`/api/v1/announcements/${id}/dismiss`
|
||||
const PLEROMA_EMOJI_REACT_URL = (id, emoji) =>
|
||||
export const PLEROMA_EMOJI_REACT_URL = (id, emoji) =>
|
||||
`/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
|
||||
const PLEROMA_EMOJI_UNREACT_URL = (id, emoji) =>
|
||||
export const PLEROMA_EMOJI_UNREACT_URL = (id, emoji) =>
|
||||
`/api/v1/pleroma/statuses/${id}/reactions/${emoji}`
|
||||
const PLEROMA_BACKUP_URL = '/api/v1/pleroma/backups'
|
||||
const PLEROMA_BOOKMARK_FOLDERS_URL = '/api/v1/pleroma/bookmark_folders'
|
||||
|
|
@ -155,28 +160,28 @@ export const unbookmarkStatus = ({ id, credentials }) =>
|
|||
|
||||
export const pinOwnStatus = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_PIN_OWN_STATUS(id),
|
||||
url: MASTODON_PIN_OWN_STATUS_URL(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
|
||||
export const unpinOwnStatus = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_UNPIN_OWN_STATUS(id),
|
||||
url: MASTODON_UNPIN_OWN_STATUS_URL(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
|
||||
export const muteConversation = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_MUTE_CONVERSATION(id),
|
||||
url: MASTODON_MUTE_CONVERSATION_URL(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
|
||||
export const unmuteConversation = ({ id, credentials }) =>
|
||||
promisedRequest({
|
||||
url: MASTODON_UNMUTE_CONVERSATION(id),
|
||||
url: MASTODON_UNMUTE_CONVERSATION_URL(id),
|
||||
credentials,
|
||||
method: 'POST',
|
||||
}).then(({ data, ...rest }) => ({ ...rest, data: parseStatus(data) }))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue