1
0
mirror of git://jb55.com/damus synced 2024-09-18 19:23:49 +00:00
Commit Graph

29 Commits

Author SHA1 Message Date
Grimless
f6f7d13f12 Properly implement top-level tests and fix one test using the wrong Block conversion property
Closes: https://github.com/damus-io/damus/pull/1528
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:32 -07:00
Grimless
6ee0be40e9 Create helper extensions for Block and update tests for the Block helper model
Closes: https://github.com/damus-io/damus/pull/1528
Signed-off-by: William Casarin <jb55@jb55.com>
2023-09-03 18:02:32 -07:00
Jon Marrs
dd29e87146 test: pass keypair instead of privkey for test cases
Tests were not building due to recent changes in the Damus source code that replaced privkey with keypair. This patch extends those changes to the test cases, allowing the tests to build and pass.

Signed-off-by: Jon Marrs <jdmarrs@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-31 08:52:28 -07:00
William Casarin
cf3a9a576d test: move existing url tests to UrlTests 2023-08-06 13:50:20 -07:00
William Casarin
cebd1f48ca ndb: switch to nostrdb notes
This is a refactor of the codebase to use a more memory-efficient
representation of notes. It should also be much faster at decoding since
we're using a custom C json parser now.

Changelog-Changed: Improved memory usage and performance when processing events
2023-08-03 13:20:36 -07:00
William Casarin
2f8aa29e92 ndb: make NostrEvents immutable
Since we can't mutate NdbNotes, let's update the existing codebase to
generate and sign ids on NostrEvent constructions. This will allow us to
match NdbNote's constructor
2023-07-25 15:34:05 -07:00
William Casarin
ff70cb7ebf posting: don't prepad user tag if its a newline
This fixes one more edgecase with the tag prepend logic.
2023-07-17 10:45:05 -07:00
William Casarin
60a0c21272 test: add post composition tests
This adds post composition tests so that we can avoid composition bugs.
This still does not capture all of the dynamics of post composition,
because it ignores much of the mutable cursor position and related state
when editing posts.

We will need to make post editing more pure and less mutable in the
future to get test coverage on those.
2023-07-17 10:25:09 -07:00
William Casarin
fd59407171 test: fix old markdown tests 2023-07-17 10:25:09 -07:00
William Casarin
0c95071de7 project: rename parse_mentions to parse_note_content
This is more accurate
2023-07-16 11:46:23 -07:00
William Casarin
139be9eef2 Fix nostr: mention prefix bugs
The zero-width space was causing parsing issues. Not sure why we need
this so I just removed it.

Changelog-Fixed: Fix nostr:nostr:... bugs
2023-07-14 17:28:24 -07:00
William Casarin
7fc270725f test: add newline mention test
This is currently passing but it shouldn't be. This is because we are
not testing the build_post function directly. We will do this soon.
2023-07-13 07:32:27 -07:00
William Casarin
db2ec0a00a Fix npub mention bugs, fix slowness when parsing large posts
Switch the post parser to use the same code as the content parser. This
was causing many issues, including performance issues.

Changelog-Fixed: Fix lag when creating large posts
Changelog-Fixed: Fix npub mentions failing to parse in some cases
Changelog-Added: Add r tag when mentioning a url
Changelog-Removed: Remove old @ and & hex key mentions
2023-07-11 09:15:13 -07:00
William Casarin
374610a21a artifacts: allow unseparated note artifacts
This is needed for longform events. Right now we treat unseparated note
artifacts as a list of blocks, but we will likely need to render these
blocks into lists of attributed texts with image blocks inbetween.
2023-07-10 18:24:43 -07:00
Terry Yiu
14977fe3dd Replace indexed mentions with NIP-27
Changelog-Fixed: Replace indexed mentions with NIP-27
Closes: #1213
2023-06-07 06:22:38 +02:00
William Casarin
e8d63768c1 Fix note mention test 2023-04-11 10:27:11 -07:00
William Casarin
0866c70346 Fix tests 2023-04-10 16:09:43 -07:00
Pablo Fernandez
205774f684 Fix when calling parse_hex_char out of bounds
Closes: #158
Changelog-Fixed: Fix crash with @ sign in some posts
2022-12-28 12:44:47 -08:00
William Casarin
c6ab1de639 Add bolt11 parser and Invoice View
Changelog-Added: Display bolt11 invoice widgets on posts
2022-10-19 07:46:05 -07:00
William Casarin
eb99e6c323 Rewrite note parsing in C
This eliminates any parsing choppyness

Fixes: #32
Signed-off-by: William Casarin <jb55@jb55.com>
2022-10-17 15:22:28 -07:00
William Casarin
a47645929e Inline image loading
Changelog-Added: Added inline image loading
Signed-off-by: William Casarin <jb55@jb55.com>
2022-10-16 16:11:27 -07:00
William Casarin
df5d6557f2 add link test
Signed-off-by: William Casarin <jb55@jb55.com>
2022-08-07 19:31:02 -07:00
William Casarin
61f5d1009e mentions: fix bech32 mentions at end
Signed-off-by: William Casarin <jb55@jb55.com>
2022-08-07 07:09:11 -07:00
William Casarin
adacdbb764 switch to bech32 everywhere
You can now use @npub, @note or @nsec to reference notes and pubkeys

Changelog-Changed: use bech32 ids everywhere
Signed-off-by: William Casarin <jb55@jb55.com>
2022-08-06 23:01:56 -07:00
William Casarin
e6db7369cd Fix hashtag parsing
Changelog-Fixed: No longer parse hashtags in urls
Signed-off-by: William Casarin <jb55@jb55.com>
2022-07-28 13:11:58 -07:00
William Casarin
2fc6e7ef22 fix parsing mention indices > 9
Signed-off-by: William Casarin <jb55@jb55.com>
2022-06-06 08:55:32 -07:00
William Casarin
cf7cba09bd parse hashtags
Signed-off-by: William Casarin <jb55@jb55.com>
2022-05-08 20:34:57 -07:00
William Casarin
812abba8d4 fix incredible bug lol
Signed-off-by: William Casarin <jb55@jb55.com>
2022-05-08 19:31:40 -07:00
William Casarin
5e63eca0e9 simplify like refs
Signed-off-by: William Casarin <jb55@jb55.com>
2022-05-08 19:01:42 -07:00