Commit 759ac4e17c6749ee6349c852b746a7efe69464d3
call api for compose and publish, not inline those
Dominic Tarr committed on 12/17/2018, 12:23:17 AMParent: 4e75d0201015aed7c92fc519b8d58947f962d94f
Files changed
apis/thread.js | changed |
apis/thread.js | ||
---|---|---|
@@ -85,8 +85,9 @@ | ||
85 | 85 | and a datetime input, but it isn't widely supported. |
86 | 86 | so that kinda needs to be split between two fields. |
87 | 87 | */ |
88 | 88 | |
89 | +/* | |
89 | 90 | function Compose (id, meta) { |
90 | 91 | return h('form', {name: 'publish', method: 'POST'}, |
91 | 92 | //selected id to post from. this should |
92 | 93 | //be a dropdown, that only defaults to context.id |
@@ -110,13 +111,14 @@ | ||
110 | 111 | //be a dropdown, that defaults to context.id |
111 | 112 | //private threads should only allow changing |
112 | 113 | //id to a recipient, likes, follows etc should |
113 | 114 | //allow changing to any id you have. |
114 | - u.createHiddenInputs(opts), | |
115 | + u.createHiddenInputs(opts.content, 'content'), | |
115 | 116 | h('button', {type: 'submit', name: 'type', value:'preview'}, name), |
116 | 117 | ) |
117 | 118 | |
118 | 119 | } |
120 | +*/ | |
119 | 121 | |
120 | 122 | module.exports = function (opts) { |
121 | 123 | var sbot = this.sbot, api = this.api, context = this.context |
122 | 124 | var since = this.since |
@@ -158,23 +160,21 @@ | ||
158 | 160 | function (cb) { |
159 | 161 | backlinks(sbot, data.key, function (err, likes, backlinks) { |
160 | 162 | if(err) return cb(err) |
161 | 163 | 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 | |
173 | 174 | }, |
174 | - 'Yup' + (likes.length ? '('+likes.length+')' : '') | |
175 | - ), | |
176 | - //['button', 'yup', likes.length ? '('+likes.length+')' : ''], | |
175 | + name: 'Yup' + (likes.length ? '('+likes.length+')' : '') | |
176 | + }), | |
177 | 177 | (backlinks.length ? |
178 | 178 | ['ul.MessageBacklinks', |
179 | 179 | backlinks.map(function (e) { |
180 | 180 | return ['li', |
@@ -191,19 +191,19 @@ | ||
191 | 191 | } |
192 | 192 | ) |
193 | 193 | }) |
194 | 194 | ), |
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 | + } | |
200 | 202 | }) |
201 | 203 | ) |
202 | 204 | ) |
203 | 205 | }) |
204 | 206 | }) |
205 | 207 | } |
206 | 208 | } |
207 | 209 | |
208 | - | |
209 | - |
Built with git-ssb-web