mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
fix push from wpgancio
This commit is contained in:
parent
ee6adbd778
commit
579fd90c2d
2 changed files with 21 additions and 11 deletions
|
@ -11,14 +11,14 @@ v-container#event.pa-0.pa-sm-2
|
||||||
v-row
|
v-row
|
||||||
v-col.col-12.col-lg-8
|
v-col.col-12.col-lg-8
|
||||||
//- fake image to use u-featured in h-event microformat
|
//- fake image to use u-featured in h-event microformat
|
||||||
img.u-featured(v-show='false' v-if='event.media' :src='event | mediaURL')
|
img.u-featured(v-show='false' v-if='hasMedia' :src='event | mediaURL')
|
||||||
v-img.main_image.mb-3(
|
v-img.main_image.mb-3(
|
||||||
contain
|
contain
|
||||||
:alt='event | mediaURL("alt")'
|
:alt='event | mediaURL("alt")'
|
||||||
:src='event | mediaURL'
|
:src='event | mediaURL'
|
||||||
:lazy-src='event | mediaURL("thumb")'
|
:lazy-src='event | mediaURL("thumb")'
|
||||||
v-if='event.media && event.media.length')
|
v-if='hasMedia')
|
||||||
.p-description.text-body-1.pa-3.grey.darken-4.rounded(v-if='!event.media && event.description' v-html='event.description')
|
.p-description.text-body-1.pa-3.grey.darken-4.rounded(v-if='!hasMedia && event.description' v-html='event.description')
|
||||||
|
|
||||||
v-col.col-12.col-lg-4
|
v-col.col-12.col-lg-4
|
||||||
v-card
|
v-card
|
||||||
|
@ -61,11 +61,11 @@ v-container#event.pa-0.pa-sm-2
|
||||||
:href='`/api/event/${event.slug || event.id}.ics`')
|
:href='`/api/event/${event.slug || event.id}.ics`')
|
||||||
v-icon mdi-calendar-export
|
v-icon mdi-calendar-export
|
||||||
|
|
||||||
.p-description.text-body-1.pa-3.grey.darken-4.rounded(v-if='event.media && event.description' v-html='event.description')
|
.p-description.text-body-1.pa-3.grey.darken-4.rounded(v-if='hasMedia && event.description' v-html='event.description')
|
||||||
|
|
||||||
//- resources from fediverse
|
//- resources from fediverse
|
||||||
#resources.mt-1(v-if='settings.enable_federation')
|
#resources.mt-1(v-if='settings.enable_federation')
|
||||||
//- div.float-right(v-if='!settings.hide_boosts')
|
//- div.float-right(v-if='settings.hide_boosts')
|
||||||
//- small.mr-3 🔖 {{event.likes.length}}
|
//- small.mr-3 🔖 {{event.likes.length}}
|
||||||
//- small ✊ {{event.boost.length}}<br/>
|
//- small ✊ {{event.boost.length}}<br/>
|
||||||
|
|
||||||
|
@ -236,6 +236,9 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['settings']),
|
...mapState(['settings']),
|
||||||
|
hasMedia () {
|
||||||
|
return this.event.media && this.event.media.length
|
||||||
|
},
|
||||||
plainDescription () {
|
plainDescription () {
|
||||||
return htmlToText.fromString(this.event.description.replace('\n', '').slice(0, 1000))
|
return htmlToText.fromString(this.event.description.replace('\n', '').slice(0, 1000))
|
||||||
},
|
},
|
||||||
|
|
|
@ -297,13 +297,15 @@ const eventController = {
|
||||||
url = await helpers.getImageFromURL(body.image_url)
|
url = await helpers.getImageFromURL(body.image_url)
|
||||||
}
|
}
|
||||||
|
|
||||||
const focalpoint = body.image_focalpoint ? body.image_focalpoint.split(',') : [0, 0]
|
const focalpoint = body.image_focalpoint ? body.image_focalpoint.split(',') : ['0', '0']
|
||||||
|
|
||||||
eventDetails.media = [{
|
eventDetails.media = [{
|
||||||
url,
|
url,
|
||||||
name: body.image_name || '',
|
name: body.image_name || '',
|
||||||
focalpoint: [parseFloat(focalpoint[0]), parseFloat(focalpoint[1].toFixed(2))]
|
focalpoint: [parseFloat(focalpoint[0].slice(0, 6)), parseFloat(focalpoint[1].slice(0, 6))]
|
||||||
}]
|
}]
|
||||||
|
} else {
|
||||||
|
eventDetails.media = []
|
||||||
}
|
}
|
||||||
|
|
||||||
const event = await Event.create(eventDetails)
|
const event = await Event.create(eventDetails)
|
||||||
|
@ -374,7 +376,7 @@ const eventController = {
|
||||||
recurrent
|
recurrent
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((req.file || /^https?:\/\//.test(body.image_url)) && !event.recurrent && event.media.length) {
|
if ((req.file || /^https?:\/\//.test(body.image_url)) && !event.recurrent && event.media && event.media.length) {
|
||||||
const old_path = path.resolve(config.upload_path, event.media[0].url)
|
const old_path = path.resolve(config.upload_path, event.media[0].url)
|
||||||
const old_thumb_path = path.resolve(config.upload_path, 'thumb', event.media[0].url)
|
const old_thumb_path = path.resolve(config.upload_path, 'thumb', event.media[0].url)
|
||||||
try {
|
try {
|
||||||
|
@ -395,8 +397,8 @@ const eventController = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (body.image_focalpoint) {
|
if (url && !event.recurrent) {
|
||||||
const focalpoint = body.image_focalpoint ? body.image_focalpoint.split(',') : [0, 0]
|
const focalpoint = body.image_focalpoint ? body.image_focalpoint.split(',') : ['0', '0']
|
||||||
eventDetails.media = [{
|
eventDetails.media = [{
|
||||||
url,
|
url,
|
||||||
name: body.image_name || '',
|
name: body.image_name || '',
|
||||||
|
@ -452,7 +454,12 @@ const eventController = {
|
||||||
}
|
}
|
||||||
const notifier = require('../../notifier')
|
const notifier = require('../../notifier')
|
||||||
await notifier.notifyEvent('Delete', event.id)
|
await notifier.notifyEvent('Delete', event.id)
|
||||||
log.debug('[EVENT REMOVED]', event.title)
|
|
||||||
|
// unassociate child events
|
||||||
|
if (event.recurrent) {
|
||||||
|
await Event.update({ parentId: null }, { where: { parentId: event.id } })
|
||||||
|
}
|
||||||
|
log.debug('[EVENT REMOVED] ' + event.title)
|
||||||
await event.destroy()
|
await event.destroy()
|
||||||
res.sendStatus(200)
|
res.sendStatus(200)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue