From 1cf56bd06bcaffb7eb31690e8b8e859094b2538c Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Thu, 25 Feb 2016 18:40:19 -0800 Subject: [PATCH] added comment hash identifier --- app/talk.hoon | 9 +++++---- lib/time-to-id.hoon | 10 ++++++++++ mar/tree/comments.hoon | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 lib/time-to-id.hoon diff --git a/app/talk.hoon b/app/talk.hoon index 8b4e082ec..d1b49ecd0 100644 --- a/app/talk.hoon +++ b/app/talk.hoon @@ -3,7 +3,7 @@ :: :: :: /? 310 /- talk, sole -/+ talk, sole +/+ talk, sole, time-to-id /= seed /~ !>(.) :: :::: @@ -1303,14 +1303,15 @@ [our.hid %hood] [%write-comment pax src.hid txt] == - =+ =+(xap=(flop pax) ?~(xap nam="/" nam=)) + =+ =+(xap=(flop pax) ?~(xap nam="" nam=)) :: file name + =+ fra=(crip (time-to-id now.hid)) :: url fragment %+ ra-record (main our.hid) :^ src.hid (shaf %comt eny.hid) [[[%& our.hid (main our.hid)] *envelope %pending] ~ ~] :+ now.hid (sy /comment eyre+pax ~) :- %mor :~ - [%app %tree (crip "comment on {nam}")] - [%fat text+(lore txt) [%url [ra-base-hart `pax ~] ~]] + [%fat text+(lore txt) [%url [ra-base-hart `pax ~] `fra]] + [%app %tree (crip "comment on /{nam}")] == :: ++ ra-know :: story monad diff --git a/lib/time-to-id.hoon b/lib/time-to-id.hoon new file mode 100644 index 000000000..a0f2ee318 --- /dev/null +++ b/lib/time-to-id.hoon @@ -0,0 +1,10 @@ +:: Use lower bits of @da as hash identifier +:: +:::: /hoon/time-to-id/lib + :: +/? 310 +!: +:::: ~fyr + :: +|= a/time ^- tape +['c' (s-co:co f:(yell a))] diff --git a/mar/tree/comments.hoon b/mar/tree/comments.hoon index 1134ee7ac..7987e1a12 100644 --- a/mar/tree/comments.hoon +++ b/mar/tree/comments.hoon @@ -2,7 +2,7 @@ :::: /hoon/comments/tree/mar :: /? 310 -/+ react +/+ react, time-to-id !: :::: :: @@ -15,6 +15,7 @@ %+ turn (sort all |=({a/* b/*} (lor b a))) |= {a/time b/manx} ^- ^json + =. a.g.b [id+(time-to-id a) a.g.b] (jobe time+(jode a) body+(react-to-json:react b) ~) -- ++ grab |% :: convert from