summaryrefslogtreecommitdiff
path: root/demo/components/moderation.js
blob: 8ba4e9871774d74ade7f3f6613589165e61b3f5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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>`
}