Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: In realm code, use txlink.URL #138

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 14 additions & 15 deletions realm/post.gno
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"gno.land/p/demo/avl"
"gno.land/p/demo/ufmt"
"gno.land/p/moul/txlink"
)

var debugNowOffset time.Duration
Expand Down Expand Up @@ -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"
jefft0 marked this conversation as resolved.
Show resolved Hide resolved
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here.

return txlink.URL("RepostThread",
"userPostsAddr", post.userPosts.userAddr.String(),
"threadid", post.threadID.String(),
"postid", post.id.String())
}

func (post *Post) RenderSummary() string {
Expand Down
13 changes: 5 additions & 8 deletions realm/userposts.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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"
jefft0 marked this conversation as resolved.
Show resolved Hide resolved
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 .
Expand Down