mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-24 02:03:34 -06:00
[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
This commit is contained in:
parent
cde2fb6244
commit
aeb65bceae
16 changed files with 895 additions and 385 deletions
|
|
@ -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, "<pre>", "\n<pre>")
|
||||
webStatus.Content = strings.ReplaceAll(webStatus.Content, "</pre>", "</pre>\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
|
||||
|
|
|
|||
|
|
@ -883,9 +883,8 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments
|
|||
|
||||
func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() {
|
||||
testStatus := suite.testStatuses["remote_account_2_status_1"]
|
||||
requestingAccount := suite.testAccounts["admin_account"]
|
||||
|
||||
apiStatus, err := suite.typeconverter.StatusToWebStatus(context.Background(), testStatus, requestingAccount)
|
||||
apiStatus, err := suite.typeconverter.StatusToWebStatus(context.Background(), testStatus)
|
||||
suite.NoError(err)
|
||||
|
||||
// MediaAttachments should inherit
|
||||
|
|
@ -1010,7 +1009,12 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() {
|
|||
"tags": [],
|
||||
"emojis": [],
|
||||
"card": null,
|
||||
"poll": null
|
||||
"poll": null,
|
||||
"LanguageTag": "en",
|
||||
"PollOptions": null,
|
||||
"Local": false,
|
||||
"Indent": 0,
|
||||
"ThreadFirstReply": false
|
||||
}`, string(b))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue