From 3c96e17c8445813366f8ba37cba21db8681936ef Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Fri, 15 Nov 2024 08:52:13 +0100 Subject: [PATCH] fix: In realm code, use txlink.URL (#138) * fix: In realm code, use txlink.URL. See the PR. Signed-off-by: Jeff Thompson --------- Signed-off-by: Jeff Thompson --- realm/post.gno | 29 ++++++++++++++--------------- realm/userposts.gno | 13 +++++-------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/realm/post.gno b/realm/post.gno index 53d996d6..9cdb2702 100644 --- a/realm/post.gno +++ b/realm/post.gno @@ -8,6 +8,7 @@ import ( "gno.land/p/demo/avl" "gno.land/p/demo/ufmt" + "gno.land/p/moul/txlink" ) var debugNowOffset time.Duration @@ -182,27 +183,25 @@ func (post *Post) GetURL() string { } func (post *Post) GetGnodFormURL() string { - return "/r/berty/social?help&__func=AddReaction" + - "&userPostsAddr=" + post.userPosts.userAddr.String() + - "&threadid=" + post.threadID.String() + - "&postid=" + post.id.String() + - "&reaction=" + strconv.Itoa(int(Gnod)) + return txlink.URL("AddReaction", + "userPostsAddr", post.userPosts.userAddr.String(), + "threadid", post.threadID.String(), + "postid", post.id.String(), + "reaction", strconv.Itoa(int(Gnod))) } func (post *Post) GetReplyFormURL() string { - return "/r/berty/social?help&__func=PostReply" + - "&userPostsAddr=" + post.userPosts.userAddr.String() + - "&threadid=" + post.threadID.String() + - "&postid=" + post.id.String() + - "&comment.type=textarea" + return txlink.URL("PostReply", + "userPostsAddr", post.userPosts.userAddr.String(), + "threadid", post.threadID.String(), + "postid", post.id.String()) } func (post *Post) GetRepostFormURL() string { - return "/r/berty/social?help&__func=RepostThread" + - "&userPostsAddr=" + post.userPosts.userAddr.String() + - "&threadid=" + post.threadID.String() + - "&postid=" + post.id.String() + - "&body.type=textarea" + return txlink.URL("RepostThread", + "userPostsAddr", post.userPosts.userAddr.String(), + "threadid", post.threadID.String(), + "postid", post.id.String()) } func (post *Post) RenderSummary() string { diff --git a/realm/userposts.gno b/realm/userposts.gno index fe34fbff..048fd5f5 100644 --- a/realm/userposts.gno +++ b/realm/userposts.gno @@ -10,6 +10,7 @@ import ( "gno.land/p/demo/avl" "gno.land/p/demo/ufmt" + "gno.land/p/moul/txlink" "gno.land/r/demo/users" ) @@ -208,23 +209,19 @@ func (userPosts *UserPosts) GetURLFromThreadAndReplyID(threadID, replyID PostID) } func (userPosts *UserPosts) GetPostFormURL() string { - return "/r/berty/social?help&__func=PostMessage" + - "&body.type=textarea" + return txlink.URL("PostMessage") } func (userPosts *UserPosts) GetFollowFormURL() string { - return "/r/berty/social?help&__func=Follow" + - "&followedAddr=" + userPosts.userAddr.String() + return txlink.URL("Follow", "followedAddr", userPosts.userAddr.String()) } func (userPosts *UserPosts) GetUnfollowFormURL(followedAddr std.Address) string { - return "/r/berty/social?help&__func=Unfollow" + - "&followedAddr=" + followedAddr.String() + return txlink.URL("Unfollow", "followedAddr", followedAddr.String()) } func (userPosts *UserPosts) GetRefreshFormURL() string { - return "/r/berty/social?help&__func=RefreshHomePosts" + - "&userPostsAddr=" + userPosts.userAddr.String() + return txlink.URL("RefreshHomePosts", "userPostsAddr", userPosts.userAddr.String()) } // Scan userPosts.following for all posts from all followed users starting from lastRefreshId+1 .