git ssb

0+

dangerousbeans / yap



forked from Dominic / yap

Commit 759ac4e17c6749ee6349c852b746a7efe69464d3

call api for compose and publish, not inline those

Dominic Tarr committed on 12/17/2018, 12:23:17 AM
Parent: 4e75d0201015aed7c92fc519b8d58947f962d94f

Files changed

apis/thread.jschanged
apis/thread.jsView
@@ -85,8 +85,9 @@
8585 and a datetime input, but it isn't widely supported.
8686 so that kinda needs to be split between two fields.
8787 */
8888
89+/*
8990 function Compose (id, meta) {
9091 return h('form', {name: 'publish', method: 'POST'},
9192 //selected id to post from. this should
9293 //be a dropdown, that only defaults to context.id
@@ -110,13 +111,14 @@
110111 //be a dropdown, that defaults to context.id
111112 //private threads should only allow changing
112113 //id to a recipient, likes, follows etc should
113114 //allow changing to any id you have.
114- u.createHiddenInputs(opts),
115+ u.createHiddenInputs(opts.content, 'content'),
115116 h('button', {type: 'submit', name: 'type', value:'preview'}, name),
116117 )
117118
118119 }
120+*/
119121
120122 module.exports = function (opts) {
121123 var sbot = this.sbot, api = this.api, context = this.context
122124 var since = this.since
@@ -158,23 +160,21 @@
158160 function (cb) {
159161 backlinks(sbot, data.key, function (err, likes, backlinks) {
160162 if(err) return cb(err)
161163 cb(null, ['div.MessageExtra',
162- Publish({
163- id: context.id,
164- suggestedRecps: data.value.author,
165- content: {
166- type: 'vote',
167- vote: {
168- link:data.key, value: 1,
169- expression: 'Yup'
170- },
171- channel: data.value.content.channel
172- }
164+ api('publish', {
165+ id: context.id,
166+ suggestedRecps: data.value.author,
167+ content: {
168+ type: 'vote',
169+ vote: {
170+ link:data.key, value: 1,
171+ expression: 'Yup'
172+ },
173+ channel: data.value.content.channel
173174 },
174- 'Yup' + (likes.length ? '('+likes.length+')' : '')
175- ),
176- //['button', 'yup', likes.length ? '('+likes.length+')' : ''],
175+ name: 'Yup' + (likes.length ? '('+likes.length+')' : '')
176+ }),
177177 (backlinks.length ?
178178 ['ul.MessageBacklinks',
179179 backlinks.map(function (e) {
180180 return ['li',
@@ -191,19 +191,19 @@
191191 }
192192 )
193193 })
194194 ),
195- Compose(context.id, {
196- type: 'post',
197- root: opts.id,
198- recps: uniqueRecps(ary[0].value.content.recps),
199- branch: sort.heads(ary)
195+ api('compose', {
196+ content: {
197+ type: 'post',
198+ root: opts.id,
199+ recps: uniqueRecps(ary[0].value.content.recps),
200+ branch: sort.heads(ary)
201+ }
200202 })
201203 )
202204 )
203205 })
204206 })
205207 }
206208 }
207209
208-
209-

Built with git-ssb-web