Moderation Ui
This commit is contained in:
parent
e5a84e2147
commit
0455c763fd
3 changed files with 84 additions and 5 deletions
28
index.js
28
index.js
|
@ -262,6 +262,25 @@ app.get('/stats', async (req, res, next) => {
|
|||
}
|
||||
})
|
||||
|
||||
app.get('/moddata', async (req, res, next) => {
|
||||
try {
|
||||
console.log(req.query)
|
||||
console.log(req.query.name)
|
||||
console.log(apex.utils.usernameToIRI('test'))
|
||||
console.log(await apex.utils.usernameToIRI('test'))
|
||||
var object = await apex.store.getObject(apex.utils.usernameToIRI(req.query.name))
|
||||
console.log(object)
|
||||
console.log(object.id)
|
||||
console.log("test")
|
||||
const queueSize = await apex.store.db.collection(`${object.id}-queue`).find().toArray()
|
||||
// console.log(res.json({queueSize}))
|
||||
console.log(queueSize)
|
||||
res.json(queueSize)
|
||||
} catch (err) {
|
||||
next(err)
|
||||
}
|
||||
})
|
||||
|
||||
app.use(function (err, req, res, next) {
|
||||
console.error(err.message, req.body, err.stack)
|
||||
if (!res.headersSent) {
|
||||
|
@ -286,11 +305,10 @@ client.connect()
|
|||
await apex.store.saveObject(systemUser)
|
||||
apex.systemUser = systemUser
|
||||
}
|
||||
apex.systemUser = await apex.store.getObject(apex.utils.usernameToIRI('testing'), true)
|
||||
if (!apex.systemUser) {
|
||||
const systemUser = await createGuppeActor('test', 'test', 'A project built on guppe groups\, it features a moderation ui', icon, 'Group')
|
||||
await apex.store.saveObject(systemUser)
|
||||
apex.systemUser = systemUser
|
||||
apex.group = await apex.store.getObject(apex.utils.usernameToIRI('testing'), true)
|
||||
if (!apex.group) {
|
||||
const group = await createGuppeActor('test', 'test', 'A project built on guppe groups\, it features a moderation ui', icon, 'Group')
|
||||
await apex.store.saveObject(group)
|
||||
}
|
||||
let server
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
|
|
|
@ -2,6 +2,7 @@ import Vue from 'vue'
|
|||
import Router from 'vue-router'
|
||||
import Home from './views/Home.vue'
|
||||
import Profile from './views/Profile.vue'
|
||||
import Moderation from './views/Moderation.vue'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
|
@ -18,6 +19,12 @@ export default new Router({
|
|||
name: 'profile',
|
||||
component: Profile,
|
||||
props: true
|
||||
},
|
||||
{
|
||||
path: '/mod/:name',
|
||||
name: 'moderation',
|
||||
component: Moderation,
|
||||
props: true
|
||||
}
|
||||
],
|
||||
scrollBehavior (to, from, savedPosition) {
|
||||
|
|
54
web/src/views/Moderation.vue
Normal file
54
web/src/views/Moderation.vue
Normal file
|
@ -0,0 +1,54 @@
|
|||
<template>
|
||||
<div class="w3-container">
|
||||
<h1>Moderation for {{name}} </h1>
|
||||
<ul style="list-style-type:none;">
|
||||
<li v-for="item in queue">
|
||||
<a :href="item.object[0]" target="_blank">{{ item.object[0] }}</a>
|
||||
<a class="approve" :href="item.object[0]" target="_blank">Approve</a>
|
||||
<a class="approve" :href="item.object[0]" target="_blank">Deny</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'home',
|
||||
components: {},
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
queue: [],
|
||||
error: null,
|
||||
name: this.name,
|
||||
domain: window.location.host
|
||||
}
|
||||
},
|
||||
created () {
|
||||
window.fetch(`/moddata?name=${this.name}`, {
|
||||
method: 'get',
|
||||
headers: {
|
||||
accept: 'application/json'
|
||||
}
|
||||
}).then(res => res.json())
|
||||
.then(json => {
|
||||
console.log("test2")
|
||||
console.log(json)
|
||||
this.queue = json
|
||||
})
|
||||
.catch(err => (this.error = err.message))
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
a.approve {
|
||||
float:right;
|
||||
}
|
||||
</style>
|
Loading…
Reference in a new issue