-
- {{ user.name }}
+
+ {{ user.name }}
@@ -53,7 +53,7 @@
vertical-align: middle;
}
- > span {
+ &-value {
display: inline-block;
max-width: 100%;
overflow: hidden;
From d70928792d34b6da6ef3af3db2d9da7a269c5435 Mon Sep 17 00:00:00 2001
From: dave
Date: Fri, 22 Mar 2019 13:15:11 -0400
Subject: [PATCH 25/34] #448 - fix timeline fetch error when status text is
null
---
src/services/entity_normalizer/entity_normalizer.service.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index e831963a..57a6adf9 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -293,5 +293,5 @@ export const parseNotification = (data) => {
const isNsfw = (status) => {
const nsfwRegex = /#nsfw/i
- return (status.tags || []).includes('nsfw') || !!status.text.match(nsfwRegex)
+ return (status.tags || []).includes('nsfw') || !!(status.text || '').match(nsfwRegex)
}
From 31d09931c8a2be1484a5023f0663e16549bc2e7d Mon Sep 17 00:00:00 2001
From: dave
Date: Fri, 22 Mar 2019 14:04:22 -0400
Subject: [PATCH 26/34] #450 - dispatch login after saved state is loaded
---
src/lib/persisted_state.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js
index 7ab89c12..720ff706 100644
--- a/src/lib/persisted_state.js
+++ b/src/lib/persisted_state.js
@@ -60,6 +60,9 @@ export default function createPersistedState ({
merge({}, store.state, savedState)
)
}
+ if (store.state.oauth.token) {
+ store.dispatch('loginUser', store.state.oauth.token)
+ }
loaded = true
} catch (e) {
console.log("Couldn't load state")
From 05634d222d87845f8eb3d022f55e92c9c996ea4a Mon Sep 17 00:00:00 2001
From: nik
Date: Sat, 23 Mar 2019 22:26:31 -0500
Subject: [PATCH 27/34] remove border radius of suggested emojis
---
src/components/post_status_form/post_status_form.vue | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 3d1df91b..c18b2afd 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -287,8 +287,6 @@
img {
width: 24px;
height: 24px;
- border-radius: $fallback--avatarRadius;
- border-radius: var(--avatarRadius, $fallback--avatarRadius);
object-fit: contain;
}
From b241539d4df0c3a277723cb308c39a5e9665b7b1 Mon Sep 17 00:00:00 2001
From: nik
Date: Sat, 23 Mar 2019 22:45:24 -0500
Subject: [PATCH 28/34] prevent text pasting if image is pasted
---
src/components/post_status_form/post_status_form.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 1f0df35a..c5f30ca6 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -296,6 +296,8 @@ const PostStatusForm = {
},
paste (e) {
if (e.clipboardData.files.length > 0) {
+ // prevent pasting of file as text
+ e.preventDefault()
// Strangely, files property gets emptied after event propagation
// Trying to wrap it in array doesn't work. Plus I doubt it's possible
// to hold more than one file in clipboard.
From f03747e84124ea45efd16a2f386d7f14996f736a Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sun, 24 Mar 2019 13:04:47 -0400
Subject: [PATCH 29/34] Revert changes
---
src/modules/users.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/modules/users.js b/src/modules/users.js
index 9b7b29e7..f83ae298 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -365,6 +365,9 @@ const users = {
// Start getting fresh posts.
store.dispatch('startFetching', { timeline: 'friends' })
+ // Get user mutes
+ store.dispatch('fetchMutes')
+
// Fetch our friends
store.rootState.api.backendInteractor.fetchFriends({ id: user.id })
.then((friends) => commit('addNewUsers', friends))
From 9802344603dc6a6341cc4bdb4828e0baddc1b03b Mon Sep 17 00:00:00 2001
From: taehoon
Date: Fri, 15 Mar 2019 15:02:00 -0400
Subject: [PATCH 30/34] Switch to mastoapi for posting status and uploading
media
---
src/components/media_upload/media_upload.js | 2 +-
.../post_status_form/post_status_form.js | 2 +-
.../post_status_form/post_status_form.vue | 8 +++----
src/services/api/api.service.js | 23 ++++++++++---------
.../status_poster/status_poster.service.js | 22 ++----------------
5 files changed, 20 insertions(+), 37 deletions(-)
diff --git a/src/components/media_upload/media_upload.js b/src/components/media_upload/media_upload.js
index 1c874faa..e4b3d460 100644
--- a/src/components/media_upload/media_upload.js
+++ b/src/components/media_upload/media_upload.js
@@ -20,7 +20,7 @@ const mediaUpload = {
return
}
const formData = new FormData()
- formData.append('media', file)
+ formData.append('file', file)
self.$emit('uploading')
self.uploading = true
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 1f0df35a..142d9d90 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -292,7 +292,7 @@ const PostStatusForm = {
this.submitDisabled = false
},
type (fileInfo) {
- return fileTypeService.fileType(fileInfo.mimetype)
+ return fileTypeService.fileType(fileInfo.pleroma.mime_type)
},
paste (e) {
if (e.clipboardData.files.length > 0) {
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
index 3d1df91b..166691c2 100644
--- a/src/components/post_status_form/post_status_form.vue
+++ b/src/components/post_status_form/post_status_form.vue
@@ -84,10 +84,10 @@
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 8586f993..a15cecaf 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -9,10 +9,8 @@ const FAVORITE_URL = '/api/favorites/create'
const UNFAVORITE_URL = '/api/favorites/destroy'
const RETWEET_URL = '/api/statuses/retweet'
const UNRETWEET_URL = '/api/statuses/unretweet'
-const STATUS_UPDATE_URL = '/api/statuses/update.json'
const STATUS_DELETE_URL = '/api/statuses/destroy'
const STATUS_URL = '/api/statuses/show'
-const MEDIA_UPLOAD_URL = '/api/statusnet/media/upload'
const CONVERSATION_URL = '/api/statusnet/conversation'
const MENTIONS_URL = '/api/statuses/mentions.json'
const DM_TIMELINE_URL = '/api/statuses/dm_timeline.json'
@@ -46,6 +44,8 @@ const MASTODON_BLOCK_USER_URL = id => `/api/v1/accounts/${id}/block`
const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
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 } from '../entity_normalizer/entity_normalizer.service.js'
@@ -439,23 +439,25 @@ const unretweet = ({ id, credentials }) => {
})
}
-const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType, noAttachmentLinks}) => {
- const idsText = mediaIds.join(',')
+const postStatus = ({credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType}) => {
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)
if (contentType) form.append('content_type', contentType)
- form.append('media_ids', idsText)
+ if (mediaIds) {
+ mediaIds.forEach(val => {
+ form.append('media_ids[]', val)
+ })
+ }
if (inReplyToStatusId) {
- form.append('in_reply_to_status_id', inReplyToStatusId)
+ form.append('in_reply_to_id', inReplyToStatusId)
}
- return fetch(STATUS_UPDATE_URL, {
+ return fetch(MASTODON_POST_STATUS_URL, {
body: form,
method: 'POST',
headers: authHeaders(credentials)
@@ -480,13 +482,12 @@ const deleteStatus = ({ id, credentials }) => {
}
const uploadMedia = ({formData, credentials}) => {
- return fetch(MEDIA_UPLOAD_URL, {
+ return fetch(MASTODON_MEDIA_UPLOAD_URL, {
body: formData,
method: 'POST',
headers: authHeaders(credentials)
})
- .then((response) => response.text())
- .then((text) => (new DOMParser()).parseFromString(text, 'application/xml'))
+ .then((response) => response.json())
}
const followImport = ({params, credentials}) => {
diff --git a/src/services/status_poster/status_poster.service.js b/src/services/status_poster/status_poster.service.js
index f1932bb6..e70b0f26 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, noAttachmentLinks: store.state.instance.noAttachmentLinks})
+ return apiService.postStatus({credentials: store.state.users.currentUser.credentials, status, spoilerText, visibility, sensitive, mediaIds, inReplyToStatusId, contentType})
.then((data) => {
if (!data.error) {
store.dispatch('addNewStatuses', {
@@ -26,25 +26,7 @@ const postStatus = ({ store, status, spoilerText, visibility, sensitive, media =
const uploadMedia = ({ store, formData }) => {
const credentials = store.state.users.currentUser.credentials
- return apiService.uploadMedia({ credentials, formData }).then((xml) => {
- // Firefox and Chrome treat method differently...
- let link = xml.getElementsByTagName('link')
-
- if (link.length === 0) {
- link = xml.getElementsByTagName('atom:link')
- }
-
- link = link[0]
-
- const mediaData = {
- id: xml.getElementsByTagName('media_id')[0].textContent,
- url: xml.getElementsByTagName('media_url')[0].textContent,
- image: link.getAttribute('href'),
- mimetype: link.getAttribute('type')
- }
-
- return mediaData
- })
+ return apiService.uploadMedia({ credentials, formData })
}
const statusPosterService = {
From 966add1b2996b87019051d8c924edb4af0bafb80 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sun, 17 Mar 2019 23:22:54 -0400
Subject: [PATCH 31/34] Set default parameter
---
src/services/api/api.service.js | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index a15cecaf..079462f7 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -48,7 +48,7 @@ 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 } from '../entity_normalizer/entity_normalizer.service.js'
+import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js'
import 'whatwg-fetch'
import { StatusCodeError } from '../errors/errors'
@@ -439,7 +439,7 @@ const unretweet = ({ id, credentials }) => {
})
}
-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)
@@ -448,11 +448,9 @@ const postStatus = ({credentials, status, spoilerText, visibility, sensitive, me
if (visibility) form.append('visibility', visibility)
if (sensitive) form.append('sensitive', sensitive)
if (contentType) form.append('content_type', contentType)
- if (mediaIds) {
- mediaIds.forEach(val => {
- form.append('media_ids[]', val)
- })
- }
+ mediaIds.forEach(val => {
+ form.append('media_ids[]', val)
+ })
if (inReplyToStatusId) {
form.append('in_reply_to_id', inReplyToStatusId)
}
@@ -487,7 +485,8 @@ const uploadMedia = ({formData, credentials}) => {
method: 'POST',
headers: authHeaders(credentials)
})
- .then((response) => response.json())
+ .then((data) => data.json())
+ .then((data) => parseAttachment(data))
}
const followImport = ({params, credentials}) => {
From 909c315a44a5c6272f000325e5e9c8b33e75f873 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sun, 17 Mar 2019 23:23:59 -0400
Subject: [PATCH 32/34] Get correct mimetype through entity_normalizer
---
src/components/post_status_form/post_status_form.js | 2 +-
src/services/entity_normalizer/entity_normalizer.service.js | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js
index 142d9d90..1f0df35a 100644
--- a/src/components/post_status_form/post_status_form.js
+++ b/src/components/post_status_form/post_status_form.js
@@ -292,7 +292,7 @@ const PostStatusForm = {
this.submitDisabled = false
},
type (fileInfo) {
- return fileTypeService.fileType(fileInfo.pleroma.mime_type)
+ return fileTypeService.fileType(fileInfo.mimetype)
},
paste (e) {
if (e.clipboardData.files.length > 0) {
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 57a6adf9..0d653207 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -128,13 +128,12 @@ export const parseUser = (data) => {
return output
}
-const parseAttachment = (data) => {
+export const parseAttachment = (data) => {
const output = {}
const masto = !data.hasOwnProperty('oembed')
if (masto) {
- // Not exactly same...
- output.mimetype = data.type
+ output.mimetype = data.pleroma.mime_type
output.meta = data.meta // not present in BE yet
} else {
output.mimetype = data.mimetype
From 6fdbc182ca722dbb12d92e4bf26e841ccda8303d Mon Sep 17 00:00:00 2001
From: taehoon
Date: Sun, 17 Mar 2019 23:42:07 -0400
Subject: [PATCH 33/34] Add fallback for attachments uploaded via the other
platforms
---
src/services/entity_normalizer/entity_normalizer.service.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 0d653207..35c28ec0 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -133,7 +133,8 @@ export const parseAttachment = (data) => {
const masto = !data.hasOwnProperty('oembed')
if (masto) {
- output.mimetype = data.pleroma.mime_type
+ // Not exactly same...
+ output.mimetype = data.pleroma ? data.pleroma.mime_type : data.type
output.meta = data.meta // not present in BE yet
} else {
output.mimetype = data.mimetype
From 932652e335d19cc6f97fae1a9b12501ffdb9ec0b Mon Sep 17 00:00:00 2001
From: taehoon
Date: Mon, 25 Mar 2019 12:19:33 -0400
Subject: [PATCH 34/34] Update attachment normalizer
---
src/services/entity_normalizer/entity_normalizer.service.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 35c28ec0..5cac3463 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -136,6 +136,7 @@ export const parseAttachment = (data) => {
// Not exactly same...
output.mimetype = data.pleroma ? data.pleroma.mime_type : data.type
output.meta = data.meta // not present in BE yet
+ output.id = data.id
} else {
output.mimetype = data.mimetype
// output.meta = ??? missing