From b413742c45c6d09eb26e71f6bb58b7a32d9df780 Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 7 Aug 2019 01:26:14 +0200 Subject: [PATCH] minor while edit event datetime --- components/List.vue | 2 +- pages/about.vue | 11 +++++++++++ pages/add/_edit.vue | 22 ++++++++++++---------- pages/admin.vue | 3 +++ pages/settings.vue | 7 +++++++ server/api/models/event.js | 2 +- server/federation/helpers.js | 2 +- 7 files changed, 36 insertions(+), 13 deletions(-) diff --git a/components/List.vue b/components/List.vue index aa031087..76c00033 100644 --- a/components/List.vue +++ b/components/List.vue @@ -4,7 +4,7 @@ div#list el-timeline el-timeline-item( v-for='event in events' - :key='event.start_datetime' + :key='`${event.id}_${event.start_datetime}`' :timestamp='event|when' placement='top' icon='el-icon-arrow-down' size='large' ) diff --git a/pages/about.vue b/pages/about.vue index 52037125..07c2efbc 100644 --- a/pages/about.vue +++ b/pages/about.vue @@ -8,3 +8,14 @@ div(v-html='$t("about")') + diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue index d0fcd9e4..f5de2d80 100644 --- a/pages/add/_edit.vue +++ b/pages/add/_edit.vue @@ -193,21 +193,22 @@ export default { data.event.place.name = event.place.name data.event.place.address = event.place.address || '' if (event.multidate) { - data.date = { start: new Date(event.start_datetime), end: new Date(event.end_datetime) } + data.date = { start: new Date(event.start_datetime*1000), end: new Date(event.end_datetime*1000) } data.event.type = 'multidate' } else if (event.recurrent ) { data.event.type = 'recurrent' data.event.recurrent = JSON.parse(event.recurrent) } else { data.event.type = 'normal' - data.date = new Date(event.start_datetime) + data.date = new Date(event.start_datetime*1000) } - data.time.start = moment(event.start_datetime).format('HH:mm') - data.time.end = moment(event.end_datetime).format('HH:mm') + data.time.start = moment.unix(event.start_datetime).format('HH:mm') + data.time.end = moment.unix(event.end_datetime).format('HH:mm') data.event.title = event.title data.event.description = event.description.replace(/(<([^>]+)>)/ig, '') data.event.id = event.id + data.event.recurrent = {} if (event.tags) { data.event.tags = event.tags.map(t => t.tag) } @@ -250,15 +251,17 @@ export default { const date_end = moment(this.date.end) return this.events.filter(e => !e.multidate ? - date_start.isSame(e.start_datetime, 'day') || + date_start.isSame(e.start_datetime, 'day') || date_start.isBefore(e.start_datime) && date_end.isAfter(e.start_datetime) : date_start.isSame(e.start_datetime, 'day') || date_start.isSame(e.end_datetime) || date_start.isAfter(e.start_datetime) && date_start.isBefore(e.end_datetime)) + } else if (this.event.type === 'recurrent' ) { + } else { const date = moment(this.date) return this.events.filter(e => !e.multidate ? - date.isSame(moment(e.start_datetime), 'day') : + !e.recurrent && date.isSame(moment(e.start_datetime), 'day') : moment(e.start_datetime).isSame(date, 'day') || moment(e.start_datetime).isBefore(date) && moment(e.end_datetime).isAfter(date) ) @@ -334,10 +337,10 @@ export default { if (this.event.type !== 'recurrent' || !this.date || !this.date.length) return const type = this.event.recurrent.type if (type === 'ordinal') - return map(this.date, d => moment(d).date() ) + return map(this.date, d => moment(d).date()) else if (type === 'weekday') - return map(this.date, moment(d).day()+1 ) - }, + return map(this.date, moment(d).day()+1) + }, next () { this.activeTab = String(Number(this.activeTab)+1) if (this.activeTab === "2") { @@ -402,7 +405,6 @@ export default { end_datetime = end_datetime.add(1, 'day') } formData.append('recurrent', JSON.stringify(recurrent)) - } if (this.event.image) { diff --git a/pages/admin.vue b/pages/admin.vue index e943137c..bf6bd8ca 100644 --- a/pages/admin.vue +++ b/pages/admin.vue @@ -94,6 +94,9 @@ export default { open: true, } }, + head () { + return { title: `${this.settings.title} - ${this.$t('common.admin')}` } + }, async mounted () { const code = this.$route.query.code diff --git a/pages/settings.vue b/pages/settings.vue index de1c2e3d..81380793 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -23,6 +23,13 @@ export default { password: '', } }, + name: 'Settings', + computed: mapState(['settings']), + head () { + return { + title: `${this.settings.title} - ${this.$t('common.settings')}` + } + }, async asyncData ({ $axios, params }) { const user = await $axios.$get('/auth/user') user.mastodon_auth = '' diff --git a/server/api/models/event.js b/server/api/models/event.js index 0aa045f4..1199fdb1 100644 --- a/server/api/models/event.js +++ b/server/api/models/event.js @@ -47,7 +47,7 @@ module.exports = (sequelize, DataTypes) => { attributedTo: `${config.baseurl}/federation/u/${username}`, to: 'https://www.w3.org/ns/activitystreams#Public', cc: follower ? follower: [], - content: this.title + content: `${this.title} @${this.place.name}
${this.description.length > 200 ? this.description.substr(0, 200) + '...' : this.description} - ${this.tags.map(t => '#' + t.tag).join(' ')}
${config.baseurl}/event/${this.id}` } } } diff --git a/server/federation/helpers.js b/server/federation/helpers.js index dc6d860b..dac91932 100644 --- a/server/federation/helpers.js +++ b/server/federation/helpers.js @@ -7,7 +7,7 @@ const httpSignature = require('http-signature') const actorCache = [] const Helpers = { - async signAndSend(message, user, to) {//, domain, req, res, targetOrigin) { + async signAndSend(message, user, to) { // get the URI of the actor object and append 'inbox' to it const toInbox = to + '/inbox'