git ssb

10+

Matt McKegg / patchwork



Commit 77570f8a228dbe5f1d398a92623d4c25675654ec

preview profile/description change

fixes #479
Matt McKegg committed on 5/25/2018, 11:54:33 PM
Parent: a9fe8868dd71da9e2f16834cdf26233521d56798

Files changed

locales/en.jsonchanged
modules/profile/sheet/edit.jschanged
locales/en.jsonView
@@ -193,6 +193,7 @@
193193 "Choose Banner Image...": "Choose Banner Image...",
194194 "Describe the gathering (if you want)": "Describe the gathering (if you want)",
195195 "Create Gathering": "Create Gathering",
196196 "liked": "liked",
197- "(missing message)": "(missing message)"
197 + "(missing message)": "(missing message)",
198 + "Cannot display message.": "Cannot display message."
198199 }
modules/profile/sheet/edit.jsView
@@ -7,9 +7,9 @@
77
88 exports.needs = nest({
99 'sheet.display': 'first',
1010 'keys.sync.id': 'first',
11- 'sbot.async.publish': 'first',
11 + 'message.async.publish': 'first',
1212 'about.obs': {
1313 name: 'first',
1414 description: 'first',
1515 image: 'first',
@@ -66,12 +66,14 @@
6666 ])
6767 ]),
6868 h('div.main', [
6969 h('input.name', {
70 + 'disabled': publishing,
7071 placeholder: i18n('Choose a name'),
7172 hooks: [ValueHook(chosenName), FocusHook()]
7273 }),
7374 h('textarea.description', {
75 + 'disabled': publishing,
7476 placeholder: i18n('Describe yourself (if you want)'),
7577 hooks: [ValueHook(chosenDescription)]
7678 })
7779 ])
@@ -82,8 +84,9 @@
8284 'ev-click': save,
8385 'disabled': publishing
8486 }, when(publishing, i18n('Publishing...'), i18n('Publish'))),
8587 h('button -cancel', {
88 + 'disabled': publishing,
8689 'ev-click': close
8790 }, i18n('Cancel'))
8891 ]
8992 }
@@ -98,22 +101,25 @@
98101 if (chosenDescription() !== currentDescription()) update.description = chosenDescription()
99102
100103 if (Object.keys(update).length) {
101104 publishing.set(true)
102- api.sbot.async.publish(extend({
105 +
106 + // confirm publish
107 + api.message.async.publish(extend({
103108 type: 'about',
104109 about: id
105- }, update), (err) => {
110 + }, update), (err, msg) => {
111 + publishing.set(false)
106112 if (err) {
107- publishing.set(false)
108113 showDialog({
109114 type: 'error',
110115 title: i18n('Error'),
111116 buttons: [i18n('OK')],
112117 message: i18n('An error occurred while attempting to publish about message.'),
113118 detail: err.message
114119 })
115- } else {
120 + } else if (msg) {
121 + // user confirmed publish, so close the dialog
116122 close()
117123 }
118124 })
119125 } else {

Built with git-ssb-web