git ssb

16+

Dominic / patchbay



Commit 19f35e2c94a94cff5dd05b17e542ca140e76edd5

Only show viewers toggle on own profile

Anders Rune Jensen committed on 8/23/2018, 10:45:54 PM
Parent: 12159b81d351d1a871b5da6f49b9831a3ad151e2

Files changed

about/html/edit.jschanged
about/html/edit.jsView
@@ -39,8 +39,10 @@
3939 // TODO refactor this to use obs better
4040 function edit (id) {
4141 // TODO - get this to wait till the connection is present !
4242
43 + var isMe = api.keys.sync.id() === id
44 +
4345 var avatar = Struct({
4446 current: api.about.obs.imageUrl(id),
4547 new: Dict()
4648 })
@@ -68,15 +70,15 @@
6870 var names = dictToCollection(namesRecord)
6971
7072 var publicWebHosting = Struct({
7173 current: api.about.obs.latestValue(id, 'publicWebHosting'),
72- new: Value()
74 + new: Value(api.about.obs.latestValue(id, 'publicWebHosting')())
7375 })
7476
7577 var lightbox = hyperlightbox()
7678
7779 var isPossibleUpdate = computed([name.new, avatar.new, publicWebHosting.new], (name, avatar, publicWebHostingValue) => {
78- return name || avatar.link || publicWebHostingValue != publicWebHosting.current()
80 + return name || avatar.link || (isMe && publicWebHostingValue !== publicWebHosting.current())
7981 })
8082
8183 var avatarSrc = computed([avatar], avatar => {
8284 if (avatar.new.link) return api.blob.sync.url(avatar.new.link)
@@ -139,19 +141,20 @@
139141 'ev-keyup': e => name.new.set(e.target.value)
140142 })
141143 ])
142144 ]),
143- h('section.viewer', [
144- h('header', 'Public viewers'),
145- h('section', [
146- h('span', 'Show my posts on public viewers'),
147- h('input', {
148- type: 'checkbox',
149- checked: publicWebHosting.current,
150- 'ev-change': e => publicWebHosting.new.set(e.target.checked)
151- })
152- ])
153- ]),
145 + isMe
146 + ? h('section.viewer', [
147 + h('header', 'Public viewers'),
148 + h('section', [
149 + h('span', 'Show my posts on public viewers'),
150 + h('input', {
151 + type: 'checkbox',
152 + checked: publicWebHosting.current,
153 + 'ev-change': e => publicWebHosting.new.set(e.target.checked)
154 + })
155 + ])
156 + ]) : '',
154157 when(isPossibleUpdate, h('section.action', [
155158 h('button.cancel', { 'ev-click': clearNewSelections }, 'cancel'),
156159 h('button.confirm', { 'ev-click': handleUpdateClick }, 'confirm changes')
157160 ]))
@@ -231,9 +234,9 @@
231234 }
232235
233236 if (newName) msg.name = newName
234237 if (newAvatar.link) msg.image = newAvatar
235- if (publicWebHosting.new() != publicWebHosting.current()) msg.publicWebHosting = publicWebHosting.new()
238 + if (publicWebHosting.new() !== publicWebHosting.current()) msg.publicWebHosting = publicWebHosting.new()
236239
237240 api.message.html.confirm(msg, (err, data) => {
238241 if (err) return console.error(err)
239242

Built with git-ssb-web