keep going with recurrent event
This commit is contained in:
@@ -43,7 +43,7 @@ export default {
|
|||||||
...mapState(['tags', 'filters']),
|
...mapState(['tags', 'filters']),
|
||||||
attributes () {
|
attributes () {
|
||||||
const colors = ['indigo', 'orange', 'yellow', 'green', 'teal', 'blue', 'red', 'purple', 'pink', 'grey']
|
const colors = ['indigo', 'orange', 'yellow', 'green', 'teal', 'blue', 'red', 'purple', 'pink', 'grey']
|
||||||
const tags = take(this.tags, 10).map(t=>t.tag)
|
const tags = take(this.tags, 10)//.map(t=>t.tag)
|
||||||
// const tags = [this.tags[0].tag, this.tags[1].tag, this.tags[2].tag, this.tags[3].tag, this.tags[4].tag, this.tags[5].tag ]
|
// const tags = [this.tags[0].tag, this.tags[1].tag, this.tags[2].tag, this.tags[3].tag, this.tags[4].tag, this.tags[5].tag ]
|
||||||
let attributes = []
|
let attributes = []
|
||||||
attributes.push ({ key: 'today', dates: new Date(), highlight: { color: 'green' }})
|
attributes.push ({ key: 'today', dates: new Date(), highlight: { color: 'green' }})
|
||||||
@@ -51,7 +51,7 @@ export default {
|
|||||||
const that = this
|
const that = this
|
||||||
function getColor(event) {
|
function getColor(event) {
|
||||||
const color = { class: event.past && !that.filters.show_past_events ? 'past-event vc-rounded-full' : 'vc-rounded-full', color: 'blue' }
|
const color = { class: event.past && !that.filters.show_past_events ? 'past-event vc-rounded-full' : 'vc-rounded-full', color: 'blue' }
|
||||||
const tag = get(event, 'tags[0].tag')
|
const tag = get(event, 'tags[0]')
|
||||||
if (!tag) return color
|
if (!tag) return color
|
||||||
const idx = tags.indexOf(tag)
|
const idx = tags.indexOf(tag)
|
||||||
if (idx<0) return color
|
if (idx<0) return color
|
||||||
@@ -64,12 +64,12 @@ export default {
|
|||||||
.map(e => ({
|
.map(e => ({
|
||||||
key: e.id,
|
key: e.id,
|
||||||
dot: getColor(e),
|
dot: getColor(e),
|
||||||
dates: new Date(e.start_datetime*1000)})))
|
dates: new Date(e.start_datetime)})))
|
||||||
|
|
||||||
attributes = attributes.concat(this.filteredEventsWithPast
|
attributes = attributes.concat(this.filteredEventsWithPast
|
||||||
.filter(e => e.multidate)
|
.filter(e => e.multidate)
|
||||||
.map( e => ({ key: e.id, highlight: getColor(e), dates: {
|
.map( e => ({ key: e.id, highlight: getColor(e), dates: {
|
||||||
start: new Date(e.start_datetime*1000), end: new Date(e.end_datetime*1000) }})))
|
start: new Date(e.start_datetime), end: new Date(e.end_datetime) }})))
|
||||||
|
|
||||||
return attributes
|
return attributes
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
//- span {{event.comments.length}} {{$t('common.comments')}}
|
//- span {{event.comments.length}} {{$t('common.comments')}}
|
||||||
|
|
||||||
ul.tags(v-if='showTags && event.tags')
|
ul.tags(v-if='showTags && event.tags')
|
||||||
li(v-for='tag in event.tags' :key='tag.tag') {{tag.tag}}
|
li(v-for='tag in event.tags' :key='tag') {{tag}}
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from 'vuex'
|
import { mapState, mapActions } from 'vuex'
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
a(:id='event.newDay' v-if='event.newDay')
|
a(:id='event.newDay' v-if='event.newDay')
|
||||||
.d-block.d-sm-none
|
.d-block.d-sm-none
|
||||||
el-divider {{event.start_datetime|day}}
|
el-divider {{event.start_datetime|day}}
|
||||||
|
//- p(style='color: white;') {{event}}
|
||||||
Event(
|
Event(
|
||||||
:id='event.start_datetime'
|
:id='event.start_datetime'
|
||||||
:key='event.id'
|
:key='event.id'
|
||||||
|
|||||||
@@ -185,16 +185,26 @@ export default {
|
|||||||
error({ statusCode: 404, message: 'Event not found!'})
|
error({ statusCode: 404, message: 'Event not found!'})
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.event.place.name = event.place.name
|
data.event.place.name = event.place.name
|
||||||
data.event.place.address = event.place.address || ''
|
data.event.place.address = event.place.address || ''
|
||||||
data.event.multidate = event.multidate
|
data.event.multidate = event.multidate
|
||||||
if (event.multidate) {
|
if (event.multidate) {
|
||||||
data.date = { start: new Date(event.start_datetime*1000), end: new Date(event.end_datetime*1000) }
|
data.date = { start: new Date(event.start_datetime), end: new Date(event.end_datetime) }
|
||||||
|
data.event.type = 'multidate'
|
||||||
} else {
|
} else {
|
||||||
data.date = new Date(event.start_datetime*1000)
|
data.event.type = 'normal'
|
||||||
|
data.date = new Date(event.start_datetime)
|
||||||
}
|
}
|
||||||
data.time.start = moment(event.start_datetime*1000).format('HH:mm')
|
|
||||||
data.time.end = moment(event.end_datetime*1000).format('HH:mm')
|
if (event.recurrent) {
|
||||||
|
data.event.type = 'recurrent'
|
||||||
|
const recurrent = JSON.parse(event.recurrent)
|
||||||
|
data.event.rec_frequency = recurrent.frequency
|
||||||
|
}
|
||||||
|
|
||||||
|
data.time.start = moment(event.start_datetime).format('HH:mm')
|
||||||
|
data.time.end = moment(event.end_datetime).format('HH:mm')
|
||||||
data.event.title = event.title
|
data.event.title = event.title
|
||||||
data.event.description = event.description.replace(/(<([^>]+)>)/ig, '')
|
data.event.description = event.description.replace(/(<([^>]+)>)/ig, '')
|
||||||
data.event.id = event.id
|
data.event.id = event.id
|
||||||
@@ -239,17 +249,17 @@ export default {
|
|||||||
const date_end = moment(this.date.end)
|
const date_end = moment(this.date.end)
|
||||||
return this.events.filter(e =>
|
return this.events.filter(e =>
|
||||||
!e.multidate ?
|
!e.multidate ?
|
||||||
date_start.isSame(e.start_datetime*1000, 'day') ||
|
date_start.isSame(e.start_datetime, 'day') ||
|
||||||
date_start.isBefore(e.start_datime*1000) && date_end.isAfter(e.start_datetime*1000) :
|
date_start.isBefore(e.start_datime) && date_end.isAfter(e.start_datetime) :
|
||||||
date_start.isSame(e.start_datetime*1000, 'day') || date_start.isSame(e.end_datetime*1000) ||
|
date_start.isSame(e.start_datetime, 'day') || date_start.isSame(e.end_datetime) ||
|
||||||
date_start.isAfter(e.start_datetime*1000) && date_start.isBefore(e.end_datetime*1000))
|
date_start.isAfter(e.start_datetime) && date_start.isBefore(e.end_datetime))
|
||||||
} else {
|
} else {
|
||||||
const date = moment(this.date)
|
const date = moment(this.date)
|
||||||
return this.events.filter(e =>
|
return this.events.filter(e =>
|
||||||
!e.multidate ?
|
!e.multidate ?
|
||||||
date.isSame(moment(e.start_datetime*1000), 'day') :
|
date.isSame(moment(e.start_datetime), 'day') :
|
||||||
moment(e.start_datetime*1000).isSame(date, 'day') ||
|
moment(e.start_datetime).isSame(date, 'day') ||
|
||||||
moment(e.start_datetime*1000).isBefore(date) && moment(e.end_datetime*1000).isAfter(date)
|
moment(e.start_datetime).isBefore(date) && moment(e.end_datetime).isAfter(date)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -260,12 +270,12 @@ export default {
|
|||||||
|
|
||||||
attributes = attributes.concat(this.filteredEvents
|
attributes = attributes.concat(this.filteredEvents
|
||||||
.filter(e => !e.multidate)
|
.filter(e => !e.multidate)
|
||||||
.map(e => ({ key: e.id, dot: {}, dates: new Date(e.start_datetime*1000)})))
|
.map(e => ({ key: e.id, dot: {}, dates: new Date(e.start_datetime)})))
|
||||||
|
|
||||||
attributes = attributes.concat(this.filteredEvents
|
attributes = attributes.concat(this.filteredEvents
|
||||||
.filter(e => e.multidate)
|
.filter(e => e.multidate)
|
||||||
.map( e => ({ key: e.id, highlight: {}, dates: {
|
.map( e => ({ key: e.id, highlight: {}, dates: {
|
||||||
start: new Date(e.start_datetime*1000), end: new Date(e.end_datetime*1000) }})))
|
start: new Date(e.start_datetime), end: new Date(e.end_datetime) }})))
|
||||||
|
|
||||||
if (this.event.type==='recurrent' && this.event.rec_frequency && Array.isArray(this.date)) {
|
if (this.event.type==='recurrent' && this.event.rec_frequency && Array.isArray(this.date)) {
|
||||||
const recurrent = {}
|
const recurrent = {}
|
||||||
@@ -286,6 +296,13 @@ export default {
|
|||||||
recurrent.start = new Date(this.date[0])
|
recurrent.start = new Date(this.date[0])
|
||||||
}
|
}
|
||||||
if (this.event.rec_frequency === '2m') {
|
if (this.event.rec_frequency === '2m') {
|
||||||
|
// recurrent.weeks = 1
|
||||||
|
// recurrent.ordinalWeekdays = { 1: this.date.map(d => moment(d).day()+1) }
|
||||||
|
recurrent.days = this.date.map(d => moment(d).date())
|
||||||
|
recurrent.monthlyInterval = 2
|
||||||
|
recurrent.start = new Date(this.date[0])
|
||||||
|
}
|
||||||
|
if (this.event.rec_frequency === '1d') {
|
||||||
}
|
}
|
||||||
attributes.push({name: 'recurrent', dates: recurrent, dot: { color: 'red'}})
|
attributes.push({name: 'recurrent', dates: recurrent, dot: { color: 'red'}})
|
||||||
}
|
}
|
||||||
@@ -372,10 +389,11 @@ export default {
|
|||||||
|
|
||||||
if (this.event.type === 'recurrent') {
|
if (this.event.type === 'recurrent') {
|
||||||
const recurrent = {
|
const recurrent = {
|
||||||
frequency: this.rec_frequency,
|
frequency: this.event.rec_frequency,
|
||||||
days: this.rec_when,
|
days: this.event.rec_when,
|
||||||
ordinal: this.rec_ordinal,
|
ordinal: this.event.rec_ordinal,
|
||||||
}
|
}
|
||||||
|
console.error('sono qui dentro type recurrent bella storia,', recurrent)
|
||||||
formData.append('recurrent', JSON.stringify(recurrent))
|
formData.append('recurrent', JSON.stringify(recurrent))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,9 @@
|
|||||||
el-form-item(:label="$t('admin.allow_recurrent_event')")
|
el-form-item(:label="$t('admin.allow_recurrent_event')")
|
||||||
el-switch(v-model='allow_recurrent_event')
|
el-switch(v-model='allow_recurrent_event')
|
||||||
|
|
||||||
|
el-form-item(v-show='allow_recurrent_event' :label="$t('admin.recurrent_event_visible')")
|
||||||
|
el-switch(v-model='recurrent_event_visible')
|
||||||
|
|
||||||
el-divider {{$t('admin.federation')}}
|
el-divider {{$t('admin.federation')}}
|
||||||
el-form(inline @submit.native.prevent='associate_mastondon_instance' label-width='240px')
|
el-form(inline @submit.native.prevent='associate_mastondon_instance' label-width='240px')
|
||||||
p {{$t('admin.mastodon_description')}}
|
p {{$t('admin.mastodon_description')}}
|
||||||
@@ -172,6 +175,18 @@ export default {
|
|||||||
get () { return this.settings.allow_anon_event },
|
get () { return this.settings.allow_anon_event },
|
||||||
set (value) { this.setSetting({ key: 'allow_anon_event', value })}
|
set (value) { this.setSetting({ key: 'allow_anon_event', value })}
|
||||||
},
|
},
|
||||||
|
allow_recurrent_event: {
|
||||||
|
get () { return this.settings.allow_recurrent_event },
|
||||||
|
set (value) { this.setSetting({ key: 'allow_recurrent_event', value })}
|
||||||
|
},
|
||||||
|
recurrent_event_visible: {
|
||||||
|
get () { return this.settings.recurrent_event_visible },
|
||||||
|
set (value) { this.setSetting({ key: 'recurrent_event_visible', value })}
|
||||||
|
},
|
||||||
|
allow_comments: {
|
||||||
|
get () { return this.settings.allow_comments },
|
||||||
|
set (value) { this.setSetting({ key: 'allow_comments', value })}
|
||||||
|
},
|
||||||
paginatedEvents () {
|
paginatedEvents () {
|
||||||
return this.events.slice((this.eventPage-1) * this.perPage,
|
return this.events.slice((this.eventPage-1) * this.perPage,
|
||||||
this.eventPage * this.perPage)
|
this.eventPage * this.perPage)
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ export default ({ app, store }) => {
|
|||||||
Vue.filter('datetime', value => moment(value).format('ddd, D MMMM HH:mm'))
|
Vue.filter('datetime', value => moment(value).format('ddd, D MMMM HH:mm'))
|
||||||
Vue.filter('short_datetime', value => moment(value).format('D/MM HH:mm'))
|
Vue.filter('short_datetime', value => moment(value).format('D/MM HH:mm'))
|
||||||
Vue.filter('hour', value => moment(value).format('HH:mm'))
|
Vue.filter('hour', value => moment(value).format('HH:mm'))
|
||||||
Vue.filter('day', value => moment(value*1000).format('dddd, D MMMM'))
|
Vue.filter('day', value => moment(value).format('dddd, D MMMM'))
|
||||||
Vue.filter('month', value => moment(value).format('MMM'))
|
Vue.filter('month', value => moment(value).format('MMM'))
|
||||||
Vue.filter('event_when', event => {
|
Vue.filter('event_when', event => {
|
||||||
|
|
||||||
const start = moment(event.start_datetime*1000)
|
const start = moment(event.start_datetime)
|
||||||
const end = moment(event.end_datetime*1000)
|
const end = moment(event.end_datetime)
|
||||||
if (event.multidate) {
|
if (event.multidate) {
|
||||||
return `${start.format('ddd, D MMMM (HH:mm)')} - ${end.format('ddd, D MMMM')}`
|
return `${start.format('ddd, D MMMM (HH:mm)')} - ${end.format('ddd, D MMMM')}`
|
||||||
} else if (event.end_datetime && event.end_datetime !== event.start_datetime)
|
} else if (event.end_datetime && event.end_datetime !== event.start_datetime)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const botController = {
|
|||||||
listener.on('error', botController.error)
|
listener.on('error', botController.error)
|
||||||
},
|
},
|
||||||
async post(event) {
|
async post(event) {
|
||||||
const status = `${event.title} @${event.place.name} ${moment(event.start_datetime*1000).format('ddd, D MMMM HH:mm')} -
|
const status = `${event.title} @${event.place.name} ${moment(event.start_datetime).format('ddd, D MMMM HH:mm')} -
|
||||||
${event.description.length > 200 ? event.description.substr(0, 200) + '...' : event.description} - ${event.tags.map(t => '#' + t.tag).join(' ')} ${config.baseurl}/event/${event.id}`
|
${event.description.length > 200 ? event.description.substr(0, 200) + '...' : event.description} - ${event.tags.map(t => '#' + t.tag).join(' ')} ${config.baseurl}/event/${event.id}`
|
||||||
|
|
||||||
let media
|
let media
|
||||||
|
|||||||
@@ -194,53 +194,55 @@ const eventController = {
|
|||||||
|
|
||||||
let events = await Event.findAll({
|
let events = await Event.findAll({
|
||||||
where: {
|
where: {
|
||||||
|
// return only confirmed events
|
||||||
is_visible: true,
|
is_visible: true,
|
||||||
[Op.and]: [
|
[Op.or]: [
|
||||||
Sequelize.literal(`start_datetime >= ${start.unix()}`),
|
// return all recurrent events
|
||||||
Sequelize.literal(`start_datetime <= ${end.unix()}`)
|
{recurrent: { [Op.ne]: null }},
|
||||||
|
|
||||||
|
// and events in specified range
|
||||||
|
{ start_datetime: { [Op.between]: [start.unix(), end.unix()] }}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
order: [
|
attributes: { exclude: ['createdAt', 'updatedAt', 'placeId' ] },
|
||||||
['start_datetime', 'ASC'],
|
order: [[Tag, 'weigth', 'DESC']],
|
||||||
[Tag, 'weigth', 'DESC']
|
|
||||||
],
|
|
||||||
include: [
|
include: [
|
||||||
{ model: Tag, required: false, attributes: ['tag', 'weigth'] },
|
{ model: Tag, required: false },
|
||||||
{ model: Place, required: false, attributes: ['id', 'name', 'address'] }
|
{ model: Place, required: false, attributes: ['id', 'name', 'address'] }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
events = events.map(e => {
|
events = events.map(e => e.get()).map(e => {
|
||||||
e.start_datetime = e.start_datetime*1000
|
e.start_datetime = e.start_datetime*1000
|
||||||
e.end_datetime = e.end_datetime*1000
|
e.end_datetime = e.end_datetime*1000
|
||||||
e.tags = e.tags.map(t => t.tag)
|
e.tags = e.tags.map(t => t.tag)
|
||||||
return e
|
return e
|
||||||
})
|
})
|
||||||
|
|
||||||
// build singular events from a recurrent pattern from today due to
|
// build singular events from a recurrent pattern
|
||||||
// specified parameters
|
function createEventsFromRecurrent(e, dueTo=null, maxEvents=8) {
|
||||||
function createEventsFromRecurrent(e, dueTo=null, maxEvents=20) {
|
|
||||||
const events = []
|
const events = []
|
||||||
const cursor = moment()
|
const recurrent = JSON.parse(e.recurrent)
|
||||||
|
if (!recurrent.frequency) return false
|
||||||
|
const cursor = moment(start)
|
||||||
const start_date = moment(e.start_datetime)
|
const start_date = moment(e.start_datetime)
|
||||||
const frequency = e.recurrent.frequency
|
const frequency = recurrent.frequency
|
||||||
const days = e.recurrent.days
|
const days = [start_date.day()]
|
||||||
const ordinal = e.recurrent.ordinal
|
const ordinal = recurrent.ordinal
|
||||||
|
|
||||||
// EACH WEEK
|
// EACH WEEK
|
||||||
if (frequency === '1w') {
|
if (frequency === '1w') {
|
||||||
while(true) {
|
while(true) {
|
||||||
const found = days.indexOf(cursor.day())
|
const found = days.indexOf(cursor.day())
|
||||||
if (found) break
|
if (found!==-1) break
|
||||||
cursor.add(1, 'day')
|
cursor.add(1, 'day')
|
||||||
}
|
}
|
||||||
|
cursor.set('hour', start_date.hour()).set('minute', start_date.minutes())
|
||||||
e.start_datetime = cursor.set('hour', e.start_datetime.hour()).set('minute', e.start_datetime.minutes())
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if ((dueTo && cursor.isAfter(dueTo)) || events.length>maxEvents) break
|
if ((dueTo && cursor.isAfter(dueTo)) || events.length>maxEvents) break
|
||||||
e.start_datetime = cursor.unix()
|
e.start_datetime = cursor.unix()*1000
|
||||||
events.push(e)
|
events.push( Object.assign({}, e) )
|
||||||
cursors.add(1, 'week')
|
cursor.add(1, 'week')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,10 +251,15 @@ const eventController = {
|
|||||||
return events
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalEvents = events.filter(e => !e.recurrent)
|
let allEvents = events.filter(e => !e.recurrent)
|
||||||
const recurrentEvents = events.filter(e => e.recurrent).map(createEventsFromRecurrent)
|
events.filter(e => e.recurrent).forEach(e => {
|
||||||
|
const events = createEventsFromRecurrent(e, end)
|
||||||
|
if (events)
|
||||||
|
allEvents = allEvents.concat(events)
|
||||||
|
})
|
||||||
|
|
||||||
res.json(normalEvents.concat(recurrentEvents))
|
// allEvents.sort((a,b) => a.start_datetime-b.start_datetime)
|
||||||
|
res.json(allEvents.sort((a,b) => a.start_datetime-b.start_datetime))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ const settingsController = {
|
|||||||
await Setting.findOrCreate({
|
await Setting.findOrCreate({
|
||||||
where: { key },
|
where: { key },
|
||||||
defaults: { value, is_secret }
|
defaults: { value, is_secret }
|
||||||
}).spread((settings, created) => {
|
}).spread((setting, created) => {
|
||||||
if (!created) return settings.update({ value, is_secret })
|
if (!created) return setting.update({ value, is_secret })
|
||||||
})
|
})
|
||||||
settingsController[is_secret?'secretSettings':'settings'][key]=value
|
settingsController[is_secret?'secretSettings':'settings'][key]=value
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ const userController = {
|
|||||||
start_datetime: body.start_datetime,
|
start_datetime: body.start_datetime,
|
||||||
end_datetime: body.end_datetime,
|
end_datetime: body.end_datetime,
|
||||||
|
|
||||||
// publish this event if authenticated
|
recurrent: body.recurrent,
|
||||||
|
// publish this event only if authenticated
|
||||||
is_visible: !!req.user
|
is_visible: !!req.user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
h3 #{event.title}
|
h3 #{event.title}
|
||||||
p Dove: #{event.place.name} - #{event.place.address}
|
p Dove: #{event.place.name} - #{event.place.address}
|
||||||
p Quando: #{datetime(event.start_datetime*1000)}
|
p Quando: #{datetime(event.start_datetime)}
|
||||||
br
|
br
|
||||||
if event.image_path
|
if event.image_path
|
||||||
<center>
|
<center>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
= `[${config.title}] ${event.title} @${event.place.name} ${datetime(event.start_datetime*1000)}`
|
= `[${config.title}] ${event.title} @${event.place.name} ${datetime(event.start_datetime)}`
|
||||||
|
|||||||
@@ -17,14 +17,13 @@ const notifier = {
|
|||||||
case 'admin_email':
|
case 'admin_email':
|
||||||
return mail.send([config.smtp.auth.user, config.admin_email], 'event', { event, to_confirm: !event.is_visible, config, notification })
|
return mail.send([config.smtp.auth.user, config.admin_email], 'event', { event, to_confirm: !event.is_visible, config, notification })
|
||||||
case 'mastodon':
|
case 'mastodon':
|
||||||
console.error('mando le cose')
|
|
||||||
// instance publish
|
// instance publish
|
||||||
if (bot.bot) {
|
if (bot.bot) {
|
||||||
const b = bot.post(event).then(b => {
|
const b = bot.post(event).then(b => {
|
||||||
event.activitypub_id = String(b.data.id)
|
event.activitypub_id = String(b.data.id)
|
||||||
return event.save()
|
return event.save()
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.error("ERRORE !! ", e)
|
console.error("ERROR !! ", e)
|
||||||
})
|
})
|
||||||
promises.push(b)
|
promises.push(b)
|
||||||
}
|
}
|
||||||
@@ -53,9 +52,7 @@ const notifier = {
|
|||||||
await notifier.sendNotification(notification, event)
|
await notifier.sendNotification(notification, event)
|
||||||
e.status = 'sent'
|
e.status = 'sent'
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// console.error(err)
|
|
||||||
e.status = 'error'
|
e.status = 'error'
|
||||||
// e.error = err
|
|
||||||
}
|
}
|
||||||
return e.save()
|
return e.save()
|
||||||
})
|
})
|
||||||
@@ -84,12 +81,4 @@ const notifier = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// let interval
|
|
||||||
// function startLoop(seconds) {
|
|
||||||
// interval = setInterval(notify, seconds * 1000)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// startLoop(26000)
|
|
||||||
|
|
||||||
module.exports = notifier
|
module.exports = notifier
|
||||||
// export default notifier
|
|
||||||
@@ -9,7 +9,13 @@ export const state = () => ({
|
|||||||
events: [],
|
events: [],
|
||||||
tags: [],
|
tags: [],
|
||||||
places: [],
|
places: [],
|
||||||
settings: {},
|
settings: {
|
||||||
|
allow_registration: true,
|
||||||
|
allow_anon_event: true,
|
||||||
|
allow_recurrent_event: true,
|
||||||
|
recurrent_event_visible: false,
|
||||||
|
allow_comments: false,
|
||||||
|
},
|
||||||
filters: {
|
filters: {
|
||||||
tags: [],
|
tags: [],
|
||||||
places: [],
|
places: [],
|
||||||
@@ -83,7 +89,7 @@ export const mutations = {
|
|||||||
// set`past` and `newDay` flags to event
|
// set`past` and `newDay` flags to event
|
||||||
let lastDay = null
|
let lastDay = null
|
||||||
state.events = events.map((e) => {
|
state.events = events.map((e) => {
|
||||||
const currentDay = moment(e.start_datetime*1000).date()
|
const currentDay = moment(e.start_datetime).date()
|
||||||
e.newDay = (!lastDay || lastDay !== currentDay) && currentDay
|
e.newDay = (!lastDay || lastDay !== currentDay) && currentDay
|
||||||
lastDay = currentDay
|
lastDay = currentDay
|
||||||
const end_datetime = e.end_datetime || e.start_datetime+3600*2
|
const end_datetime = e.end_datetime || e.start_datetime+3600*2
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ rss(version='2.0')
|
|||||||
lastBuildDate= new Date(posts[0].publishedAt).toUTCString()
|
lastBuildDate= new Date(posts[0].publishedAt).toUTCString()
|
||||||
each event in events
|
each event in events
|
||||||
item
|
item
|
||||||
title [#{moment(event.start_datetime*1000).format("D-MM-YY")}] #{event.title} @#{event.place.name}
|
title [#{moment(event.start_datetime).format("D-MM-YY")}] #{event.title} @#{event.place.name}
|
||||||
link #{config.baseurl}/event/#{event.id}
|
link #{config.baseurl}/event/#{event.id}
|
||||||
description
|
description
|
||||||
| <![CDATA[
|
| <![CDATA[
|
||||||
| <h4>#{event.title}</h4>
|
| <h4>#{event.title}</h4>
|
||||||
| <strong>#{event.place.name} - #{event.place.address}</strong>
|
| <strong>#{event.place.name} - #{event.place.address}</strong>
|
||||||
| #{moment(event.start_datetime*1000).format("dddd, D MMMM HH:mm")}<br/>
|
| #{moment(event.start_datetime).format("dddd, D MMMM HH:mm")}<br/>
|
||||||
| <img src="#{config.apiurl}/media/#{event.image_path}"/>
|
| <img src="#{config.apiurl}/media/#{event.image_path}"/>
|
||||||
| <pre>!{event.description}</pre>
|
| <pre>!{event.description}</pre>
|
||||||
| ]]>
|
| ]]>
|
||||||
|
|||||||
Reference in New Issue
Block a user