Normalizing: Natively use attachments.
This commit is contained in:
parent
bbb91d8ae3
commit
20ada31498
6 changed files with 7 additions and 23 deletions
|
@ -20,7 +20,7 @@ const Attachment = {
|
|||
hideNsfwLocal: this.$store.getters.mergedConfig.hideNsfw,
|
||||
preloadImage: this.$store.getters.mergedConfig.preloadImage,
|
||||
loading: false,
|
||||
img: fileTypeService.fileType(this.attachment.mimetype) === 'image' && document.createElement('img'),
|
||||
img: fileTypeService.fileType(this.attachment.pleroma.mime_type) === 'image' && document.createElement('img'),
|
||||
modalOpen: false,
|
||||
showHidden: false
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ const Attachment = {
|
|||
return this.$store.state.instance.mediaProxyAvailable ? '' : 'no-referrer'
|
||||
},
|
||||
type () {
|
||||
return fileTypeService.fileType(this.attachment.mimetype)
|
||||
return fileTypeService.fileType(this.attachment.pleroma.mime_type)
|
||||
},
|
||||
hidden () {
|
||||
return this.nsfw && this.hideNsfwLocal && !this.showHidden
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
>
|
||||
<StillImage
|
||||
:referrerpolicy="referrerpolicy"
|
||||
:mimetype="attachment.mimetype"
|
||||
:mimetype="attachment.pleroma.mime_type"
|
||||
:src="attachment.large_thumb_url || attachment.url"
|
||||
:image-load-handler="onImageLoad"
|
||||
/>
|
||||
|
|
|
@ -21,7 +21,7 @@ const mediaViewer = {
|
|||
actions: {
|
||||
setMedia ({ commit }, attachments) {
|
||||
const media = attachments.filter(attachment => {
|
||||
const type = fileTypeService.fileType(attachment.mimetype)
|
||||
const type = fileTypeService.fileType(attachment.pleroma.mime_type)
|
||||
return type === 'image' || type === 'video'
|
||||
})
|
||||
commit('setMedia', media)
|
||||
|
|
|
@ -192,23 +192,7 @@ export const parseUser = (data) => {
|
|||
}
|
||||
|
||||
export const parseAttachment = (data) => {
|
||||
const output = {}
|
||||
const masto = !data.hasOwnProperty('oembed')
|
||||
|
||||
if (masto) {
|
||||
// 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
|
||||
}
|
||||
|
||||
output.url = data.url
|
||||
output.description = data.description
|
||||
|
||||
return output
|
||||
return data
|
||||
}
|
||||
export const addEmojis = (string, emojis) => {
|
||||
const matchOperatorsRegex = /[|\\{}()[\]^$+*?.-]/g
|
||||
|
|
|
@ -22,7 +22,7 @@ const fileType = mimetype => {
|
|||
}
|
||||
|
||||
const fileMatchesSomeType = (types, file) =>
|
||||
types.some(type => fileType(file.mimetype) === type)
|
||||
types.some(type => fileType(file.pleroma.mime_type) === type)
|
||||
|
||||
const fileTypeService = {
|
||||
fileType,
|
||||
|
|
|
@ -81,7 +81,7 @@ export const prepareNotificationObject = (notification, i18n) => {
|
|||
|
||||
// Shows first attached non-nsfw image, if any. Should add configuration for this somehow...
|
||||
if (status && status.attachments && status.attachments.length > 0 && !status.nsfw &&
|
||||
status.attachments[0].mimetype.startsWith('image/')) {
|
||||
status.attachments[0].pleroma.mime_type.startsWith('image/')) {
|
||||
notifObj.image = status.attachments[0].url
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue