diff options
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/api/api.service.js | 80 | ||||
| -rw-r--r-- | src/services/backend_interactor_service/backend_interactor_service.js | 78 | ||||
| -rw-r--r-- | src/services/color_convert/color_convert.js | 2 | ||||
| -rw-r--r-- | src/services/completion/completion.js | 2 | ||||
| -rw-r--r-- | src/services/file_size_format/file_size_format.js | 2 | ||||
| -rw-r--r-- | src/services/follow_request_fetcher/follow_request_fetcher.service.js | 2 | ||||
| -rw-r--r-- | src/services/new_api/oauth.js | 8 | ||||
| -rw-r--r-- | src/services/new_api/user_search.js | 6 | ||||
| -rw-r--r-- | src/services/new_api/utils.js | 4 | ||||
| -rw-r--r-- | src/services/notification_utils/notification_utils.js | 2 | ||||
| -rw-r--r-- | src/services/notifications_fetcher/notifications_fetcher.service.js | 8 | ||||
| -rw-r--r-- | src/services/status_poster/status_poster.service.js | 2 | ||||
| -rw-r--r-- | src/services/style_setter/style_setter.js | 12 | ||||
| -rw-r--r-- | src/services/timeline_fetcher/timeline_fetcher.service.js | 10 | ||||
| -rw-r--r-- | src/services/user_highlighter/user_highlighter.js | 2 |
15 files changed, 110 insertions, 110 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 030c2f5e..1d713190 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -1,4 +1,9 @@ /* eslint-env browser */ +import { each, map } from 'lodash' +import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' +import 'whatwg-fetch' +import { StatusCodeError } from '../errors/errors' + const LOGIN_URL = '/api/account/verify_credentials.json' const ALL_FOLLOWING_URL = '/api/qvitter/allfollowing' const MENTIONS_URL = '/api/statuses/mentions.json' @@ -46,11 +51,6 @@ const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute` const MASTODON_POST_STATUS_URL = '/api/v1/statuses' const MASTODON_MEDIA_UPLOAD_URL = '/api/v1/media' -import { each, map } from 'lodash' -import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' -import 'whatwg-fetch' -import { StatusCodeError } from '../errors/errors' - const oldfetch = window.fetch let fetch = (url, options) => { @@ -80,7 +80,7 @@ const promisedRequest = (url, options) => { // cropX // cropY // img (base 64 encodend data url) -const updateAvatar = ({credentials, params}) => { +const updateAvatar = ({ credentials, params }) => { let url = AVATAR_UPDATE_URL const form = new FormData() @@ -98,7 +98,7 @@ const updateAvatar = ({credentials, params}) => { }).then((data) => data.json()) } -const updateBg = ({credentials, params}) => { +const updateBg = ({ credentials, params }) => { let url = BG_UPDATE_URL const form = new FormData() @@ -122,7 +122,7 @@ const updateBg = ({credentials, params}) => { // offset_left // offset_top // banner (base 64 encodend data url) -const updateBanner = ({credentials, params}) => { +const updateBanner = ({ credentials, params }) => { let url = BANNER_UPDATE_URL const form = new FormData() @@ -145,7 +145,7 @@ const updateBanner = ({credentials, params}) => { // url // location // description -const updateProfile = ({credentials, params}) => { +const updateProfile = ({ credentials, params }) => { // Always include these fields, because they might be empty or false const fields = ['description', 'locked', 'no_rich_text', 'hide_follows', 'hide_followers', 'show_role'] let url = PROFILE_UPDATE_URL @@ -201,7 +201,7 @@ const authHeaders = (accessToken) => { } } -const externalProfile = ({profileUrl, credentials}) => { +const externalProfile = ({ profileUrl, credentials }) => { let url = `${EXTERNAL_PROFILE_URL}?profileurl=${profileUrl}` return fetch(url, { headers: authHeaders(credentials), @@ -209,7 +209,7 @@ const externalProfile = ({profileUrl, credentials}) => { }).then((data) => data.json()) } -const followUser = ({id, credentials}) => { +const followUser = ({ id, credentials }) => { let url = MASTODON_FOLLOW_URL(id) return fetch(url, { headers: authHeaders(credentials), @@ -217,7 +217,7 @@ const followUser = ({id, credentials}) => { }).then((data) => data.json()) } -const unfollowUser = ({id, credentials}) => { +const unfollowUser = ({ id, credentials }) => { let url = MASTODON_UNFOLLOW_URL(id) return fetch(url, { headers: authHeaders(credentials), @@ -225,21 +225,21 @@ const unfollowUser = ({id, credentials}) => { }).then((data) => data.json()) } -const blockUser = ({id, credentials}) => { +const blockUser = ({ id, credentials }) => { return fetch(MASTODON_BLOCK_USER_URL(id), { headers: authHeaders(credentials), method: 'POST' }).then((data) => data.json()) } -const unblockUser = ({id, credentials}) => { +const unblockUser = ({ id, credentials }) => { return fetch(MASTODON_UNBLOCK_USER_URL(id), { headers: authHeaders(credentials), method: 'POST' }).then((data) => data.json()) } -const approveUser = ({id, credentials}) => { +const approveUser = ({ id, credentials }) => { let url = `${APPROVE_USER_URL}?user_id=${id}` return fetch(url, { headers: authHeaders(credentials), @@ -247,7 +247,7 @@ const approveUser = ({id, credentials}) => { }).then((data) => data.json()) } -const denyUser = ({id, credentials}) => { +const denyUser = ({ id, credentials }) => { let url = `${DENY_USER_URL}?user_id=${id}` return fetch(url, { headers: authHeaders(credentials), @@ -255,13 +255,13 @@ const denyUser = ({id, credentials}) => { }).then((data) => data.json()) } -const fetchUser = ({id, credentials}) => { +const fetchUser = ({ id, credentials }) => { let url = `${MASTODON_USER_URL}/${id}` return promisedRequest(url, { headers: authHeaders(credentials) }) .then((data) => parseUser(data)) } -const fetchUserRelationship = ({id, credentials}) => { +const fetchUserRelationship = ({ id, credentials }) => { let url = `${MASTODON_USER_RELATIONSHIPS_URL}/?id=${id}` return fetch(url, { headers: authHeaders(credentials) }) .then((response) => { @@ -275,7 +275,7 @@ const fetchUserRelationship = ({id, credentials}) => { }) } -const fetchFriends = ({id, maxId, sinceId, limit = 20, credentials}) => { +const fetchFriends = ({ id, maxId, sinceId, limit = 20, credentials }) => { let url = MASTODON_FOLLOWING_URL(id) const args = [ maxId && `max_id=${maxId}`, @@ -289,14 +289,14 @@ const fetchFriends = ({id, maxId, sinceId, limit = 20, credentials}) => { .then((data) => data.map(parseUser)) } -const exportFriends = ({id, credentials}) => { +const exportFriends = ({ id, credentials }) => { let url = MASTODON_FOLLOWING_URL(id) + `?all=true` return fetch(url, { headers: authHeaders(credentials) }) .then((data) => data.json()) .then((data) => data.map(parseUser)) } -const fetchFollowers = ({id, maxId, sinceId, limit = 20, credentials}) => { +const fetchFollowers = ({ id, maxId, sinceId, limit = 20, credentials }) => { let url = MASTODON_FOLLOWERS_URL(id) const args = [ maxId && `max_id=${maxId}`, @@ -310,20 +310,20 @@ const fetchFollowers = ({id, maxId, sinceId, limit = 20, credentials}) => { .then((data) => data.map(parseUser)) } -const fetchAllFollowing = ({username, credentials}) => { +const fetchAllFollowing = ({ username, credentials }) => { const url = `${ALL_FOLLOWING_URL}/${username}.json` return fetch(url, { headers: authHeaders(credentials) }) .then((data) => data.json()) .then((data) => data.map(parseUser)) } -const fetchFollowRequests = ({credentials}) => { +const fetchFollowRequests = ({ credentials }) => { const url = FOLLOW_REQUESTS_URL return fetch(url, { headers: authHeaders(credentials) }) .then((data) => data.json()) } -const fetchConversation = ({id, credentials}) => { +const fetchConversation = ({ id, credentials }) => { let urlContext = MASTODON_STATUS_CONTEXT_URL(id) return fetch(urlContext, { headers: authHeaders(credentials) }) .then((data) => { @@ -333,13 +333,13 @@ const fetchConversation = ({id, credentials}) => { throw new Error('Error fetching timeline', data) }) .then((data) => data.json()) - .then(({ancestors, descendants}) => ({ + .then(({ ancestors, descendants }) => ({ ancestors: ancestors.map(parseStatus), descendants: descendants.map(parseStatus) })) } -const fetchStatus = ({id, credentials}) => { +const fetchStatus = ({ id, credentials }) => { let url = MASTODON_STATUS_URL(id) return fetch(url, { headers: authHeaders(credentials) }) .then((data) => { @@ -352,7 +352,7 @@ const fetchStatus = ({id, credentials}) => { .then((data) => parseStatus(data)) } -const fetchTimeline = ({timeline, credentials, since = false, until = false, userId = false, tag = false, withMuted = false}) => { +const fetchTimeline = ({ timeline, credentials, since = false, until = false, userId = false, tag = false, withMuted = false }) => { const timelineUrls = { public: MASTODON_PUBLIC_TIMELINE, friends: MASTODON_USER_HOME_TIMELINE_URL, @@ -487,7 +487,7 @@ const unretweet = ({ id, credentials }) => { .then((data) => parseStatus(data)) } -const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds = [], inReplyToStatusId, contentType}) => { +const postStatus = ({ credentials, status, spoilerText, visibility, sensitive, mediaIds = [], inReplyToStatusId, contentType }) => { const form = new FormData() form.append('status', status) @@ -527,7 +527,7 @@ const deleteStatus = ({ id, credentials }) => { }) } -const uploadMedia = ({formData, credentials}) => { +const uploadMedia = ({ formData, credentials }) => { return fetch(MASTODON_MEDIA_UPLOAD_URL, { body: formData, method: 'POST', @@ -537,7 +537,7 @@ const uploadMedia = ({formData, credentials}) => { .then((data) => parseAttachment(data)) } -const followImport = ({params, credentials}) => { +const followImport = ({ params, credentials }) => { return fetch(FOLLOW_IMPORT_URL, { body: params, method: 'POST', @@ -546,7 +546,7 @@ const followImport = ({params, credentials}) => { .then((response) => response.ok) } -const deleteAccount = ({credentials, password}) => { +const deleteAccount = ({ credentials, password }) => { const form = new FormData() form.append('password', password) @@ -559,7 +559,7 @@ const deleteAccount = ({credentials, password}) => { .then((response) => response.json()) } -const changePassword = ({credentials, password, newPassword, newPasswordConfirmation}) => { +const changePassword = ({ credentials, password, newPassword, newPasswordConfirmation }) => { const form = new FormData() form.append('password', password) @@ -574,31 +574,31 @@ const changePassword = ({credentials, password, newPassword, newPasswordConfirma .then((response) => response.json()) } -const fetchMutes = ({credentials}) => { +const fetchMutes = ({ credentials }) => { return promisedRequest(MASTODON_USER_MUTES_URL, { headers: authHeaders(credentials) }) .then((users) => users.map(parseUser)) } -const muteUser = ({id, credentials}) => { +const muteUser = ({ id, credentials }) => { return promisedRequest(MASTODON_MUTE_USER_URL(id), { headers: authHeaders(credentials), method: 'POST' }) } -const unmuteUser = ({id, credentials}) => { +const unmuteUser = ({ id, credentials }) => { return promisedRequest(MASTODON_UNMUTE_USER_URL(id), { headers: authHeaders(credentials), method: 'POST' }) } -const fetchBlocks = ({credentials}) => { +const fetchBlocks = ({ credentials }) => { return promisedRequest(MASTODON_USER_BLOCKS_URL, { headers: authHeaders(credentials) }) .then((users) => users.map(parseUser)) } -const fetchOAuthTokens = ({credentials}) => { +const fetchOAuthTokens = ({ credentials }) => { const url = '/api/oauth_tokens.json' return fetch(url, { @@ -611,7 +611,7 @@ const fetchOAuthTokens = ({credentials}) => { }) } -const revokeOAuthToken = ({id, credentials}) => { +const revokeOAuthToken = ({ id, credentials }) => { const url = `/api/oauth_tokens/${id}` return fetch(url, { @@ -620,13 +620,13 @@ const revokeOAuthToken = ({id, credentials}) => { }) } -const suggestions = ({credentials}) => { +const suggestions = ({ credentials }) => { return fetch(SUGGESTIONS_URL, { headers: authHeaders(credentials) }).then((data) => data.json()) } -const markNotificationsAsSeen = ({id, credentials}) => { +const markNotificationsAsSeen = ({ id, credentials }) => { const body = new FormData() body.append('latest_id', id) diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js index 71e78d2f..47ad540b 100644 --- a/src/services/backend_interactor_service/backend_interactor_service.js +++ b/src/services/backend_interactor_service/backend_interactor_service.js @@ -2,86 +2,86 @@ import apiService from '../api/api.service.js' import timelineFetcherService from '../timeline_fetcher/timeline_fetcher.service.js' const backendInteractorService = (credentials) => { - const fetchStatus = ({id}) => { - return apiService.fetchStatus({id, credentials}) + const fetchStatus = ({ id }) => { + return apiService.fetchStatus({ id, credentials }) } - const fetchConversation = ({id}) => { - return apiService.fetchConversation({id, credentials}) + const fetchConversation = ({ id }) => { + return apiService.fetchConversation({ id, credentials }) } - const fetchFriends = ({id, maxId, sinceId, limit}) => { - return apiService.fetchFriends({id, maxId, sinceId, limit, credentials}) + const fetchFriends = ({ id, maxId, sinceId, limit }) => { + return apiService.fetchFriends({ id, maxId, sinceId, limit, credentials }) } - const exportFriends = ({id}) => { - return apiService.exportFriends({id, credentials}) + const exportFriends = ({ id }) => { + return apiService.exportFriends({ id, credentials }) } - const fetchFollowers = ({id, maxId, sinceId, limit}) => { - return apiService.fetchFollowers({id, maxId, sinceId, limit, credentials}) + const fetchFollowers = ({ id, maxId, sinceId, limit }) => { + return apiService.fetchFollowers({ id, maxId, sinceId, limit, credentials }) } - const fetchAllFollowing = ({username}) => { - return apiService.fetchAllFollowing({username, credentials}) + const fetchAllFollowing = ({ username }) => { + return apiService.fetchAllFollowing({ username, credentials }) } - const fetchUser = ({id}) => { - return apiService.fetchUser({id, credentials}) + const fetchUser = ({ id }) => { + return apiService.fetchUser({ id, credentials }) } - const fetchUserRelationship = ({id}) => { - return apiService.fetchUserRelationship({id, credentials}) + const fetchUserRelationship = ({ id }) => { + return apiService.fetchUserRelationship({ id, credentials }) } const followUser = (id) => { - return apiService.followUser({credentials, id}) + return apiService.followUser({ credentials, id }) } const unfollowUser = (id) => { - return apiService.unfollowUser({credentials, id}) + return apiService.unfollowUser({ credentials, id }) } const blockUser = (id) => { - return apiService.blockUser({credentials, id}) + return apiService.blockUser({ credentials, id }) } const unblockUser = (id) => { - return apiService.unblockUser({credentials, id}) + return apiService.unblockUser({ credentials, id }) } const approveUser = (id) => { - return apiService.approveUser({credentials, id}) + return apiService.approveUser({ credentials, id }) } const denyUser = (id) => { - return apiService.denyUser({credentials, id}) + return apiService.denyUser({ credentials, id }) } - const startFetching = ({timeline, store, userId = false, tag}) => { - return timelineFetcherService.startFetching({timeline, store, credentials, userId, tag}) + const startFetching = ({ timeline, store, userId = false, tag }) => { + return timelineFetcherService.startFetching({ timeline, store, credentials, userId, tag }) } - const fetchMutes = () => apiService.fetchMutes({credentials}) - const muteUser = (id) => apiService.muteUser({credentials, id}) - const unmuteUser = (id) => apiService.unmuteUser({credentials, id}) - const fetchBlocks = () => apiService.fetchBlocks({credentials}) - const fetchFollowRequests = () => apiService.fetchFollowRequests({credentials}) - const fetchOAuthTokens = () => apiService.fetchOAuthTokens({credentials}) - const revokeOAuthToken = (id) => apiService.revokeOAuthToken({id, credentials}) + const fetchMutes = () => apiService.fetchMutes({ credentials }) + const muteUser = (id) => apiService.muteUser({ credentials, id }) + const unmuteUser = (id) => apiService.unmuteUser({ credentials, id }) + const fetchBlocks = () => apiService.fetchBlocks({ credentials }) + const fetchFollowRequests = () => apiService.fetchFollowRequests({ credentials }) + const fetchOAuthTokens = () => apiService.fetchOAuthTokens({ credentials }) + const revokeOAuthToken = (id) => apiService.revokeOAuthToken({ id, credentials }) const getCaptcha = () => apiService.getCaptcha() const register = (params) => apiService.register(params) - const updateAvatar = ({params}) => apiService.updateAvatar({credentials, params}) - const updateBg = ({params}) => apiService.updateBg({credentials, params}) - const updateBanner = ({params}) => apiService.updateBanner({credentials, params}) - const updateProfile = ({params}) => apiService.updateProfile({credentials, params}) + const updateAvatar = ({ params }) => apiService.updateAvatar({ credentials, params }) + const updateBg = ({ params }) => apiService.updateBg({ credentials, params }) + const updateBanner = ({ params }) => apiService.updateBanner({ credentials, params }) + const updateProfile = ({ params }) => apiService.updateProfile({ credentials, params }) - const externalProfile = (profileUrl) => apiService.externalProfile({profileUrl, credentials}) - const followImport = ({params}) => apiService.followImport({params, credentials}) + const externalProfile = (profileUrl) => apiService.externalProfile({ profileUrl, credentials }) + const followImport = ({ params }) => apiService.followImport({ params, credentials }) - const deleteAccount = ({password}) => apiService.deleteAccount({credentials, password}) - const changePassword = ({password, newPassword, newPasswordConfirmation}) => apiService.changePassword({credentials, password, newPassword, newPasswordConfirmation}) + const deleteAccount = ({ password }) => apiService.deleteAccount({ credentials, password }) + const changePassword = ({ password, newPassword, newPasswordConfirmation }) => apiService.changePassword({ credentials, password, newPassword, newPasswordConfirmation }) const backendInteractorServiceInstance = { fetchStatus, diff --git a/src/services/color_convert/color_convert.js b/src/services/color_convert/color_convert.js index 7576c518..d1b17c61 100644 --- a/src/services/color_convert/color_convert.js +++ b/src/services/color_convert/color_convert.js @@ -59,7 +59,7 @@ const srgbToLinear = (srgb) => { * @returns {Number} relative luminance */ const relativeLuminance = (srgb) => { - const {r, g, b} = srgbToLinear(srgb) + const { r, g, b } = srgbToLinear(srgb) return 0.2126 * r + 0.7152 * g + 0.0722 * b } diff --git a/src/services/completion/completion.js b/src/services/completion/completion.js index 11c45867..df83d03d 100644 --- a/src/services/completion/completion.js +++ b/src/services/completion/completion.js @@ -8,7 +8,7 @@ export const wordAtPosition = (str, pos) => { const words = splitIntoWords(str) const wordsWithPosition = addPositionToWords(words) - return find(wordsWithPosition, ({start, end}) => start <= pos && end > pos) + return find(wordsWithPosition, ({ start, end }) => start <= pos && end > pos) } export const addPositionToWords = (words) => { diff --git a/src/services/file_size_format/file_size_format.js b/src/services/file_size_format/file_size_format.js index add56ee0..7e6cd4d7 100644 --- a/src/services/file_size_format/file_size_format.js +++ b/src/services/file_size_format/file_size_format.js @@ -9,7 +9,7 @@ const fileSizeFormat = (num) => { exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1) num = (num / Math.pow(1024, exponent)).toFixed(2) * 1 unit = units[exponent] - return {num: num, unit: unit} + return { num: num, unit: unit } } const fileSizeFormatService = { fileSizeFormat diff --git a/src/services/follow_request_fetcher/follow_request_fetcher.service.js b/src/services/follow_request_fetcher/follow_request_fetcher.service.js index 125ff3e1..786740b7 100644 --- a/src/services/follow_request_fetcher/follow_request_fetcher.service.js +++ b/src/services/follow_request_fetcher/follow_request_fetcher.service.js @@ -8,7 +8,7 @@ const fetchAndUpdate = ({ store, credentials }) => { .catch(() => {}) } -const startFetching = ({credentials, store}) => { +const startFetching = ({ credentials, store }) => { fetchAndUpdate({ credentials, store }) const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store }) return setInterval(boundFetchAndUpdate, 10000) diff --git a/src/services/new_api/oauth.js b/src/services/new_api/oauth.js index 9e656507..6dddf37f 100644 --- a/src/services/new_api/oauth.js +++ b/src/services/new_api/oauth.js @@ -1,6 +1,6 @@ -import {reduce} from 'lodash' +import { reduce } from 'lodash' -const getOrCreateApp = ({oauth, instance}) => { +const getOrCreateApp = ({ oauth, instance }) => { const url = `${instance}/api/v1/apps` const form = new window.FormData() @@ -40,7 +40,7 @@ const login = (args) => { }) } -const getTokenWithCredentials = ({app, instance, username, password}) => { +const getTokenWithCredentials = ({ app, instance, username, password }) => { const url = `${instance}/oauth/token` const form = new window.FormData() @@ -56,7 +56,7 @@ const getTokenWithCredentials = ({app, instance, username, password}) => { }).then((data) => data.json()) } -const getToken = ({app, instance, code}) => { +const getToken = ({ app, instance, code }) => { const url = `${instance}/oauth/token` const form = new window.FormData() diff --git a/src/services/new_api/user_search.js b/src/services/new_api/user_search.js index 869afa9c..5977f4e4 100644 --- a/src/services/new_api/user_search.js +++ b/src/services/new_api/user_search.js @@ -1,7 +1,7 @@ import utils from './utils.js' import { parseUser } from '../entity_normalizer/entity_normalizer.service.js' -const search = ({query, store}) => { +const search = ({ query, store }) => { return utils.request({ store, url: '/api/v1/accounts/search', @@ -9,8 +9,8 @@ const search = ({query, store}) => { q: query } }) - .then((data) => data.json()) - .then((data) => data.map(parseUser)) + .then((data) => data.json()) + .then((data) => data.map(parseUser)) } const UserSearch = { search diff --git a/src/services/new_api/utils.js b/src/services/new_api/utils.js index 078f392f..2c50f7be 100644 --- a/src/services/new_api/utils.js +++ b/src/services/new_api/utils.js @@ -7,13 +7,13 @@ const queryParams = (params) => { const headers = (store) => { const accessToken = store.state.oauth.token if (accessToken) { - return {'Authorization': `Bearer ${accessToken}`} + return { 'Authorization': `Bearer ${accessToken}` } } else { return {} } } -const request = ({method = 'GET', url, params, store}) => { +const request = ({ method = 'GET', url, params, store }) => { const instance = store.state.instance.server let fullUrl = `${instance}${url}` diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index cd8f3f9e..85459915 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -33,4 +33,4 @@ export const visibleNotificationsFromStore = store => { } export const unseenNotificationsFromStore = store => - filter(visibleNotificationsFromStore(store), ({seen}) => !seen) + filter(visibleNotificationsFromStore(store), ({ seen }) => !seen) diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js index 3ecdae6a..80a1ee5f 100644 --- a/src/services/notifications_fetcher/notifications_fetcher.service.js +++ b/src/services/notifications_fetcher/notifications_fetcher.service.js @@ -1,12 +1,12 @@ import apiService from '../api/api.service.js' -const update = ({store, notifications, older}) => { +const update = ({ store, notifications, older }) => { store.dispatch('setNotificationsError', { value: false }) store.dispatch('addNewNotifications', { notifications, older }) } -const fetchAndUpdate = ({store, credentials, older = false}) => { +const fetchAndUpdate = ({ store, credentials, older = false }) => { const args = { credentials } const rootState = store.rootState || store.state const timelineData = rootState.statuses.notifications @@ -33,13 +33,13 @@ const fetchAndUpdate = ({store, credentials, older = false}) => { return apiService.fetchTimeline(args) .then((notifications) => { - update({store, notifications, older}) + update({ store, notifications, older }) return notifications }, () => store.dispatch('setNotificationsError', { value: true })) .catch(() => store.dispatch('setNotificationsError', { value: true })) } -const startFetching = ({credentials, store}) => { +const startFetching = ({ credentials, store }) => { fetchAndUpdate({ credentials, store }) const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store }) // Initially there's set flag to silence all desktop notifications so diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js index e70b0f26..908fd0eb 100644 --- a/src/services/status_poster/status_poster.service.js +++ b/src/services/status_poster/status_poster.service.js @@ -4,7 +4,7 @@ import apiService from '../api/api.service.js' const postStatus = ({ store, status, spoilerText, visibility, sensitive, media = [], inReplyToStatusId = undefined, contentType = 'text/plain' }) => { const mediaIds = map(media, 'id') - return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType}) + return apiService.postStatus({ credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType }) .then((data) => { if (!data.error) { store.dispatch('addNewStatuses', { diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index d0b6ccbf..9354c9f4 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -238,12 +238,12 @@ const generateColors = (input) => { }) const htmlColors = Object.entries(colors) - .reduce((acc, [k, v]) => { - if (!v) return acc - acc.solid[k] = rgb2hex(v) - acc.complete[k] = typeof v.a === 'undefined' ? rgb2hex(v) : rgb2rgba(v) - return acc - }, { complete: {}, solid: {} }) + .reduce((acc, [k, v]) => { + if (!v) return acc + acc.solid[k] = rgb2hex(v) + acc.complete[k] = typeof v.a === 'undefined' ? rgb2hex(v) : rgb2rgba(v) + return acc + }, { complete: {}, solid: {} }) return { rules: { colors: Object.entries(htmlColors.complete) diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index 8e954cdf..f72688f8 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -2,7 +2,7 @@ import { camelCase } from 'lodash' import apiService from '../api/api.service.js' -const update = ({store, statuses, timeline, showImmediately, userId}) => { +const update = ({ store, statuses, timeline, showImmediately, userId }) => { const ccTimeline = camelCase(timeline) store.dispatch('setError', { value: false }) @@ -15,7 +15,7 @@ const update = ({store, statuses, timeline, showImmediately, userId}) => { }) } -const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false, until}) => { +const fetchAndUpdate = ({ store, credentials, timeline = 'friends', older = false, showImmediately = false, userId = false, tag = false, until }) => { const args = { timeline, credentials } const rootState = store.rootState || store.state const timelineData = rootState.statuses.timelines[camelCase(timeline)] @@ -40,17 +40,17 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) { store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId }) } - update({store, statuses, timeline, showImmediately, userId}) + update({ store, statuses, timeline, showImmediately, userId }) return statuses }, () => store.dispatch('setError', { value: true })) } -const startFetching = ({timeline = 'friends', credentials, store, userId = false, tag = false}) => { +const startFetching = ({ timeline = 'friends', credentials, store, userId = false, tag = false }) => { const rootState = store.rootState || store.state const timelineData = rootState.statuses.timelines[camelCase(timeline)] const showImmediately = timelineData.visibleStatuses.length === 0 timelineData.userId = userId - fetchAndUpdate({timeline, credentials, store, showImmediately, userId, tag}) + fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, tag }) const boundFetchAndUpdate = () => fetchAndUpdate({ timeline, credentials, store, userId, tag }) return setInterval(boundFetchAndUpdate, 10000) } diff --git a/src/services/user_highlighter/user_highlighter.js b/src/services/user_highlighter/user_highlighter.js index f6ddfb9c..b91c0f78 100644 --- a/src/services/user_highlighter/user_highlighter.js +++ b/src/services/user_highlighter/user_highlighter.js @@ -1,7 +1,7 @@ import { hex2rgb } from '../color_convert/color_convert.js' const highlightStyle = (prefs) => { if (prefs === undefined) return - const {color, type} = prefs + const { color, type } = prefs if (typeof color !== 'string') return const rgb = hex2rgb(color) if (rgb == null) return |
