git ssb

0+

Piet / ssb-loomio



Commit 14e118e9daffeaae72c39c493c18827986a23ee6

Use schema version constant rather than magic string

Piet Geursen committed on 3/15/2018, 9:16:47 PM
Parent: 5a278075ec43325cf000c2fcb66c71b38a75df86

Files changed

poll/sync/poll.jschanged
position/async/position.jschanged
types.jschanged
poll/sync/poll.jsView
@@ -1,8 +1,9 @@
11 // var { link } = require('ssb-msg-schemas/util')
2+const {SCHEMA_VERSION} = require('../../types')
23
34 function Poll ({ details, title, closesAt, body, channel, recps, mentions }) {
4- var content = { type: 'poll', details, title, closesAt, version: 'v1' }
5+ var content = { type: 'poll', details, title, closesAt, version: SCHEMA_VERSION }
56
67 if (body) content.body = body
78
89 // if (root) {
position/async/position.jsView
@@ -1,6 +1,8 @@
1+const sort = require('ssb-sort')
2+
13 const GetPoll = require('../../poll/async/get')
2-const sort = require('ssb-sort')
4+const {SCHEMA_VERSION} = require('../../types')
35 // var { link } = require('ssb-msg-schemas/util')
46 //
57
68 module.exports = function (server) {
@@ -8,9 +10,9 @@
810
911 return function Position ({ poll = {}, details, reason, channel, mentions }, cb) {
1012 const content = {
1113 type: 'position',
12- version: 'v1',
14+ version: SCHEMA_VERSION,
1315 root: typeof poll === 'string' ? poll : poll.key,
1416 details
1517 }
1618
types.jsView
@@ -1,9 +1,10 @@
11 module.exports = {
22 CHOOSE_ONE: 'chooseOne',
33 ERROR_POSITION_TYPE: 'ERROR_POSITION_TYPE',
44 ERROR_POSITION_LATE: 'ERROR_POSITION_LATE',
5- ERROR_POSITION_CHOICE: 'ERROR_POSITION_CHOICE'
5+ ERROR_POSITION_CHOICE: 'ERROR_POSITION_CHOICE',
6+ SCHEMA_VERSION: 'v1'
67 }
78
89 // Question: do these need to be different, could we just have 'chooseOne',
910 // because we already have:

Built with git-ssb-web