git ssb

3+

ev / decent



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 PM
Parent: a305bd92533b2caa80bd11f1508e5a975f5c140e

Files changed

client/modules/about.jschanged
client/modules/avatar-profile.jschanged
client/modules/edit.jschanged
client/modules/about.jsView
@@ -25,23 +25,23 @@
2525 }*/
2626
2727
2828 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') {
3238 if (msg.value.content.name) {
3339 return h('span', ' identifies as ', about.name)
3440 }
3541 if (msg.value.content.image) {
3642 return h('span', ' identifies as ', h('img.avatar--thumbnail', {src: api.blob_url(about.image)}))
3743 }
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 }
4545 }
4646 return exports
4747 }
client/modules/avatar-profile.jsView
@@ -25,16 +25,16 @@
2525 if (id == self_id.id) {
2626 edit = h('p', h('a', {href: '#Edit'}, h('button.btn.btn-primary', 'Edit profile')))
2727 } else { edit = api.avatar_action(id)}
2828
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}),
3030 pull.drain(function (data){
3131 if(data.value.content.loc) {
3232 loco.appendChild(h('span', h('strong', 'Location: '), data.value.content.loc))
3333 }
3434 }))
3535
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}),
3737 pull.drain(function (data){
3838 if(data.value.content.description) {
3939 description.appendChild(h('span', h('strong', 'Description: '), data.value.content.description))
4040 }
client/modules/edit.jsView
@@ -43,9 +43,9 @@
4343 locInput,
4444 h('button.btn.btn-primary', 'Preview', {onclick: function () {
4545 if(locInput.value) {
4646 api.message_confirm({
47- type: 'about',
47 + type: 'loc',
4848 about: id,
4949 loc: locInput.value || undefined
5050 })
5151 }
@@ -54,9 +54,9 @@
5454 descInput,
5555 h('button.btn.btn-primary', 'Preview', {onclick: function (){
5656 if(descInput.value) {
5757 api.message_confirm({
58- type: 'about',
58 + type: 'description',
5959 about: id,
6060 description: descInput.value || undefined
6161 })
6262 }

Built with git-ssb-web