diff --git a/app/controller/event.js b/app/controller/event.js
index d7d9f2a4..933118ce 100644
--- a/app/controller/event.js
+++ b/app/controller/event.js
@@ -28,6 +28,11 @@ const eventController = {
function match (event, filters) {
// matches if no filter specified
if (!filters) return true
+
+ // check for visibility
+ if (filters.is_visible && filters.is_visible !== event.is_visible) return false
+
+ if (!filters.tags && !filters.places) return true
if (!filters.tags.length && !filters.places.length) return true
if (filters.tags.length) {
const m = lodash.intersection(event.tags.map(t => t.tag), filters.tags)
@@ -70,12 +75,11 @@ const eventController = {
const id = req.params.event_id
const event = await Event.findByPk(id)
- // insert notification
- const notifications = await eventController.getNotifications(event)
- await event.setNotifications(notifications)
-
try {
await event.update({ is_visible: true })
+ // insert notification
+ const notifications = await eventController.getNotifications(event)
+ await event.setNotifications(notifications)
res.send(200)
} catch (e) {
res.send(404)
diff --git a/app/controller/export.js b/app/controller/export.js
index 407b8b4e..00ece085 100644
--- a/app/controller/export.js
+++ b/app/controller/export.js
@@ -21,7 +21,7 @@ const exportController = {
wherePlace.name = places.split(',')
}
const events = await Event.findAll({
- order: [['start_datetime', 'ASC']],
+ // order: [['start_datetime', 'ASC']],
where: { start_datetime: { [Op.gte]: yesterday } },
include: [Comment, {
model: Tag,
diff --git a/app/controller/user.js b/app/controller/user.js
index fa8dbf2e..19d396e1 100644
--- a/app/controller/user.js
+++ b/app/controller/user.js
@@ -105,11 +105,10 @@ const userController = {
if (req.user) await req.user.addEvent(event)
event = await Event.findByPk(event.id, { include: [User, Tag, Place] })
- if (req.user) {
- // insert notifications
- const notifications = await eventController.getNotifications(event)
- await event.setNotifications(notifications)
- }
+ // insert notifications
+ const notifications = await eventController.getNotifications(event)
+ await event.setNotifications(notifications)
+
return res.json(event)
},
diff --git a/app/emails/event/html.pug b/app/emails/event/html.pug
index 8c397e48..72b0151d 100644
--- a/app/emails/event/html.pug
+++ b/app/emails/event/html.pug
@@ -2,14 +2,17 @@ h3 #{event.title}
p Dove: #{event.place.name} - #{event.place.address}
p Quando: #{datetime(event.start_datetime)}
br
-
+if event.image_path
+
p #{event.description}
+each tag in event.tags
+ span ##{tag.tag}
+br
#{config.baseurl}/event/#{event.id}
-p #{event.tags.join(', ')}
hr
if to_confirm
- p Puoi confermare questo evento #{config.apiurl}qui
-else
+ p Puoi confermare questo evento qui
+//- else
p Puoi eliminare queste notifiche qui
#{config.title} - #{config.description}
diff --git a/app/models/event.js b/app/models/event.js
index 80ea88d8..ed894783 100644
--- a/app/models/event.js
+++ b/app/models/event.js
@@ -34,8 +34,8 @@ const Notification = db.define('notification', {
}
})
-Notification.findOrCreate({ where: { type: 'mastodon' } })
-Notification.findOrCreate({ where: { type: 'admin_email' } })
+Notification.findOrCreate({ where: { type: 'mastodon', filters: { is_visible: true } } })
+Notification.findOrCreate({ where: { type: 'admin_email', filters: { is_visible: false } } })
const Place = db.define('place', {
name: { type: Sequelize.STRING, unique: true, index: true },
diff --git a/client/src/components/Admin.vue b/client/src/components/Admin.vue
index 0acc1f1e..ed85b2f6 100644
--- a/client/src/components/Admin.vue
+++ b/client/src/components/Admin.vue
@@ -144,7 +144,6 @@ export default {
},
methods: {
placeSelected (items) {
- console.log('dentro place selected ', items, items.length)
if (items.length === 0 ) {
this.place.name = this.place.address = ''
return
diff --git a/client/src/components/Home.vue b/client/src/components/Home.vue
index e5c71ebc..05b50704 100644
--- a/client/src/components/Home.vue
+++ b/client/src/components/Home.vue
@@ -23,7 +23,7 @@ export default {
components: { Event, Calendar, Search },
watch: {
filteredEvents () {
- this.$nextTick( this.$refs.magicgrid.positionItems)
+ this.$nextTick(this.$refs.magicgrid.positionItems)
}
},
computed: {
diff --git a/client/src/components/Login.vue b/client/src/components/Login.vue
index aeb4dd72..7f09610a 100644
--- a/client/src/components/Login.vue
+++ b/client/src/components/Login.vue
@@ -1,6 +1,6 @@
b-modal(@shown="$refs.email.focus()" :title='$t("Login")' hide-footer
- @hidden='$router.replace("/")' :visible='true')
+ @hidden='$router.replace("/")' :visible='true' ref='modal')
el-form
p {{$t('login_explanation')}}
el-input.mb-2(v-model='email' type='email' :placeholder='$t("Email")' autocomplete='email' ref='email')
@@ -42,7 +42,7 @@ export default {
Message({ message: this.$t('login error'), type: 'error' })
}
this.email = this.password = ''
- this.$router.replace("/")
+ this.$refs.modal.hide()
}
}
}
diff --git a/client/src/components/newEvent.vue b/client/src/components/newEvent.vue
index 54d8e6da..b06d497d 100644
--- a/client/src/components/newEvent.vue
+++ b/client/src/components/newEvent.vue
@@ -65,6 +65,7 @@ import api from '@/api'
import { mapActions, mapState } from 'vuex'
import moment from 'dayjs'
import Calendar from './Calendar'
+import { Message } from 'element-ui'
export default {
components: { Calendar },
data() {
@@ -201,11 +202,11 @@ export default {
await this.updateEvent(formData)
} else {
await this.addEvent(formData)
- // this.$router.push('/')
}
this.updateMeta()
this.sending = false
this.$refs.modal.hide()
+ Message({ type: 'success', message: this.logged ? this.$t('new_event_added') : this.$t('new_anon_event_added')})
} catch (e) {
this.sending = false
console.error(e)
diff --git a/client/src/locale/it.js b/client/src/locale/it.js
index 3859b5ae..4cecc76c 100644
--- a/client/src/locale/it.js
+++ b/client/src/locale/it.js
@@ -87,6 +87,8 @@ const it = {
Prima di poter pubblicare dobbiamo approvare l'account, considera che dietro questo sito ci sono delle persone di
carne e sangue, scrivici quindi due righe per farci capire che eventi vorresti pubblicare.`,
'Not registered?': `Non sei registrata?`,
+ new_event_added: `Evento aggiunto.`,
+ new_anon_event_added: `Evento inserito, verrĂ confermato quanto prima.`,
login_explanation: ``
}