diff options
| author | Henry Jameson <me@hjkos.com> | 2020-01-28 20:44:13 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2020-01-28 20:44:13 +0200 |
| commit | f0c4bb1193f71cb93546be7e8f41236c4c192f85 (patch) | |
| tree | 26c35a98a8aa80279a1d8d938e41629a774fda37 /src/services/api/api.service.js | |
| parent | b63e679a31a573c30868477f17322d6ed040af58 (diff) | |
| parent | c54111797ae1058e59931b2d1f12e6ab6a6f96a9 (diff) | |
Merge remote-tracking branch 'upstream/develop' into themes-accent
* upstream/develop: (33 commits)
add emoji reactions to changelog
fix emoji reaction classes broken in develop
review changes
Fix password and email update
remove unnecessary anonymous function
Apply suggestion to src/services/api/api.service.js
remove logs/commented code
remove favs count from react button
remove mock data
change emoji reactions to use new format
Added polyfills for EventTarget (needed for Safari) and CustomEvent (needed for IE)
Fix missing TWKN when logged in, but server is set to private mode.
Fix follower request fetching
Add domain mutes to changelog
Implement domain mutes v2
change changelog to reflect actual release history of frontend
Fix #750 , fix error messages and captcha resetting
Optimize Notifications Rendering
update CHANGELOG
Use last seen notif instead of first unseen notif for sinceId
...
Diffstat (limited to 'src/services/api/api.service.js')
| -rw-r--r-- | src/services/api/api.service.js | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index ef0267aa..11aa0675 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -72,7 +72,11 @@ const MASTODON_MUTE_CONVERSATION = id => `/api/v1/statuses/${id}/mute` const MASTODON_UNMUTE_CONVERSATION = id => `/api/v1/statuses/${id}/unmute` const MASTODON_SEARCH_2 = `/api/v2/search` const MASTODON_USER_SEARCH_URL = '/api/v1/accounts/search' +const MASTODON_DOMAIN_BLOCKS_URL = '/api/v1/domain_blocks' const MASTODON_STREAMING = '/api/v1/streaming' +const PLEROMA_EMOJI_REACTIONS_URL = id => `/api/v1/pleroma/statuses/${id}/emoji_reactions_by` +const PLEROMA_EMOJI_REACT_URL = id => `/api/v1/pleroma/statuses/${id}/react_with_emoji` +const PLEROMA_EMOJI_UNREACT_URL = id => `/api/v1/pleroma/statuses/${id}/unreact_with_emoji` const oldfetch = window.fetch @@ -880,6 +884,28 @@ const fetchRebloggedByUsers = ({ id }) => { return promisedRequest({ url: MASTODON_STATUS_REBLOGGEDBY_URL(id) }).then((users) => users.map(parseUser)) } +const fetchEmojiReactions = ({ id }) => { + return promisedRequest({ url: PLEROMA_EMOJI_REACTIONS_URL(id) }) +} + +const reactWithEmoji = ({ id, emoji, credentials }) => { + return promisedRequest({ + url: PLEROMA_EMOJI_REACT_URL(id), + method: 'POST', + credentials, + payload: { emoji } + }).then(parseStatus) +} + +const unreactWithEmoji = ({ id, emoji, credentials }) => { + return promisedRequest({ + url: PLEROMA_EMOJI_UNREACT_URL(id), + method: 'POST', + credentials, + payload: { emoji } + }).then(parseStatus) +} + const reportUser = ({ credentials, userId, statusIds, comment, forward }) => { return promisedRequest({ url: MASTODON_REPORT_USER_URL, @@ -948,6 +974,28 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => { }) } +const fetchDomainMutes = ({ credentials }) => { + return promisedRequest({ url: MASTODON_DOMAIN_BLOCKS_URL, credentials }) +} + +const muteDomain = ({ domain, credentials }) => { + return promisedRequest({ + url: MASTODON_DOMAIN_BLOCKS_URL, + method: 'POST', + payload: { domain }, + credentials + }) +} + +const unmuteDomain = ({ domain, credentials }) => { + return promisedRequest({ + url: MASTODON_DOMAIN_BLOCKS_URL, + method: 'DELETE', + payload: { domain }, + credentials + }) +} + export const getMastodonSocketURI = ({ credentials, stream, args = {} }) => { return Object.entries({ ...(credentials @@ -1107,10 +1155,16 @@ const apiService = { fetchPoll, fetchFavoritedByUsers, fetchRebloggedByUsers, + fetchEmojiReactions, + reactWithEmoji, + unreactWithEmoji, reportUser, updateNotificationSettings, search2, - searchUsers + searchUsers, + fetchDomainMutes, + muteDomain, + unmuteDomain } export default apiService |
