comment from mastodon to gancio
This commit is contained in:
49
.vscode/vscode-kanban.json
vendored
49
.vscode/vscode-kanban.json
vendored
@@ -32,6 +32,17 @@
|
|||||||
"prio": 0,
|
"prio": 0,
|
||||||
"references": [],
|
"references": [],
|
||||||
"title": "export lista"
|
"title": "export lista"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "lesion"
|
||||||
|
},
|
||||||
|
"category": "feature",
|
||||||
|
"creation_time": "2019-04-23T19:56:46.263Z",
|
||||||
|
"id": "11",
|
||||||
|
"prio": 1,
|
||||||
|
"references": [],
|
||||||
|
"title": "get comments / media from mastodon"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testing": [
|
"testing": [
|
||||||
@@ -72,17 +83,6 @@
|
|||||||
"title": "rivedere ux / messaggi utente",
|
"title": "rivedere ux / messaggi utente",
|
||||||
"type": "bug"
|
"type": "bug"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "lesion"
|
|
||||||
},
|
|
||||||
"category": "feature",
|
|
||||||
"creation_time": "2019-04-23T19:56:46.263Z",
|
|
||||||
"id": "11",
|
|
||||||
"prio": 1,
|
|
||||||
"references": [],
|
|
||||||
"title": "get comments / media from mastodon"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "lesion"
|
"name": "lesion"
|
||||||
@@ -115,6 +115,15 @@
|
|||||||
"title": "risolvere le modali quando il js e' disabilitato",
|
"title": "risolvere le modali quando il js e' disabilitato",
|
||||||
"type": "bug"
|
"type": "bug"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "lesion"
|
||||||
|
},
|
||||||
|
"creation_time": "2019-04-29T10:01:01.632Z",
|
||||||
|
"id": "14",
|
||||||
|
"references": [],
|
||||||
|
"title": "gestione errori quando non c'e' un evento"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "lesion"
|
"name": "lesion"
|
||||||
@@ -134,6 +143,15 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "rifare il calendario o solo il popup"
|
"title": "rifare il calendario o solo il popup"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"assignedTo": {
|
||||||
|
"name": "lesion"
|
||||||
|
},
|
||||||
|
"creation_time": "2019-04-28T09:25:50.701Z",
|
||||||
|
"id": "13",
|
||||||
|
"references": [],
|
||||||
|
"title": "test altra visualizzazione"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"assignedTo": {
|
"assignedTo": {
|
||||||
"name": "lesion"
|
"name": "lesion"
|
||||||
@@ -156,15 +174,6 @@
|
|||||||
"references": [],
|
"references": [],
|
||||||
"title": "documentare sorgenti",
|
"title": "documentare sorgenti",
|
||||||
"type": "bug"
|
"type": "bug"
|
||||||
},
|
|
||||||
{
|
|
||||||
"assignedTo": {
|
|
||||||
"name": "lesion"
|
|
||||||
},
|
|
||||||
"creation_time": "2019-04-28T09:25:50.701Z",
|
|
||||||
"id": "13",
|
|
||||||
"references": [],
|
|
||||||
"title": "test altra visualizzazione"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
span.d-md-none {{$t('common.add_event')}}
|
span.d-md-none {{$t('common.add_event')}}
|
||||||
b-nav-item(v-if='$auth.loggedIn' to='/settings' v-b-tooltip :title='$t("common.settings")') <v-icon color='orange' name='cog'/>
|
b-nav-item(v-if='$auth.loggedIn' to='/settings' v-b-tooltip :title='$t("common.settings")') <v-icon color='orange' name='cog'/>
|
||||||
span.d-md-none {{$t('common.settings')}}
|
span.d-md-none {{$t('common.settings')}}
|
||||||
b-nav-item(v-if='$auth.user.is_admin' to='/admin' v-b-tooltip :title='$t("common.admin")') <v-icon color='lightblue' name='tools'/>
|
b-nav-item(v-if='$auth.user && $auth.user.is_admin' to='/admin' v-b-tooltip :title='$t("common.admin")') <v-icon color='lightblue' name='tools'/>
|
||||||
span.d-md-none {{$t('common.admin')}}
|
span.d-md-none {{$t('common.admin')}}
|
||||||
b-nav-item(to='/export' v-b-tooltip :title='$t("common.export")') <v-icon name='file-export' color='yellow'/>
|
b-nav-item(to='/export' v-b-tooltip :title='$t("common.export")') <v-icon name='file-export' color='yellow'/>
|
||||||
span.d-md-none {{$t('common.export')}}
|
span.d-md-none {{$t('common.export')}}
|
||||||
|
|||||||
@@ -35,7 +35,9 @@
|
|||||||
"hide": "Nascondi",
|
"hide": "Nascondi",
|
||||||
"remove": "Elimina",
|
"remove": "Elimina",
|
||||||
"edit": "Modifica",
|
"edit": "Modifica",
|
||||||
"actions": "Azioni"
|
"actions": "Azioni",
|
||||||
|
"resources": "Risorse",
|
||||||
|
"add": "Aggiungi"
|
||||||
},
|
},
|
||||||
|
|
||||||
"login": {
|
"login": {
|
||||||
@@ -58,7 +60,8 @@
|
|||||||
"anon_description": "",
|
"anon_description": "",
|
||||||
"where_description" : "Dov'è il gancio? Se è un luogo fisico, scrivi il suo nome del per esteso (tipo 'Mezcal Squat'), se è una Piazza/Via metti quella (tipo 'Piazza Castello, Torino'). Se trovi già il luogo dell'evento premilo e l'indirizzo verrà autocompletato.",
|
"where_description" : "Dov'è il gancio? Se è un luogo fisico, scrivi il suo nome del per esteso (tipo 'Mezcal Squat'), se è una Piazza/Via metti quella (tipo 'Piazza Castello, Torino'). Se trovi già il luogo dell'evento premilo e l'indirizzo verrà autocompletato.",
|
||||||
"address_description": "",
|
"address_description": "",
|
||||||
"tag_description": "Puoi inserire un tag (es. concerto, corteo)"
|
"tag_description": "Puoi inserire un tag (es. concerto, corteo)",
|
||||||
|
"added": "Avento aggiunto"
|
||||||
},
|
},
|
||||||
|
|
||||||
"admin": {
|
"admin": {
|
||||||
@@ -69,4 +72,3 @@
|
|||||||
"mastodon_instance": "Istanza mastodon"
|
"mastodon_instance": "Istanza mastodon"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
br
|
br
|
||||||
b-card-body(v-if='event.description || event.tags')
|
b-card-body(v-if='event.description || event.tags')
|
||||||
pre(v-html='event.description')
|
pre(v-html='event.description')
|
||||||
br
|
|
||||||
el-tag.mr-1(:color='tag.color' v-for='tag in event.tags'
|
el-tag.mr-1(:color='tag.color' v-for='tag in event.tags'
|
||||||
size='mini' :key='tag.tag') {{tag.tag}}
|
size='mini' :key='tag.tag') {{tag.tag}}
|
||||||
div(v-if='mine')
|
div(v-if='mine')
|
||||||
@@ -24,27 +23,17 @@
|
|||||||
el-button(plain type='danger' @click.prevent='remove' icon='el-icon-remove') {{$t('common.remove')}}
|
el-button(plain type='danger' @click.prevent='remove' icon='el-icon-remove') {{$t('common.remove')}}
|
||||||
el-button(plain type='primary' @click='$router.replace("/edit/"+event.id)') <v-icon color='orange' name='edit'/> {{$t('common.edit')}}
|
el-button(plain type='primary' @click='$router.replace("/edit/"+event.id)') <v-icon color='orange' name='edit'/> {{$t('common.edit')}}
|
||||||
|
|
||||||
//- COMMENTS ...
|
b-card-body(v-if='event.activitypub_id')
|
||||||
//- b-navbar(type="dark" variant="dark" toggleable='lg')
|
strong {{$t('common.resources')}} -
|
||||||
//- template(slot='footer')
|
a(:href='`https://mastodon.cisti.org/web/statuses/${event.activitypub_id}`') {{$t('common.add')}}
|
||||||
//- b-navbar-nav
|
b-card-header(v-for='comment in event.comments' :key='comment.id')
|
||||||
//- b-button(variant='success') {{$t('Share')}} <v-icon name='share'/>
|
img.avatar(:src='comment.data.last_status.account.avatar')
|
||||||
//- b-nav-item( {{$t('')}})
|
strong {{comment.author}}
|
||||||
//- b-card-footer.text-right
|
a.float-right(:href='comment.data.last_status.url')
|
||||||
//- span.mr-3 {{event.comments.length}} <v-icon name='comments'/>
|
small {{comment.data.last_status.created_at|datetime}}
|
||||||
//- a(href='#', @click='remove')
|
div.mt-1(v-html='comment_filter(comment.text)')
|
||||||
v-icon(color='orange' name='times')
|
img(v-for='img in comment.data.last_status.media_attachments' :src='img.preview_url')
|
||||||
//- el-footer(v-for='comment in event.comments')
|
//- span {{comment}}
|
||||||
strong {{comment.author}}
|
|
||||||
div(v-html='comment.text')
|
|
||||||
|
|
||||||
//- el-timeline
|
|
||||||
//- el-timeline-item(v-for='comment in event.comments')
|
|
||||||
//- p(v-html='comment.text')
|
|
||||||
//- a.el-timeline-item__timestamp(href='') {{comment.createdAt}}
|
|
||||||
strong {{$t('common.comments')}}
|
|
||||||
div.text.item(v-for='comment in event.comments')
|
|
||||||
span(v-html='comment.text')
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapActions } from 'vuex';
|
import { mapState, mapActions } from 'vuex';
|
||||||
@@ -74,7 +63,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mine () {
|
mine () {
|
||||||
return this.event.userId === this.$auth.user.id || this.$auth.user.is_admin
|
return this.event.userId === this.$auth.user.id || this.$auth.user.is_admin
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -83,25 +72,25 @@ export default {
|
|||||||
loading: true,
|
loading: true,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// mounted () {
|
|
||||||
// this.id = this.$route.params.id
|
|
||||||
// this.load()
|
|
||||||
// },
|
|
||||||
async asyncData ( { $axios, params }) {
|
async asyncData ( { $axios, params }) {
|
||||||
console.error('daje dentro asyncData!')
|
|
||||||
console.error('async data porcod')
|
|
||||||
const event = await $axios.$get(`/event/${params.id}`)
|
const event = await $axios.$get(`/event/${params.id}`)
|
||||||
// this.event = event
|
|
||||||
// this.loading = false
|
|
||||||
return { event, id: params.id, loading: false }
|
return { event, id: params.id, loading: false }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['delEvent']),
|
...mapActions(['delEvent']),
|
||||||
// async load () {
|
comment_filter (value) {
|
||||||
// const event = await this.api.getEvent(this.id)
|
console.log('dentro comment_filter')
|
||||||
// this.event = event
|
return value.replace(/<a.*href="([^">]+).*>(?:.(?!\<\/a\>))*.<\/a>/, (orig, url) => {
|
||||||
// this.loading = false
|
// get extension
|
||||||
// },
|
const ext = url.slice(-4)
|
||||||
|
console.log('dentro il replace ', ext)
|
||||||
|
if (['.mp3', '.ogg'].indexOf(ext)>-1) {
|
||||||
|
return `<audio controls><source src='${url}'></audio>`
|
||||||
|
} else {
|
||||||
|
return orig
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
async remove () {
|
async remove () {
|
||||||
await api.delEvent(this.event.id)
|
await api.delEvent(this.event.id)
|
||||||
this.delEvent(this.event.id)
|
this.delEvent(this.event.id)
|
||||||
@@ -125,6 +114,15 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
|
#eventDetail .avatar {
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#eventDetail .image {
|
||||||
|
max-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
/* #eventDetail {
|
/* #eventDetail {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@@ -144,10 +142,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#eventDetail .close_button {
|
#eventDetail .close_button {
|
||||||
background-color: rgba(100, 100, 100, 0.4);
|
background-color: rgba(100, 100, 100, 0.3);
|
||||||
color: red;
|
color: red;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
border: none;
|
border: 1px dashed rgba(20,20,20,0.3);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
|
|||||||
@@ -72,7 +72,12 @@ ${event.description.length > 200 ? event.description.substr(0, 200) + '...' : ev
|
|||||||
// const comment = await Comment.findOne( {where: { }})
|
// const comment = await Comment.findOne( {where: { }})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const comment = await Comment.create({activitypub_id: msg.data.last_status.id, text: msg.data.last_status.content, author: msg.data.accounts[0].username })
|
const comment = await Comment.create({
|
||||||
|
activitypub_id: msg.data.last_status.id,
|
||||||
|
text: msg.data.last_status.content,
|
||||||
|
data: msg.data,
|
||||||
|
author: msg.data.accounts[0].username
|
||||||
|
})
|
||||||
event.addComment(comment)
|
event.addComment(comment)
|
||||||
console.log(event)
|
console.log(event)
|
||||||
// const comment = await Comment.findOne( { where: {activitypub_id: msg.data.in_reply_to}} )
|
// const comment = await Comment.findOne( { where: {activitypub_id: msg.data.in_reply_to}} )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const Sequelize = require('sequelize')
|
const Sequelize = require('sequelize')
|
||||||
const conf = require('./config.js')
|
const conf = require('./config.js')
|
||||||
const db = new Sequelize(conf.db)
|
const db = new Sequelize(conf.db)
|
||||||
// db.sync({force: true})
|
db.sync()
|
||||||
module.exports = db
|
module.exports = db
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const Event = db.define('event', {
|
|||||||
end_datetime: { type: Sequelize.DATE, index: true },
|
end_datetime: { type: Sequelize.DATE, index: true },
|
||||||
image_path: Sequelize.STRING,
|
image_path: Sequelize.STRING,
|
||||||
is_visible: Sequelize.BOOLEAN,
|
is_visible: Sequelize.BOOLEAN,
|
||||||
activitypub_id: { type: Sequelize.INTEGER, index: true },
|
activitypub_id: { type: Sequelize.STRING, index: true },
|
||||||
// activitypub_ids: { type: Sequelize.ARRAY, index}
|
// activitypub_ids: { type: Sequelize.ARRAY, index}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -20,9 +20,9 @@ const Tag = db.define('tag', {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const Comment = db.define('comment', {
|
const Comment = db.define('comment', {
|
||||||
activitypub_id: { type: Sequelize.INTEGER, index: true },
|
activitypub_id: { type: Sequelize.STRING, index: true },
|
||||||
|
data: Sequelize.JSON,
|
||||||
url: Sequelize.STRING,
|
url: Sequelize.STRING,
|
||||||
media_attachments: { type: Sequelize.ARRAY(Sequelize.STRING) },
|
|
||||||
author: Sequelize.STRING,
|
author: Sequelize.STRING,
|
||||||
text: Sequelize.STRING
|
text: Sequelize.STRING
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user