summaryrefslogtreecommitdiff
path: root/demo/components/moderation.js
diff options
context:
space:
mode:
authortheia2023-02-03 15:59:52 -0500
committertheia2023-02-03 15:59:52 -0500
commit655434fa06bc6fdaffd44bb62b532283aefa789a (patch)
tree80260e95fdd786650609cbf0c90327e2ee912abc /demo/components/moderation.js
parent010cd54018c3079b240cc3c679c7378482452e42 (diff)
Added moderation
Diffstat (limited to 'demo/components/moderation.js')
-rw-r--r--demo/components/moderation.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/demo/components/moderation.js b/demo/components/moderation.js
new file mode 100644
index 0000000..8ba4e98
--- /dev/null
+++ b/demo/components/moderation.js
@@ -0,0 +1,36 @@
+import Chat from './chat.js'
+import LikeButton from './like-button.js'
+
+export default {
+
+ data: ()=> ({
+ likeThreshold: 0,
+ channel: 'demo'
+ }),
+
+ methods: {
+ messageObjects: Chat.methods.messageObjects,
+ likeObjects: LikeButton.methods.likeObjects,
+ },
+
+ template: `
+ <p>
+ Chat Channel: <input v-model="channel"/>
+ </p>
+
+ <p>
+ Only show me objects with more than <input v-model.number="likeThreshold"/> likes.
+ </p>
+
+ <graffiti-objects :tags="[channel]" v-slot="{objects}">
+ <ul v-for="object in messageObjects(objects)">
+ <graffiti-objects :tags="[object._id]" v-slot="{objects: responses}">
+ <li v-if="likeObjects(responses, object._id).length >= likeThreshold">
+ <em><Name :of="object._by"/></em>:
+ {{ object.message }}
+ </li>
+ </graffiti-objects>
+ </ul>
+ </graffiti-objects>`
+}
+