diff options
Diffstat (limited to 'src/services/api')
| -rw-r--r-- | src/services/api/api.service.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 609f6790..e90723a1 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -840,7 +840,7 @@ const postStatus = ({ }) if (pollOptions.some(option => option !== '')) { const normalizedPoll = { - expires_in: poll.expiresIn, + expires_in: parseInt(poll.expiresIn, 10), multiple: poll.multiple } Object.keys(normalizedPoll).forEach(key => { @@ -897,7 +897,7 @@ const editStatus = ({ if (pollOptions.some(option => option !== '')) { const normalizedPoll = { - expires_in: poll.expiresIn, + expires_in: parseInt(poll.expiresIn, 10), multiple: poll.multiple } Object.keys(normalizedPoll).forEach(key => { @@ -1114,13 +1114,21 @@ const generateMfaBackupCodes = ({ credentials }) => { }).then((data) => data.json()) } -const fetchMutes = ({ credentials }) => { - return promisedRequest({ url: MASTODON_USER_MUTES_URL, credentials }) +const fetchMutes = ({ maxId, credentials }) => { + const query = new URLSearchParams({ with_relationships: true }) + if (maxId) { + query.append('max_id', maxId) + } + return promisedRequest({ url: `${MASTODON_USER_MUTES_URL}?${query.toString()}`, credentials }) .then((users) => users.map(parseUser)) } -const muteUser = ({ id, credentials }) => { - return promisedRequest({ url: MASTODON_MUTE_USER_URL(id), credentials, method: 'POST' }) +const muteUser = ({ id, expiresIn, credentials }) => { + const payload = {} + if (expiresIn) { + payload.expires_in = expiresIn + } + return promisedRequest({ url: MASTODON_MUTE_USER_URL(id), credentials, method: 'POST', payload }) } const unmuteUser = ({ id, credentials }) => { @@ -1135,8 +1143,12 @@ const unsubscribeUser = ({ id, credentials }) => { return promisedRequest({ url: MASTODON_UNSUBSCRIBE_USER(id), credentials, method: 'POST' }) } -const fetchBlocks = ({ credentials }) => { - return promisedRequest({ url: MASTODON_USER_BLOCKS_URL, credentials }) +const fetchBlocks = ({ maxId, credentials }) => { + const query = new URLSearchParams({ with_relationships: true }) + if (maxId) { + query.append('max_id', maxId) + } + return promisedRequest({ url: `${MASTODON_USER_BLOCKS_URL}?${query.toString()}`, credentials }) .then((users) => users.map(parseUser)) } |
