From aeb65bceae97611b8931de2e954df18afedd812f Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:36:03 +0200 Subject: [feature/frontend] Better visual separation between "main" thread and "replies" (#3093) * [feature/frontend] Better web threading model * fix test * bwap * tweaks * more tweaks to wording * typo * indenting * adjust wording * aaa --- internal/typeutils/internaltofrontend.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'internal/typeutils/internaltofrontend.go') diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index c0cd3d7e7..9d99205f6 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -982,13 +982,23 @@ func filterAppliesInContext(filter *gtsmodel.Filter, filterContext statusfilter. func (c *Converter) StatusToWebStatus( ctx context.Context, s *gtsmodel.Status, - requestingAccount *gtsmodel.Account, -) (*apimodel.Status, error) { - webStatus, err := c.statusToFrontend(ctx, s, requestingAccount, statusfilter.FilterContextNone, nil, nil) +) (*apimodel.WebStatus, error) { + apiStatus, err := c.statusToFrontend( + ctx, + s, + nil, // No authed requester. + statusfilter.FilterContextNone, + nil, // No filters. + nil, // No mutes. + ) if err != nil { return nil, err } + webStatus := &apimodel.WebStatus{ + Status: apiStatus, + } + // Whack a newline before and after each "pre" to make it easier to outdent it. webStatus.Content = strings.ReplaceAll(webStatus.Content, "
", "\n\n") @@ -1014,7 +1024,7 @@ func (c *Converter) StatusToWebStatus( // format them for easier template consumption. totalVotes := poll.VotesCount - webPollOptions := make([]apimodel.WebPollOption, len(poll.Options)) + PollOptions := make([]apimodel.WebPollOption, len(poll.Options)) for i, option := range poll.Options { var voteShare float32 @@ -1046,10 +1056,10 @@ func (c *Converter) StatusToWebStatus( VoteShare: voteShare, VoteShareStr: voteShareStr, } - webPollOptions[i] = webPollOption + PollOptions[i] = webPollOption } - webStatus.WebPollOptions = webPollOptions + webStatus.PollOptions = PollOptions } // Set additional templating @@ -1058,6 +1068,7 @@ func (c *Converter) StatusToWebStatus( a.Sensitive = webStatus.Sensitive } + // Mark this as a local status. webStatus.Local = *s.Local return webStatus, nil -- cgit v1.2.3") webStatus.Content = strings.ReplaceAll(webStatus.Content, "", "