Merge pull request 'Various small fixes' (#459) from Oneric/akkoma-fe:varfixes-20251018 into develop
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Reviewed-on: #459
This commit is contained in:
Oneric 2025-10-24 18:56:42 +00:00
commit b13ecbcf6f
6 changed files with 33 additions and 29 deletions

View file

@ -16,7 +16,7 @@
.attachment-wrapper {
flex: 1 1 auto;
min-height: 200px;
height: 200px;
position: relative;
overflow: hidden;
align-content: center;
@ -129,6 +129,8 @@
max-height: 200px;
overflow-y: auto;
scrollbar-color: var(--border) #0000;
width: 100%;
box-sizing: border-box;
.status-popover & {
text-overflow: ellipsis;

View file

@ -91,7 +91,7 @@ const ExtraButtons = {
.catch(err => this.$emit('onError', err.error.error))
},
copyLink () {
navigator.clipboard.writeText(this.statusLink)
navigator.clipboard.writeText(this.status.canonical_id)
.then(() => this.$emit('onSuccess'))
.catch(err => this.$emit('onError', err.error.error))
},
@ -187,13 +187,6 @@ const ExtraButtons = {
noTranslationTargetSet () {
return this.$store.getters.mergedConfig.translationLanguage === undefined
},
statusLink () {
if (this.status.is_local) {
return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}`
} else {
return this.status.external_url
}
},
shouldConfirmDelete () {
return this.$store.getters.mergedConfig.modalOnDelete
},

View file

@ -42,8 +42,14 @@ const mediaUpload = {
.then((fileData) => {
self.$emit('uploaded', fileData)
self.decreaseUploadCount()
}, (error) => {
self.$emit('upload-failed', 'default')
}, (error) => {
var msg = typeof error === "string" ? error : error.message
if (msg) {
self.$emit('upload-failed', 'message', [msg])
} else {
self.$emit('upload-failed', 'default')
}
console.warn(`Failed to upload media: ${error}`)
self.decreaseUploadCount()
})
},

View file

@ -101,8 +101,4 @@
color: $fallback--cBlue;
color: var(--cBlue, $fallback--cBlue);
}
.attachment-wrapper {
min-height: unset;
}
}

View file

@ -124,6 +124,21 @@ let fetch = (url, options) => {
return oldfetch(fullUrl, options)
}
// TODO: integrate directly into above adapting callers as needed
const getJsonIfSuccess = (response, url, options) => {
return new Promise((resolve, reject) => response.json()
.then((json) => {
if (!response.ok) {
return reject(new StatusCodeError(response.status, json, { url, options }, response))
}
return resolve(json)
})
.catch((error) => {
return reject(new StatusCodeError(response.status, error, { url, options }, response))
})
)
}
const promisedRequest = ({ method, url, params, payload, credentials, headers = {} }) => {
const options = {
method,
@ -148,19 +163,7 @@ const promisedRequest = ({ method, url, params, payload, credentials, headers =
}
}
return fetch(url, options)
.then((response) => {
return new Promise((resolve, reject) => response.json()
.then((json) => {
if (!response.ok) {
return reject(new StatusCodeError(response.status, json, { url, options }, response))
}
return resolve(json)
})
.catch((error) => {
return reject(new StatusCodeError(response.status, error, { url, options }, response))
})
)
})
.then((response) => getJsonIfSuccess(response, url, options))
}
const updateNotificationSettings = ({ credentials, settings }) => {
@ -988,7 +991,7 @@ const uploadMedia = ({ formData, credentials }) => {
method: 'POST',
headers: authHeaders(credentials)
})
.then((data) => data.json())
.then((response) => getJsonIfSuccess(response, MASTODON_MEDIA_UPLOAD_URL, {}))
.then((data) => parseAttachment(data))
}

View file

@ -316,7 +316,10 @@ export const parseStatus = (data) => {
}
output.summary_raw_html = escape(data.spoiler_text)
// display URL
output.external_url = data.url
// ActivityPub ID
output.canonical_id = data.uri
output.poll = data.poll
if (output.poll) {
output.poll.options = (output.poll.options || []).map(field => ({
@ -363,6 +366,7 @@ export const parseStatus = (data) => {
output.summary = data.summary
output.summary_html = data.summary_html
output.external_url = data.external_url
output.canonical_id = data.external_url
output.is_local = data.is_local
}