git ssb

10+

Matt McKegg / patchwork



Commit 439b2fd655c4e2b043b509caf646206a3e60f528

display error on publish when message is too large

#456 #603 #640
Matt McKegg committed on 10/18/2017, 2:28:32 AM
Parent: 957964085af70face2c01919aba9f5032f4fdd8f

Files changed

locales/en.jsonchanged
modules/message/html/compose.jschanged
locales/en.jsonView
@@ -169,6 +169,7 @@
169169 "Blocked by": "Blocked by",
170170 "However, this person should be able to see your posts.": "However, this person should be able to see your posts.",
171171 "However, since they follow someone that follows you, they should be able to see your posts.": "However, since they follow someone that follows you, they should be able to see your posts.",
172172 "They might not be able to see your posts either.": "They might not be able to see your posts either.",
173- "However, since you follow someone that follows them, you should be able to see their latest posts.": "However, since you follow someone that follows them, you should be able to see their latest posts."
173+ "However, since you follow someone that follows them, you should be able to see their latest posts.": "However, since you follow someone that follows them, you should be able to see their latest posts.",
174+ "An error occured while publishing your message.": "An error occured while publishing your message."
174175 }
modules/message/html/compose.jsView
@@ -180,20 +180,35 @@
180180 if (typeof prepublish === 'function') {
181181 content = prepublish(content)
182182 }
183183 } catch (err) {
184- publishing.set(false)
185- if (cb) cb(err)
186- else throw err
184+ return done(err)
187185 }
188186
189187 return api.message.async.publish(content, done)
190188
191189 function done (err, msg) {
192190 publishing.set(false)
193- if (err) throw err
194- else if (msg) textArea.value = ''
195- if (cb) cb(err, msg)
191+ if (err) {
192+ if (cb) cb(err)
193+ else {
194+ showDialog({
195+ type: 'error',
196+ title: i18n('Error'),
197+ buttons: [i18n('OK')],
198+ message: i18n('An error occured while publishing your message.'),
199+ detail: err.message
200+ })
201+ }
202+ } else {
203+ textArea.value = ''
204+ if (cb) cb(null, msg)
205+ }
196206 }
197207 }
198208 })
199209 }
210+
211+function showDialog (opts) {
212+ var electron = require('electron')
213+ electron.remote.dialog.showMessageBox(electron.remote.getCurrentWindow(), opts)
214+}

Built with git-ssb-web