[STABLE] Pass all message creation (even local messages) through the message lexer/parser for validation.
This commit is contained in:
parent
8df1336702
commit
58926b4c68
|
@ -51,6 +51,7 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
|
|||
- [X] refactor `Bundle.create` to use `message find-all`.
|
||||
- [X] Rename `message find` to `message read`, since other finders return a multihash.
|
||||
- [ ] Message.ingest should be the only code path to message authoring.
|
||||
- [ ] Make all methods private except those required for the CLI.
|
||||
- [ ] Don't allow any type of whitespace in `kind` or `string` keys. Write a test for this.
|
||||
- [ ] Add Lipmaa links like the Bamboo folks do.
|
||||
- [ ] Create regexes in ::Lexer using strings and Regexp.new() for cleaner regexes.
|
||||
|
|
|
@ -61,12 +61,11 @@ module Pigeon
|
|||
|
||||
# Author a new message.
|
||||
def publish
|
||||
count = store.get_message_count_for(author) - 1
|
||||
template = MessageSerializer.new(self)
|
||||
|
||||
@author = LocalIdentity.current
|
||||
@prev = store.get_message_by_depth(author.multihash, count)
|
||||
@depth = store.get_message_count_for(author.multihash)
|
||||
@prev = store.get_message_by_depth(author.multihash, @depth - 1)
|
||||
@signature = author.sign(template.render_without_signature)
|
||||
|
||||
candidate = template.render
|
||||
|
|
|
@ -144,8 +144,7 @@ RSpec.describe Pigeon::Message do
|
|||
kind[rand(0...8)] = n
|
||||
draft = Pigeon::Draft.create(kind: kind)
|
||||
draft["body"] = "empty"
|
||||
tpl = draft.publish.render
|
||||
boom = ->() { Pigeon::Lexer.tokenize(tpl) }
|
||||
boom = ->() { Pigeon::Lexer.tokenize(draft.publish.render) }
|
||||
expect(boom).to raise_error(Pigeon::Lexer::LexError)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue