Commit 11dfd4e08a29a983a15b6c9caeff9000e6a55c20
use specific types for location and description, for the sake of code simplicity
Ev Bogue committed on 11/7/2017, 9:22:56 PMParent: a305bd92533b2caa80bd11f1508e5a975f5c140e
Files changed
client/modules/about.js | changed |
client/modules/avatar-profile.js | changed |
client/modules/edit.js | changed |
client/modules/about.js | ||
---|---|---|
@@ -25,23 +25,23 @@ | ||
25 | 25 … | }*/ |
26 | 26 … | |
27 | 27 … | |
28 | 28 … | exports.message_content_mini = function (msg) { |
29 | - if(msg.value.content.type == 'about') { | |
30 | - var about = msg.value.content | |
31 | - var id = msg.value.content.about | |
29 … | + var about = msg.value.content | |
30 … | + var id = msg.value.content.about | |
31 … | + if (msg.value.content.type == 'description') { | |
32 … | + return h('span', api.markdown('**Description:** ' + about.description)) | |
33 … | + } | |
34 … | + if (msg.value.content.type == 'loc') { | |
35 … | + return h('span', h('strong', 'Location: '), about.loc) | |
36 … | + } | |
37 … | + if (msg.value.content.type == 'about') { | |
32 | 38 … | if (msg.value.content.name) { |
33 | 39 … | return h('span', ' identifies as ', about.name) |
34 | 40 … | } |
35 | 41 … | if (msg.value.content.image) { |
36 | 42 … | return h('span', ' identifies as ', h('img.avatar--thumbnail', {src: api.blob_url(about.image)})) |
37 | 43 … | } |
38 | - if (msg.value.content.loc) { | |
39 | - return h('span', h('strong', 'Location: '), about.loc) | |
40 | - } | |
41 | - if (msg.value.content.description) { | |
42 | - return h('span', api.markdown('**Description:** ' + about.description)) | |
43 | - } else { return } | |
44 | - } | |
44 … | + } else { return } | |
45 | 45 … | } |
46 | 46 … | return exports |
47 | 47 … | } |
client/modules/avatar-profile.js | ||
---|---|---|
@@ -25,16 +25,16 @@ | ||
25 | 25 … | if (id == self_id.id) { |
26 | 26 … | edit = h('p', h('a', {href: '#Edit'}, h('button.btn.btn-primary', 'Edit profile'))) |
27 | 27 … | } else { edit = api.avatar_action(id)} |
28 | 28 … | |
29 | - pull(api.sbot_query({query: [{$filter: { value: { author: id, content: {type: 'about', loc: {"$truthy": true}}}}}], limit: 5, reverse: true}), | |
29 … | + pull(api.sbot_query({query: [{$filter: { value: { author: id, content: {type: 'location'}}}}], limit: 1, reverse: true}), | |
30 | 30 … | pull.drain(function (data){ |
31 | 31 … | if(data.value.content.loc) { |
32 | 32 … | loco.appendChild(h('span', h('strong', 'Location: '), data.value.content.loc)) |
33 | 33 … | } |
34 | 34 … | })) |
35 | 35 … | |
36 | - pull(api.sbot_query({query: [{$filter: { value: { author: id, content: {type: 'about', description: {"$truthy": true}}}}}], limit: 5, reverse: true}), | |
36 … | + pull(api.sbot_query({query: [{$filter: { value: { author: id, content: {type: 'description'}}}}], limit: 1, reverse: true}), | |
37 | 37 … | pull.drain(function (data){ |
38 | 38 … | if(data.value.content.description) { |
39 | 39 … | description.appendChild(h('span', h('strong', 'Description: '), data.value.content.description)) |
40 | 40 … | } |
client/modules/edit.js | ||
---|---|---|
@@ -43,9 +43,9 @@ | ||
43 | 43 … | locInput, |
44 | 44 … | h('button.btn.btn-primary', 'Preview', {onclick: function () { |
45 | 45 … | if(locInput.value) { |
46 | 46 … | api.message_confirm({ |
47 | - type: 'about', | |
47 … | + type: 'loc', | |
48 | 48 … | about: id, |
49 | 49 … | loc: locInput.value || undefined |
50 | 50 … | }) |
51 | 51 … | } |
@@ -54,9 +54,9 @@ | ||
54 | 54 … | descInput, |
55 | 55 … | h('button.btn.btn-primary', 'Preview', {onclick: function (){ |
56 | 56 … | if(descInput.value) { |
57 | 57 … | api.message_confirm({ |
58 | - type: 'about', | |
58 … | + type: 'description', | |
59 | 59 … | about: id, |
60 | 60 … | description: descInput.value || undefined |
61 | 61 … | }) |
62 | 62 … | } |
Built with git-ssb-web