recurrent events only if allowed

This commit is contained in:
les 2019-09-12 11:59:30 +02:00
parent d05ced94ca
commit dec8e4091a
No known key found for this signature in database
GPG key ID: 352918250B012177
4 changed files with 6 additions and 10 deletions

View file

@ -17,7 +17,7 @@
ul.tags(v-if='showTags && event.tags')
li(v-for='tag in event.tags' :key='tag') {{tag}}
li(v-if='event.comments && event.comments.length') <u>{{$tc('common.comments', event.comments.length)}}</u>
li(v-if='settings.enable_federation && event.comments && event.comments.length') <u>{{$tc('common.comments', event.comments.length)}}</u>
</template>
<script>
import { mapState, mapActions } from 'vuex'
@ -35,6 +35,7 @@ export default {
}
},
computed: {
...mapState(['settings']),
date () {
return new Date(this.event.start_datetime).getDate()
},

View file

@ -50,12 +50,11 @@
//- WHEN
el-tab-pane
span(slot='label') {{$t('common.when')}} <v-icon name='clock'/>
.text-center
el-radio-group(v-model="event.type")
el-radio-button(label="normal") <v-icon name='calendar-day'/> {{$t('event.normal')}}
el-radio-button(label="multidate") <v-icon name='calendar-week'/> {{$t('event.multidate')}}
el-radio-button(label="recurrent") <v-icon name='calendar-alt'/> {{$t('event.recurrent')}}
el-radio-button(v-if='settings.allow_recurrent_event' label="recurrent") <v-icon name='calendar-alt'/> {{$t('event.recurrent')}}
br
span {{$t(`event.${event.type}_description`)}}
el-select.ml-2(v-if='event.type==="recurrent"' v-model='event.recurrent.frequency' placeholder='Frequenza')

View file

@ -10,6 +10,7 @@ const debug = require('debug')('controller:event')
const eventController = {
// NOT USED ANYWHERE, comments are added from fediverse
async addComment (req, res) {
// comment could be added to an event or to another comment
let event = await Event.findOne({ where: { activitypub_id: { [Op.eq]: req.body.id } } })
@ -202,7 +203,7 @@ const eventController = {
// return only confirmed events
is_visible: true,
[Op.or]: [
// return all recurrent events
// return all recurrent events regardless start_datetime
{ recurrent: { [Op.ne]: null } },
// and events in specified range
@ -226,7 +227,7 @@ const eventController = {
// build singular events from a recurrent pattern
function createEventsFromRecurrent (e, dueTo = null) {
const events = []
const recurrent = e.recurrent
const recurrent = JSON.parse(e.recurrent)
if (!recurrent.frequency) { return false }
let cursor = moment(start).startOf('week')

View file

@ -57,11 +57,6 @@ module.exports = (sequelize, DataTypes) => {
}
return {
// id: `${config.baseurl}/federation/m/c_${this.id}`,
// type: 'Create',
// actor: `${config.baseurl}/federation/u/${username}`,
// url: `${config.baseurl}/federation/m/${this.id}`,
// object: {
type: 'Note',
id: `${config.baseurl}/federation/m/${this.id}`,
url: `${config.baseurl}/federation/m/${this.id}`,