aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/api/api.service.js3
-rw-r--r--src/services/new_api/oauth.js4
-rw-r--r--src/services/push/push.js14
-rw-r--r--src/services/status_poster/status_poster.service.js2
-rw-r--r--src/services/user_profile_link_generator/user_profile_link_generator.js9
5 files changed, 18 insertions, 14 deletions
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 182f9126..4ee95bd1 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -370,12 +370,13 @@ const unretweet = ({ id, credentials }) => {
})
}
-const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType}) => {
+const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks}) => {
const idsText = mediaIds.join(',')
const form = new FormData()
form.append('status', status)
form.append('source', 'Pleroma FE')
+ if (noAttachmentLinks) form.append('no_attachment_links', noAttachmentLinks)
if (spoilerText) form.append('spoiler_text', spoilerText)
if (visibility) form.append('visibility', visibility)
if (sensitive) form.append('sensitive', sensitive)
diff --git a/src/services/new_api/oauth.js b/src/services/new_api/oauth.js
index 97dec94f..9e656507 100644
--- a/src/services/new_api/oauth.js
+++ b/src/services/new_api/oauth.js
@@ -5,7 +5,7 @@ const getOrCreateApp = ({oauth, instance}) => {
const form = new window.FormData()
form.append('client_name', `PleromaFE_${Math.random()}`)
- form.append('redirect_uris', `${window.location.origin}/~/oauth-callback`)
+ form.append('redirect_uris', `${window.location.origin}/oauth-callback`)
form.append('scopes', 'read write follow')
return window.fetch(url, {
@@ -64,7 +64,7 @@ const getToken = ({app, instance, code}) => {
form.append('client_secret', app.client_secret)
form.append('grant_type', 'authorization_code')
form.append('code', code)
- form.append('redirect_uri', `${window.location.origin}/~/oauth-callback`)
+ form.append('redirect_uri', `${window.location.origin}/oauth-callback`)
return window.fetch(url, {
method: 'POST',
diff --git a/src/services/push/push.js b/src/services/push/push.js
index bf0c9680..1b189a29 100644
--- a/src/services/push/push.js
+++ b/src/services/push/push.js
@@ -51,7 +51,7 @@ function deleteSubscriptionFromBackEnd (token) {
})
}
-function sendSubscriptionToBackEnd (subscription, token) {
+function sendSubscriptionToBackEnd (subscription, token, notificationVisibility) {
return window.fetch('/api/v1/push/subscription/', {
method: 'POST',
headers: {
@@ -62,10 +62,10 @@ function sendSubscriptionToBackEnd (subscription, token) {
subscription,
data: {
alerts: {
- follow: true,
- favourite: true,
- mention: true,
- reblog: true
+ follow: notificationVisibility.follows,
+ favourite: notificationVisibility.likes,
+ mention: notificationVisibility.mentions,
+ reblog: notificationVisibility.repeats
}
}
})
@@ -78,11 +78,11 @@ function sendSubscriptionToBackEnd (subscription, token) {
})
}
-export function registerPushNotifications (isEnabled, vapidPublicKey, token) {
+export function registerPushNotifications (isEnabled, vapidPublicKey, token, notificationVisibility) {
if (isPushSupported()) {
getOrCreateServiceWorker()
.then((registration) => subscribePush(registration, isEnabled, vapidPublicKey))
- .then((subscription) => sendSubscriptionToBackEnd(subscription, token))
+ .then((subscription) => sendSubscriptionToBackEnd(subscription, token, notificationVisibility))
.catch((e) => console.warn(`Failed to setup Web Push Notifications: ${e.message}`))
}
}
diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js
index 7f8b0fc0..1e20d336 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, noAttachmentLinks: store.state.instance.noAttachmentLinks})
.then((data) => data.json())
.then((data) => {
if (!data.error) {
diff --git a/src/services/user_profile_link_generator/user_profile_link_generator.js b/src/services/user_profile_link_generator/user_profile_link_generator.js
index 3367eb8a..bca2c9cd 100644
--- a/src/services/user_profile_link_generator/user_profile_link_generator.js
+++ b/src/services/user_profile_link_generator/user_profile_link_generator.js
@@ -1,7 +1,10 @@
-const generateProfileLink = (id, screenName) => {
+import { includes } from 'lodash'
+
+const generateProfileLink = (id, screenName, restrictedNicknames) => {
+ const complicated = (isExternal(screenName) || includes(restrictedNicknames, screenName))
return {
- name: (isExternal(screenName) ? 'external-user-profile' : 'user-profile'),
- params: (isExternal(screenName) ? { id } : { name: screenName })
+ name: (complicated ? 'external-user-profile' : 'user-profile'),
+ params: (complicated ? { id } : { name: screenName })
}
}