Commit c81c05e4658be6e4d6da1fb5db9fd0f50033e6f9
disable publishing of empty blogs
mix irving committed on 2/14/2018, 12:35:16 AMParent: 140bd2aa4c9baa0075ccea378b2376a4c90cf8fc
Files changed
message/html/compose.js | changed |
message/html/compose.js | |||
---|---|---|---|
@@ -1,7 +1,8 @@ | |||
1 | 1 … | const nest = require('depnest') | |
2 | 2 … | const { h, when, send, resolve, Value, computed, map } = require('mutant') | |
3 | 3 … | const assign = require('lodash/assign') | |
4 … | +const isEmpty = require('lodash/isEmpty') | ||
4 | 5 … | const ssbMentions = require('ssb-mentions') | |
5 | 6 … | const addSuggest = require('suggest-box') | |
6 | 7 … | ||
7 | 8 … | exports.gives = nest('message.html.compose') | |
@@ -133,11 +134,15 @@ | |||
133 | 134 … | ||
134 | 135 … | // scoped | |
135 | 136 … | ||
136 | 137 … | function publish () { | |
137 | - publishBtn.disabled = true | ||
138 … | + if (publishBtn.disabled) return | ||
139 … | + | ||
138 | 140 … | const text = resolve(textRaw) | |
141 … | + if (isEmpty(text)) return | ||
139 | 142 … | ||
143 … | + publishBtn.disabled = true | ||
144 … | + | ||
140 | 145 … | const mentions = ssbMentions(text).map(mention => { | |
141 | 146 … | // merge markdown-detected mention with file info | |
142 | 147 … | var file = filesById[mention.link] | |
143 | 148 … | if (file) { |
Built with git-ssb-web