From 0455c763fdea93860eb6082bd1ac2d5abadb6694 Mon Sep 17 00:00:00 2001 From: insert Date: Thu, 17 Aug 2023 16:21:41 -0400 Subject: [PATCH] Moderation Ui --- index.js | 28 +++++++++++++++---- web/src/router.js | 7 +++++ web/src/views/Moderation.vue | 54 ++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 web/src/views/Moderation.vue diff --git a/index.js b/index.js index 0f09ab4..677457e 100644 --- a/index.js +++ b/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') { diff --git a/web/src/router.js b/web/src/router.js index 4e519c4..08bd77e 100644 --- a/web/src/router.js +++ b/web/src/router.js @@ -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) { diff --git a/web/src/views/Moderation.vue b/web/src/views/Moderation.vue new file mode 100644 index 0000000..97ba8df --- /dev/null +++ b/web/src/views/Moderation.vue @@ -0,0 +1,54 @@ + + + + + \ No newline at end of file