git ssb

7+

dinoworm 🐛 / patchcore



Commit 8261134eb7daa7f16ad7f83ebb1549e60b37b70d

add obs_about_image_url

Matt McKegg committed on 2/13/2017, 9:31:42 AM
Parent: b58dd46b8f88f0917c480faf8286bdd209933739

Files changed

observables/about.jschanged
observables/about.jsView
@@ -1,22 +1,33 @@
1-var {Value, Struct} = require('mutant')
1 +var {Value, Struct, computed} = require('mutant')
22 var Abortable = require('pull-abortable')
33 var pull = require('pull-stream')
4 +var msgs = require('ssb-msgs')
45
56 exports.needs = {
6- sbot_user_feed: 'first'
7 + sbot_user_feed: 'first',
8 + blob_url: 'first'
79 }
810 exports.gives = {
911 obs_about_name: true,
10- obs_about_image: true
12 + obs_about_image: true,
13 + obs_about_image_url: true
1114 }
1215
1316 exports.create = function (api) {
1417 var cache = {}
1518
1619 return {
1720 obs_about_name: (id) => get(id).displayName,
18- obs_about_image: (id) => get(id).image
21 + obs_about_image: (id) => get(id).image,
22 + obs_about_image_url: (id) => {
23 + return computed(get(id).image, (image) => {
24 + var obj = msgs.link(image, 'blob')
25 + if (obj) {
26 + return api.blob_url(obj.link)
27 + }
28 + })
29 + }
1930 }
2031
2132 function get (id) {
2233 if (!cache[id]) {

Built with git-ssb-web