mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-29 23:22:45 +00:00
Compare commits
10 commits
b871989fb0
...
be75ec32b9
Author | SHA1 | Date | |
---|---|---|---|
be75ec32b9 | |||
d3d6e3f920 | |||
8bd8c6fb45 | |||
f550f596fa | |||
23b6d2cc64 | |||
40c33ccc49 | |||
90b773ae2a | |||
4b7d7f9b8b | |||
af5a766f62 | |||
d9e59820ed |
|
@ -284,6 +284,12 @@ definitions:
|
||||||
example: https://example.org/media/some_user/header/static/header.png
|
example: https://example.org/media/some_user/header/static/header.png
|
||||||
type: string
|
type: string
|
||||||
x-go-name: HeaderStatic
|
x-go-name: HeaderStatic
|
||||||
|
hide_boosts:
|
||||||
|
description: |-
|
||||||
|
Account has opted to hide boosts from their profile.
|
||||||
|
Key/value omitted if false.
|
||||||
|
type: boolean
|
||||||
|
x-go-name: HideBoosts
|
||||||
hide_collections:
|
hide_collections:
|
||||||
description: |-
|
description: |-
|
||||||
Account has opted to hide their followers/following collections.
|
Account has opted to hide their followers/following collections.
|
||||||
|
@ -950,7 +956,12 @@ definitions:
|
||||||
with "direct message" visibility.
|
with "direct message" visibility.
|
||||||
properties:
|
properties:
|
||||||
accounts:
|
accounts:
|
||||||
description: Participants in the conversation.
|
description: |-
|
||||||
|
Participants in the conversation.
|
||||||
|
|
||||||
|
If this is a conversation between no accounts (ie., a self-directed DM),
|
||||||
|
this will include only the requesting account itself. Otherwise, it will
|
||||||
|
include every other account in the conversation *except* the requester.
|
||||||
items:
|
items:
|
||||||
$ref: '#/definitions/account'
|
$ref: '#/definitions/account'
|
||||||
type: array
|
type: array
|
||||||
|
@ -2284,6 +2295,12 @@ definitions:
|
||||||
example: https://example.org/media/some_user/header/static/header.png
|
example: https://example.org/media/some_user/header/static/header.png
|
||||||
type: string
|
type: string
|
||||||
x-go-name: HeaderStatic
|
x-go-name: HeaderStatic
|
||||||
|
hide_boosts:
|
||||||
|
description: |-
|
||||||
|
Account has opted to hide boosts from their profile.
|
||||||
|
Key/value omitted if false.
|
||||||
|
type: boolean
|
||||||
|
x-go-name: HideBoosts
|
||||||
hide_collections:
|
hide_collections:
|
||||||
description: |-
|
description: |-
|
||||||
Account has opted to hide their followers/following collections.
|
Account has opted to hide their followers/following collections.
|
||||||
|
|
|
@ -134,6 +134,11 @@ This feed only includes posts set as 'Public' (see [Privacy Settings](./posts.md
|
||||||
!!! warning
|
!!! warning
|
||||||
Exposing your RSS feed allows *anyone* to subscribe to updates on your Public posts anonymously, bypassing follows and follow requests.
|
Exposing your RSS feed allows *anyone* to subscribe to updates on your Public posts anonymously, bypassing follows and follow requests.
|
||||||
|
|
||||||
|
#### Hide boosts from your public page
|
||||||
|
|
||||||
|
By default, GoToSocial will display posts boosted by you on your public web profile. If you do not wish to display them, You can hide them by checking this box.
|
||||||
|
|
||||||
|
|
||||||
#### Hide Who You Follow / Are Followed By
|
#### Hide Who You Follow / Are Followed By
|
||||||
|
|
||||||
By default, GoToSocial shows your following/followers counts on your public web profile, and allows others to see who you follow and are followed by. This can be useful for account discovery purposes. However, for privacy + safety reasons you may wish to hide these counts, and to hide your following/followers lists from other accounts. You can do this by checking this box.
|
By default, GoToSocial shows your following/followers counts on your public web profile, and allows others to see who you follow and are followed by. This can be useful for account discovery purposes. However, for privacy + safety reasons you may wish to hide these counts, and to hide your following/followers lists from other accounts. You can do this by checking this box.
|
||||||
|
|
|
@ -348,6 +348,7 @@ func parseUpdateAccountForm(c *gin.Context) (*apimodel.UpdateCredentialsRequest,
|
||||||
form.Theme == nil &&
|
form.Theme == nil &&
|
||||||
form.CustomCSS == nil &&
|
form.CustomCSS == nil &&
|
||||||
form.EnableRSS == nil &&
|
form.EnableRSS == nil &&
|
||||||
|
form.HideBoosts == nil &&
|
||||||
form.HideCollections == nil &&
|
form.HideCollections == nil &&
|
||||||
form.WebVisibility == nil) {
|
form.WebVisibility == nil) {
|
||||||
return nil, errors.New("empty form submitted")
|
return nil, errors.New("empty form submitted")
|
||||||
|
|
|
@ -104,6 +104,9 @@ type Account struct {
|
||||||
// Account has enabled RSS feed.
|
// Account has enabled RSS feed.
|
||||||
// Key/value omitted if false.
|
// Key/value omitted if false.
|
||||||
EnableRSS bool `json:"enable_rss,omitempty"`
|
EnableRSS bool `json:"enable_rss,omitempty"`
|
||||||
|
// Account has opted to hide boosts from their profile.
|
||||||
|
// Key/value omitted if false.
|
||||||
|
HideBoosts bool `json:"hide_boosts,omitempty"`
|
||||||
// Account has opted to hide their followers/following collections.
|
// Account has opted to hide their followers/following collections.
|
||||||
// Key/value omitted if false.
|
// Key/value omitted if false.
|
||||||
HideCollections bool `json:"hide_collections,omitempty"`
|
HideCollections bool `json:"hide_collections,omitempty"`
|
||||||
|
@ -225,6 +228,8 @@ type UpdateCredentialsRequest struct {
|
||||||
CustomCSS *string `form:"custom_css" json:"custom_css"`
|
CustomCSS *string `form:"custom_css" json:"custom_css"`
|
||||||
// Enable RSS feed of public toots for this account at /@[username]/feed.rss
|
// Enable RSS feed of public toots for this account at /@[username]/feed.rss
|
||||||
EnableRSS *bool `form:"enable_rss" json:"enable_rss"`
|
EnableRSS *bool `form:"enable_rss" json:"enable_rss"`
|
||||||
|
// Hide boosts from this account's profile page.
|
||||||
|
HideBoosts *bool `form:"hide_boosts" json:"hide_boosts"`
|
||||||
// Hide this account's following/followers collections.
|
// Hide this account's following/followers collections.
|
||||||
HideCollections *bool `form:"hide_collections" json:"hide_collections"`
|
HideCollections *bool `form:"hide_collections" json:"hide_collections"`
|
||||||
// Visibility of statuses to show via the web view.
|
// Visibility of statuses to show via the web view.
|
||||||
|
|
|
@ -27,6 +27,10 @@ type Conversation struct {
|
||||||
// Is the conversation currently marked as unread?
|
// Is the conversation currently marked as unread?
|
||||||
Unread bool `json:"unread"`
|
Unread bool `json:"unread"`
|
||||||
// Participants in the conversation.
|
// Participants in the conversation.
|
||||||
|
//
|
||||||
|
// If this is a conversation between no accounts (ie., a self-directed DM),
|
||||||
|
// this will include only the requesting account itself. Otherwise, it will
|
||||||
|
// include every other account in the conversation *except* the requester.
|
||||||
Accounts []Account `json:"accounts"`
|
Accounts []Account `json:"accounts"`
|
||||||
// The last status in the conversation. May be `null`.
|
// The last status in the conversation. May be `null`.
|
||||||
LastStatus *Status `json:"last_status"`
|
LastStatus *Status `json:"last_status"`
|
||||||
|
|
|
@ -118,6 +118,10 @@ type WebStatus struct {
|
||||||
// Override API account with web account.
|
// Override API account with web account.
|
||||||
Account *WebAccount `json:"account"`
|
Account *WebAccount `json:"account"`
|
||||||
|
|
||||||
|
// Account that reblogged the status.
|
||||||
|
// needed to properly render reblogged statuses on profile pages.
|
||||||
|
ReblogAccount *WebAccount `json:"reblog_account"`
|
||||||
|
|
||||||
// Web version of media
|
// Web version of media
|
||||||
// attached to this status.
|
// attached to this status.
|
||||||
MediaAttachments []*WebAttachment `json:"media_attachments"`
|
MediaAttachments []*WebAttachment `json:"media_attachments"`
|
||||||
|
|
|
@ -1017,6 +1017,7 @@ func (a *accountDB) GetAccountWebStatuses(
|
||||||
) ([]*gtsmodel.Status, error) {
|
) ([]*gtsmodel.Status, error) {
|
||||||
// Check for an easy case: account exposes no statuses via the web.
|
// Check for an easy case: account exposes no statuses via the web.
|
||||||
webVisibility := account.Settings.WebVisibility
|
webVisibility := account.Settings.WebVisibility
|
||||||
|
hideBoosts := *account.Settings.HideBoosts
|
||||||
if webVisibility == gtsmodel.VisibilityNone {
|
if webVisibility == gtsmodel.VisibilityNone {
|
||||||
return nil, db.ErrNoEntries
|
return nil, db.ErrNoEntries
|
||||||
}
|
}
|
||||||
|
@ -1035,9 +1036,12 @@ func (a *accountDB) GetAccountWebStatuses(
|
||||||
// Select only IDs from table
|
// Select only IDs from table
|
||||||
Column("status.id").
|
Column("status.id").
|
||||||
Where("? = ?", bun.Ident("status.account_id"), account.ID).
|
Where("? = ?", bun.Ident("status.account_id"), account.ID).
|
||||||
// Don't show replies or boosts.
|
// Don't show replies.
|
||||||
Where("? IS NULL", bun.Ident("status.in_reply_to_uri")).
|
Where("? IS NULL", bun.Ident("status.in_reply_to_uri"))
|
||||||
Where("? IS NULL", bun.Ident("status.boost_of_id"))
|
|
||||||
|
if hideBoosts {
|
||||||
|
q = q.Where("? IS NULL", bun.Ident("status.boost_of_id"))
|
||||||
|
}
|
||||||
|
|
||||||
// Select statuses for this account according
|
// Select statuses for this account according
|
||||||
// to their web visibility preference.
|
// to their web visibility preference.
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
// GoToSocial
|
||||||
|
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/uptrace/bun"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
up := func(ctx context.Context, db *bun.DB) error {
|
||||||
|
_, err := db.ExecContext(ctx, "ALTER TABLE ? ADD COLUMN ? BOOLEAN DEFAULT FALSE", bun.Ident("account_settings"), bun.Ident("hide_boosts"))
|
||||||
|
if err != nil && !(strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "duplicate column name") || strings.Contains(err.Error(), "SQLSTATE 42701")) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
down := func(ctx context.Context, db *bun.DB) error {
|
||||||
|
_, err := db.ExecContext(ctx, "ALTER TABLE ? DROP COLUMN ?", bun.Ident("account_settings"), bun.Ident("hide_boosts"))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := Migrations.Register(up, down); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
|
@ -112,7 +112,7 @@ func (c *sqliteConn) Close() (err error) {
|
||||||
raw := c.connIface.(sqlite3driver.Conn).Raw()
|
raw := c.connIface.(sqlite3driver.Conn).Raw()
|
||||||
|
|
||||||
// see: https://www.sqlite.org/pragma.html#pragma_optimize
|
// see: https://www.sqlite.org/pragma.html#pragma_optimize
|
||||||
const onClose = "PRAGMA analysis_limit=1000; PRAGMA optimize;"
|
const onClose = "PRAGMA optimize;"
|
||||||
_ = raw.Exec(onClose)
|
_ = raw.Exec(onClose)
|
||||||
|
|
||||||
// Finally, close.
|
// Finally, close.
|
||||||
|
|
|
@ -33,6 +33,7 @@ type AccountSettings struct {
|
||||||
Theme string `bun:",nullzero"` // Preset CSS theme filename selected by this Account (empty string if nothing set).
|
Theme string `bun:",nullzero"` // Preset CSS theme filename selected by this Account (empty string if nothing set).
|
||||||
CustomCSS string `bun:",nullzero"` // Custom CSS that should be displayed for this Account's profile and statuses.
|
CustomCSS string `bun:",nullzero"` // Custom CSS that should be displayed for this Account's profile and statuses.
|
||||||
EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed
|
EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed
|
||||||
|
HideBoosts *bool `bun:",nullzero,notnull,default:false"` // Hide boosts from this accounts profile page.
|
||||||
HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections.
|
HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections.
|
||||||
WebVisibility Visibility `bun:",nullzero,notnull,default:public"` // Visibility level of statuses that visitors can view via the web profile.
|
WebVisibility Visibility `bun:",nullzero,notnull,default:public"` // Visibility level of statuses that visitors can view via the web profile.
|
||||||
InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy.
|
InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy.
|
||||||
|
|
|
@ -42,6 +42,16 @@ func (suite *GetRSSTestSuite) TestGetAccountRSSAdmin() {
|
||||||
<description>Posts from @admin@localhost:8080</description>
|
<description>Posts from @admin@localhost:8080</description>
|
||||||
<pubDate>Wed, 20 Oct 2021 10:41:37 +0000</pubDate>
|
<pubDate>Wed, 20 Oct 2021 10:41:37 +0000</pubDate>
|
||||||
<lastBuildDate>Wed, 20 Oct 2021 10:41:37 +0000</lastBuildDate>
|
<lastBuildDate>Wed, 20 Oct 2021 10:41:37 +0000</lastBuildDate>
|
||||||
|
<item>
|
||||||
|
<title>introduction post</title>
|
||||||
|
<link>http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY</link>
|
||||||
|
<description>@the_mighty_zork@localhost:8080 made a new post: "hello everyone!"</description>
|
||||||
|
<content:encoded><![CDATA[hello everyone!]]></content:encoded>
|
||||||
|
<author>@the_mighty_zork@localhost:8080</author>
|
||||||
|
<guid isPermaLink="true">http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY</guid>
|
||||||
|
<pubDate>Wed, 20 Oct 2021 10:40:37 +0000</pubDate>
|
||||||
|
<source>http://localhost:8080/@the_mighty_zork/feed.rss</source>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<title>open to see some puppies</title>
|
<title>open to see some puppies</title>
|
||||||
<link>http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37</link>
|
<link>http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37</link>
|
||||||
|
|
|
@ -274,6 +274,11 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
|
||||||
settingsColumns = append(settingsColumns, "enable_rss")
|
settingsColumns = append(settingsColumns, "enable_rss")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if form.HideBoosts != nil {
|
||||||
|
account.Settings.HideBoosts = form.HideBoosts
|
||||||
|
settingsColumns = append(settingsColumns, "hide_boosts")
|
||||||
|
}
|
||||||
|
|
||||||
if form.HideCollections != nil {
|
if form.HideCollections != nil {
|
||||||
account.Settings.HideCollections = form.HideCollections
|
account.Settings.HideCollections = form.HideCollections
|
||||||
settingsColumns = append(settingsColumns, "hide_collections")
|
settingsColumns = append(settingsColumns, "hide_collections")
|
||||||
|
|
|
@ -247,6 +247,12 @@ func (p *Processor) GetVisibleAPIStatuses(
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if apiStatus == nil {
|
||||||
|
// Status was
|
||||||
|
// filtered out.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Append converted status to return slice.
|
// Append converted status to return slice.
|
||||||
apiStatuses = append(apiStatuses, *apiStatus)
|
apiStatuses = append(apiStatuses, *apiStatus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||||
// Bits that vary between remote + local accounts:
|
// Bits that vary between remote + local accounts:
|
||||||
// - Account (acct) string.
|
// - Account (acct) string.
|
||||||
// - Role.
|
// - Role.
|
||||||
// - Settings things (enableRSS, theme, customCSS, hideCollections).
|
// - Settings things (enableRSS, theme, customCSS, hideBoosts ,hideCollections).
|
||||||
|
|
||||||
var (
|
var (
|
||||||
acct string
|
acct string
|
||||||
|
@ -310,6 +310,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||||
enableRSS bool
|
enableRSS bool
|
||||||
theme string
|
theme string
|
||||||
customCSS string
|
customCSS string
|
||||||
|
hideBoosts bool
|
||||||
hideCollections bool
|
hideCollections bool
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -338,6 +339,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||||
enableRSS = *a.Settings.EnableRSS
|
enableRSS = *a.Settings.EnableRSS
|
||||||
theme = a.Settings.Theme
|
theme = a.Settings.Theme
|
||||||
customCSS = a.Settings.CustomCSS
|
customCSS = a.Settings.CustomCSS
|
||||||
|
hideBoosts = *a.Settings.HideBoosts
|
||||||
hideCollections = *a.Settings.HideCollections
|
hideCollections = *a.Settings.HideCollections
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,6 +382,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||||
Theme: theme,
|
Theme: theme,
|
||||||
CustomCSS: customCSS,
|
CustomCSS: customCSS,
|
||||||
EnableRSS: enableRSS,
|
EnableRSS: enableRSS,
|
||||||
|
HideBoosts: hideBoosts,
|
||||||
HideCollections: hideCollections,
|
HideCollections: hideCollections,
|
||||||
Roles: roles,
|
Roles: roles,
|
||||||
}
|
}
|
||||||
|
@ -1092,7 +1095,15 @@ func (c *Converter) StatusToWebStatus(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
s *gtsmodel.Status,
|
s *gtsmodel.Status,
|
||||||
) (*apimodel.WebStatus, error) {
|
) (*apimodel.WebStatus, error) {
|
||||||
apiStatus, err := c.statusToFrontend(ctx, s,
|
|
||||||
|
isBoost := s.BoostOf != nil
|
||||||
|
status := s
|
||||||
|
|
||||||
|
if isBoost {
|
||||||
|
status = s.BoostOf
|
||||||
|
}
|
||||||
|
|
||||||
|
apiStatus, err := c.statusToFrontend(ctx, status,
|
||||||
nil, // No authed requester.
|
nil, // No authed requester.
|
||||||
statusfilter.FilterContextNone, // No filters.
|
statusfilter.FilterContextNone, // No filters.
|
||||||
nil, // No filters.
|
nil, // No filters.
|
||||||
|
@ -1103,7 +1114,7 @@ func (c *Converter) StatusToWebStatus(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert status author to web model.
|
// Convert status author to web model.
|
||||||
acct, err := c.AccountToWebAccount(ctx, s.Account)
|
acct, err := c.AccountToWebAccount(ctx, status.Account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -1113,6 +1124,14 @@ func (c *Converter) StatusToWebStatus(
|
||||||
Account: acct,
|
Account: acct,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isBoost {
|
||||||
|
reblogAcct, err := c.AccountToWebAccount(ctx, s.Account)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
webStatus.ReblogAccount = reblogAcct
|
||||||
|
}
|
||||||
|
|
||||||
// Whack a newline before and after each "pre" to make it easier to outdent it.
|
// 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>", "\n<pre>")
|
||||||
webStatus.Content = strings.ReplaceAll(webStatus.Content, "</pre>", "</pre>\n")
|
webStatus.Content = strings.ReplaceAll(webStatus.Content, "</pre>", "</pre>\n")
|
||||||
|
@ -1832,46 +1851,23 @@ func (c *Converter) NotificationToAPINotification(
|
||||||
func (c *Converter) ConversationToAPIConversation(
|
func (c *Converter) ConversationToAPIConversation(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
conversation *gtsmodel.Conversation,
|
conversation *gtsmodel.Conversation,
|
||||||
requestingAccount *gtsmodel.Account,
|
requester *gtsmodel.Account,
|
||||||
filters []*gtsmodel.Filter,
|
filters []*gtsmodel.Filter,
|
||||||
mutes *usermute.CompiledUserMuteList,
|
mutes *usermute.CompiledUserMuteList,
|
||||||
) (*apimodel.Conversation, error) {
|
) (*apimodel.Conversation, error) {
|
||||||
apiConversation := &apimodel.Conversation{
|
apiConversation := &apimodel.Conversation{
|
||||||
ID: conversation.ID,
|
ID: conversation.ID,
|
||||||
Unread: !*conversation.Read,
|
Unread: !*conversation.Read,
|
||||||
Accounts: []apimodel.Account{},
|
|
||||||
}
|
|
||||||
for _, account := range conversation.OtherAccounts {
|
|
||||||
var apiAccount *apimodel.Account
|
|
||||||
blocked, err := c.state.DB.IsEitherBlocked(ctx, requestingAccount.ID, account.ID)
|
|
||||||
if err != nil {
|
|
||||||
return nil, gtserror.Newf(
|
|
||||||
"DB error checking blocks between accounts %s and %s: %w",
|
|
||||||
requestingAccount.ID,
|
|
||||||
account.ID,
|
|
||||||
err,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if blocked || account.IsSuspended() {
|
|
||||||
apiAccount, err = c.AccountToAPIAccountBlocked(ctx, account)
|
|
||||||
} else {
|
|
||||||
apiAccount, err = c.AccountToAPIAccountPublic(ctx, account)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return nil, gtserror.Newf(
|
|
||||||
"error converting account %s to API representation: %w",
|
|
||||||
account.ID,
|
|
||||||
err,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
apiConversation.Accounts = append(apiConversation.Accounts, *apiAccount)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Populate most recent status in convo;
|
||||||
|
// can be nil if this status is filtered.
|
||||||
if conversation.LastStatus != nil {
|
if conversation.LastStatus != nil {
|
||||||
var err error
|
var err error
|
||||||
apiConversation.LastStatus, err = c.StatusToAPIStatus(
|
apiConversation.LastStatus, err = c.StatusToAPIStatus(
|
||||||
ctx,
|
ctx,
|
||||||
conversation.LastStatus,
|
conversation.LastStatus,
|
||||||
requestingAccount,
|
requester,
|
||||||
statusfilter.FilterContextNotifications,
|
statusfilter.FilterContextNotifications,
|
||||||
filters,
|
filters,
|
||||||
mutes,
|
mutes,
|
||||||
|
@ -1885,6 +1881,60 @@ func (c *Converter) ConversationToAPIConversation(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no other accounts are involved in this convo,
|
||||||
|
// just include the requesting account and return.
|
||||||
|
//
|
||||||
|
// See: https://github.com/superseriousbusiness/gotosocial/issues/3385#issuecomment-2394033477
|
||||||
|
otherAcctsLen := len(conversation.OtherAccounts)
|
||||||
|
if otherAcctsLen == 0 {
|
||||||
|
apiAcct, err := c.AccountToAPIAccountPublic(ctx, requester)
|
||||||
|
if err != nil {
|
||||||
|
err := gtserror.Newf(
|
||||||
|
"error converting account %s to API representation: %w",
|
||||||
|
requester.ID, err,
|
||||||
|
)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
apiConversation.Accounts = []apimodel.Account{*apiAcct}
|
||||||
|
return apiConversation, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Other accounts are involved in the
|
||||||
|
// convo. Convert each to API model.
|
||||||
|
apiConversation.Accounts = make([]apimodel.Account, otherAcctsLen)
|
||||||
|
for i, account := range conversation.OtherAccounts {
|
||||||
|
blocked, err := c.state.DB.IsEitherBlocked(ctx,
|
||||||
|
requester.ID, account.ID,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
err := gtserror.Newf(
|
||||||
|
"db error checking blocks between accounts %s and %s: %w",
|
||||||
|
requester.ID, account.ID, err,
|
||||||
|
)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// API account model varies depending
|
||||||
|
// on status of conversation participant.
|
||||||
|
var apiAcct *apimodel.Account
|
||||||
|
if blocked || account.IsSuspended() {
|
||||||
|
apiAcct, err = c.AccountToAPIAccountBlocked(ctx, account)
|
||||||
|
} else {
|
||||||
|
apiAcct, err = c.AccountToAPIAccountPublic(ctx, account)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
err := gtserror.Newf(
|
||||||
|
"error converting account %s to API representation: %w",
|
||||||
|
account.ID, err,
|
||||||
|
)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
apiConversation.Accounts[i] = *apiAcct
|
||||||
|
}
|
||||||
|
|
||||||
return apiConversation, nil
|
return apiConversation, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1402,6 +1402,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() {
|
||||||
"emojis": [],
|
"emojis": [],
|
||||||
"fields": []
|
"fields": []
|
||||||
},
|
},
|
||||||
|
"reblog_account": null,
|
||||||
"media_attachments": [
|
"media_attachments": [
|
||||||
{
|
{
|
||||||
"id": "01HE7Y3C432WRSNS10EZM86SA5",
|
"id": "01HE7Y3C432WRSNS10EZM86SA5",
|
||||||
|
@ -3358,6 +3359,321 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
|
||||||
}`, string(b))
|
}`, string(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() {
|
||||||
|
var (
|
||||||
|
ctx = context.Background()
|
||||||
|
requester = suite.testAccounts["local_account_1"]
|
||||||
|
lastStatus = suite.testStatuses["local_account_1_status_1"]
|
||||||
|
filters []*gtsmodel.Filter = nil
|
||||||
|
mutes *usermute.CompiledUserMuteList = nil
|
||||||
|
)
|
||||||
|
|
||||||
|
convo := >smodel.Conversation{
|
||||||
|
ID: "01J9C6K86PKZ5GY5WXV94DGH6R",
|
||||||
|
CreatedAt: testrig.TimeMustParse("2022-06-10T15:22:08Z"),
|
||||||
|
UpdatedAt: testrig.TimeMustParse("2022-06-10T15:22:08Z"),
|
||||||
|
AccountID: requester.ID,
|
||||||
|
Account: requester,
|
||||||
|
OtherAccounts: nil,
|
||||||
|
LastStatus: lastStatus,
|
||||||
|
Read: util.Ptr(true),
|
||||||
|
}
|
||||||
|
|
||||||
|
apiConvo, err := suite.typeconverter.ConversationToAPIConversation(
|
||||||
|
ctx,
|
||||||
|
convo,
|
||||||
|
requester,
|
||||||
|
filters,
|
||||||
|
mutes,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
suite.FailNow(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := json.MarshalIndent(apiConvo, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
suite.FailNow(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
// No other accounts involved, so we should only
|
||||||
|
// have our own account in the "accounts" field.
|
||||||
|
suite.Equal(`{
|
||||||
|
"id": "01J9C6K86PKZ5GY5WXV94DGH6R",
|
||||||
|
"unread": false,
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"id": "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||||
|
"username": "the_mighty_zork",
|
||||||
|
"acct": "the_mighty_zork",
|
||||||
|
"display_name": "original zork (he/they)",
|
||||||
|
"locked": false,
|
||||||
|
"discoverable": true,
|
||||||
|
"bot": false,
|
||||||
|
"created_at": "2022-05-20T11:09:18.000Z",
|
||||||
|
"note": "\u003cp\u003ehey yo this is my profile!\u003c/p\u003e",
|
||||||
|
"url": "http://localhost:8080/@the_mighty_zork",
|
||||||
|
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
|
||||||
|
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp",
|
||||||
|
"avatar_description": "a green goblin looking nasty",
|
||||||
|
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
|
||||||
|
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp",
|
||||||
|
"header_description": "A very old-school screenshot of the original team fortress mod for quake",
|
||||||
|
"followers_count": 2,
|
||||||
|
"following_count": 2,
|
||||||
|
"statuses_count": 8,
|
||||||
|
"last_status_at": "2024-01-10T09:24:00.000Z",
|
||||||
|
"emojis": [],
|
||||||
|
"fields": [],
|
||||||
|
"enable_rss": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"last_status": {
|
||||||
|
"id": "01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
|
"created_at": "2021-10-20T10:40:37.000Z",
|
||||||
|
"in_reply_to_id": null,
|
||||||
|
"in_reply_to_account_id": null,
|
||||||
|
"sensitive": true,
|
||||||
|
"spoiler_text": "introduction post",
|
||||||
|
"visibility": "public",
|
||||||
|
"language": "en",
|
||||||
|
"uri": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
|
"url": "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
|
"replies_count": 2,
|
||||||
|
"reblogs_count": 1,
|
||||||
|
"favourites_count": 1,
|
||||||
|
"favourited": false,
|
||||||
|
"reblogged": false,
|
||||||
|
"muted": false,
|
||||||
|
"bookmarked": false,
|
||||||
|
"pinned": false,
|
||||||
|
"content": "hello everyone!",
|
||||||
|
"reblog": null,
|
||||||
|
"application": {
|
||||||
|
"name": "really cool gts application",
|
||||||
|
"website": "https://reallycool.app"
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"id": "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||||
|
"username": "the_mighty_zork",
|
||||||
|
"acct": "the_mighty_zork",
|
||||||
|
"display_name": "original zork (he/they)",
|
||||||
|
"locked": false,
|
||||||
|
"discoverable": true,
|
||||||
|
"bot": false,
|
||||||
|
"created_at": "2022-05-20T11:09:18.000Z",
|
||||||
|
"note": "\u003cp\u003ehey yo this is my profile!\u003c/p\u003e",
|
||||||
|
"url": "http://localhost:8080/@the_mighty_zork",
|
||||||
|
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
|
||||||
|
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp",
|
||||||
|
"avatar_description": "a green goblin looking nasty",
|
||||||
|
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
|
||||||
|
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp",
|
||||||
|
"header_description": "A very old-school screenshot of the original team fortress mod for quake",
|
||||||
|
"followers_count": 2,
|
||||||
|
"following_count": 2,
|
||||||
|
"statuses_count": 8,
|
||||||
|
"last_status_at": "2024-01-10T09:24:00.000Z",
|
||||||
|
"emojis": [],
|
||||||
|
"fields": [],
|
||||||
|
"enable_rss": true
|
||||||
|
},
|
||||||
|
"media_attachments": [],
|
||||||
|
"mentions": [],
|
||||||
|
"tags": [],
|
||||||
|
"emojis": [],
|
||||||
|
"card": null,
|
||||||
|
"poll": null,
|
||||||
|
"text": "hello everyone!",
|
||||||
|
"interaction_policy": {
|
||||||
|
"can_favourite": {
|
||||||
|
"always": [
|
||||||
|
"public",
|
||||||
|
"me"
|
||||||
|
],
|
||||||
|
"with_approval": []
|
||||||
|
},
|
||||||
|
"can_reply": {
|
||||||
|
"always": [
|
||||||
|
"public",
|
||||||
|
"me"
|
||||||
|
],
|
||||||
|
"with_approval": []
|
||||||
|
},
|
||||||
|
"can_reblog": {
|
||||||
|
"always": [
|
||||||
|
"public",
|
||||||
|
"me"
|
||||||
|
],
|
||||||
|
"with_approval": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`, string(b))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *InternalToFrontendTestSuite) TestConversationToAPI() {
|
||||||
|
var (
|
||||||
|
ctx = context.Background()
|
||||||
|
requester = suite.testAccounts["local_account_1"]
|
||||||
|
lastStatus = suite.testStatuses["local_account_1_status_1"]
|
||||||
|
filters []*gtsmodel.Filter = nil
|
||||||
|
mutes *usermute.CompiledUserMuteList = nil
|
||||||
|
)
|
||||||
|
|
||||||
|
convo := >smodel.Conversation{
|
||||||
|
ID: "01J9C6K86PKZ5GY5WXV94DGH6R",
|
||||||
|
CreatedAt: testrig.TimeMustParse("2022-06-10T15:22:08Z"),
|
||||||
|
UpdatedAt: testrig.TimeMustParse("2022-06-10T15:22:08Z"),
|
||||||
|
AccountID: requester.ID,
|
||||||
|
Account: requester,
|
||||||
|
OtherAccounts: []*gtsmodel.Account{
|
||||||
|
suite.testAccounts["local_account_2"],
|
||||||
|
},
|
||||||
|
LastStatus: lastStatus,
|
||||||
|
Read: util.Ptr(false),
|
||||||
|
}
|
||||||
|
|
||||||
|
apiConvo, err := suite.typeconverter.ConversationToAPIConversation(
|
||||||
|
ctx,
|
||||||
|
convo,
|
||||||
|
requester,
|
||||||
|
filters,
|
||||||
|
mutes,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
suite.FailNow(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := json.MarshalIndent(apiConvo, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
suite.FailNow(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
// One other account is involved, so they
|
||||||
|
// should in the "accounts" field and not us.
|
||||||
|
suite.Equal(`{
|
||||||
|
"id": "01J9C6K86PKZ5GY5WXV94DGH6R",
|
||||||
|
"unread": true,
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"id": "01F8MH5NBDF2MV7CTC4Q5128HF",
|
||||||
|
"username": "1happyturtle",
|
||||||
|
"acct": "1happyturtle",
|
||||||
|
"display_name": "happy little turtle :3",
|
||||||
|
"locked": true,
|
||||||
|
"discoverable": false,
|
||||||
|
"bot": false,
|
||||||
|
"created_at": "2022-06-04T13:12:00.000Z",
|
||||||
|
"note": "\u003cp\u003ei post about things that concern me\u003c/p\u003e",
|
||||||
|
"url": "http://localhost:8080/@1happyturtle",
|
||||||
|
"avatar": "",
|
||||||
|
"avatar_static": "",
|
||||||
|
"header": "http://localhost:8080/assets/default_header.webp",
|
||||||
|
"header_static": "http://localhost:8080/assets/default_header.webp",
|
||||||
|
"followers_count": 1,
|
||||||
|
"following_count": 1,
|
||||||
|
"statuses_count": 8,
|
||||||
|
"last_status_at": "2021-07-28T08:40:37.000Z",
|
||||||
|
"emojis": [],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": "should you follow me?",
|
||||||
|
"value": "maybe!",
|
||||||
|
"verified_at": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "age",
|
||||||
|
"value": "120",
|
||||||
|
"verified_at": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"hide_collections": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"last_status": {
|
||||||
|
"id": "01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
|
"created_at": "2021-10-20T10:40:37.000Z",
|
||||||
|
"in_reply_to_id": null,
|
||||||
|
"in_reply_to_account_id": null,
|
||||||
|
"sensitive": true,
|
||||||
|
"spoiler_text": "introduction post",
|
||||||
|
"visibility": "public",
|
||||||
|
"language": "en",
|
||||||
|
"uri": "http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
|
"url": "http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY",
|
||||||
|
"replies_count": 2,
|
||||||
|
"reblogs_count": 1,
|
||||||
|
"favourites_count": 1,
|
||||||
|
"favourited": false,
|
||||||
|
"reblogged": false,
|
||||||
|
"muted": false,
|
||||||
|
"bookmarked": false,
|
||||||
|
"pinned": false,
|
||||||
|
"content": "hello everyone!",
|
||||||
|
"reblog": null,
|
||||||
|
"application": {
|
||||||
|
"name": "really cool gts application",
|
||||||
|
"website": "https://reallycool.app"
|
||||||
|
},
|
||||||
|
"account": {
|
||||||
|
"id": "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||||
|
"username": "the_mighty_zork",
|
||||||
|
"acct": "the_mighty_zork",
|
||||||
|
"display_name": "original zork (he/they)",
|
||||||
|
"locked": false,
|
||||||
|
"discoverable": true,
|
||||||
|
"bot": false,
|
||||||
|
"created_at": "2022-05-20T11:09:18.000Z",
|
||||||
|
"note": "\u003cp\u003ehey yo this is my profile!\u003c/p\u003e",
|
||||||
|
"url": "http://localhost:8080/@the_mighty_zork",
|
||||||
|
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
|
||||||
|
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp",
|
||||||
|
"avatar_description": "a green goblin looking nasty",
|
||||||
|
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
|
||||||
|
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp",
|
||||||
|
"header_description": "A very old-school screenshot of the original team fortress mod for quake",
|
||||||
|
"followers_count": 2,
|
||||||
|
"following_count": 2,
|
||||||
|
"statuses_count": 8,
|
||||||
|
"last_status_at": "2024-01-10T09:24:00.000Z",
|
||||||
|
"emojis": [],
|
||||||
|
"fields": [],
|
||||||
|
"enable_rss": true
|
||||||
|
},
|
||||||
|
"media_attachments": [],
|
||||||
|
"mentions": [],
|
||||||
|
"tags": [],
|
||||||
|
"emojis": [],
|
||||||
|
"card": null,
|
||||||
|
"poll": null,
|
||||||
|
"text": "hello everyone!",
|
||||||
|
"interaction_policy": {
|
||||||
|
"can_favourite": {
|
||||||
|
"always": [
|
||||||
|
"public",
|
||||||
|
"me"
|
||||||
|
],
|
||||||
|
"with_approval": []
|
||||||
|
},
|
||||||
|
"can_reply": {
|
||||||
|
"always": [
|
||||||
|
"public",
|
||||||
|
"me"
|
||||||
|
],
|
||||||
|
"with_approval": []
|
||||||
|
},
|
||||||
|
"can_reblog": {
|
||||||
|
"always": [
|
||||||
|
"public",
|
||||||
|
"me"
|
||||||
|
],
|
||||||
|
"with_approval": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`, string(b))
|
||||||
|
}
|
||||||
|
|
||||||
func TestInternalToFrontendTestSuite(t *testing.T) {
|
func TestInternalToFrontendTestSuite(t *testing.T) {
|
||||||
suite.Run(t, new(InternalToFrontendTestSuite))
|
suite.Run(t, new(InternalToFrontendTestSuite))
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,12 @@
|
||||||
func (c *Converter) StatusToRSSItem(ctx context.Context, s *gtsmodel.Status) (*feeds.Item, error) {
|
func (c *Converter) StatusToRSSItem(ctx context.Context, s *gtsmodel.Status) (*feeds.Item, error) {
|
||||||
// see https://cyber.harvard.edu/rss/rss.html
|
// see https://cyber.harvard.edu/rss/rss.html
|
||||||
|
|
||||||
|
// If status is a boost,
|
||||||
|
// display the boost instead.
|
||||||
|
if s.BoostOf != nil {
|
||||||
|
s = s.BoostOf
|
||||||
|
}
|
||||||
|
|
||||||
// Title -- The title of the item.
|
// Title -- The title of the item.
|
||||||
// example: Venice Film Festival Tries to Quit Sinking
|
// example: Venice Film Festival Tries to Quit Sinking
|
||||||
var title string
|
var title string
|
||||||
|
|
|
@ -618,7 +618,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
|
||||||
}
|
}
|
||||||
|
|
||||||
if diff := len(accountsSorted) - len(preserializedKeys); diff > 0 {
|
if diff := len(accountsSorted) - len(preserializedKeys); diff > 0 {
|
||||||
keyStrings := make([]string, diff)
|
keyStrings := make([]string, 0, diff)
|
||||||
for i := 0; i < diff; i++ {
|
for i := 0; i < diff; i++ {
|
||||||
priv, _ := rsa.GenerateKey(rand.Reader, 2048)
|
priv, _ := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
key, _ := x509.MarshalPKCS8PrivateKey(priv)
|
key, _ := x509.MarshalPKCS8PrivateKey(priv)
|
||||||
|
@ -657,6 +657,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
|
||||||
Sensitive: util.Ptr(false),
|
Sensitive: util.Ptr(false),
|
||||||
Language: "en",
|
Language: "en",
|
||||||
EnableRSS: util.Ptr(false),
|
EnableRSS: util.Ptr(false),
|
||||||
|
HideBoosts: util.Ptr(false),
|
||||||
HideCollections: util.Ptr(false),
|
HideCollections: util.Ptr(false),
|
||||||
WebVisibility: gtsmodel.VisibilityPublic,
|
WebVisibility: gtsmodel.VisibilityPublic,
|
||||||
},
|
},
|
||||||
|
@ -668,6 +669,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
|
||||||
Sensitive: util.Ptr(false),
|
Sensitive: util.Ptr(false),
|
||||||
Language: "en",
|
Language: "en",
|
||||||
EnableRSS: util.Ptr(true),
|
EnableRSS: util.Ptr(true),
|
||||||
|
HideBoosts: util.Ptr(false),
|
||||||
HideCollections: util.Ptr(false),
|
HideCollections: util.Ptr(false),
|
||||||
WebVisibility: gtsmodel.VisibilityPublic,
|
WebVisibility: gtsmodel.VisibilityPublic,
|
||||||
},
|
},
|
||||||
|
@ -679,6 +681,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
|
||||||
Sensitive: util.Ptr(false),
|
Sensitive: util.Ptr(false),
|
||||||
Language: "en",
|
Language: "en",
|
||||||
EnableRSS: util.Ptr(true),
|
EnableRSS: util.Ptr(true),
|
||||||
|
HideBoosts: util.Ptr(false),
|
||||||
HideCollections: util.Ptr(false),
|
HideCollections: util.Ptr(false),
|
||||||
WebVisibility: gtsmodel.VisibilityUnlocked,
|
WebVisibility: gtsmodel.VisibilityUnlocked,
|
||||||
},
|
},
|
||||||
|
@ -690,6 +693,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
|
||||||
Sensitive: util.Ptr(true),
|
Sensitive: util.Ptr(true),
|
||||||
Language: "fr",
|
Language: "fr",
|
||||||
EnableRSS: util.Ptr(false),
|
EnableRSS: util.Ptr(false),
|
||||||
|
HideBoosts: util.Ptr(false),
|
||||||
HideCollections: util.Ptr(true),
|
HideCollections: util.Ptr(true),
|
||||||
WebVisibility: gtsmodel.VisibilityPublic,
|
WebVisibility: gtsmodel.VisibilityPublic,
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,6 +41,12 @@ main {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.boosted {
|
||||||
|
padding: 0 0.75rem 0.75rem;
|
||||||
|
color: var(--fg-reduced);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.status-header > address {
|
.status-header > address {
|
||||||
/*
|
/*
|
||||||
Avoid stretching so wide that user
|
Avoid stretching so wide that user
|
||||||
|
@ -65,11 +71,21 @@ main {
|
||||||
height: 3.5rem;
|
height: 3.5rem;
|
||||||
width: 3.5rem;
|
width: 3.5rem;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
border: 0.15rem solid $avatar-border;
|
border: 0.15rem solid $avatar-border;
|
||||||
border-radius: $br;
|
border-radius: $br;
|
||||||
overflow: hidden; /* hides corners from img overflowing */
|
overflow: hidden; /* hides corners from img overflowing */
|
||||||
|
|
||||||
|
.boosted-avatar {
|
||||||
|
height: 50%;
|
||||||
|
width: 50%;
|
||||||
|
z-index: 10;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
inset-inline-end: 0;
|
||||||
|
}
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -114,6 +114,7 @@ function UserProfileForm({ data: profile }) {
|
||||||
locked: useBoolInput("locked", { source: profile }),
|
locked: useBoolInput("locked", { source: profile }),
|
||||||
discoverable: useBoolInput("discoverable", { source: profile}),
|
discoverable: useBoolInput("discoverable", { source: profile}),
|
||||||
enableRSS: useBoolInput("enable_rss", { source: profile }),
|
enableRSS: useBoolInput("enable_rss", { source: profile }),
|
||||||
|
hideBoosts: useBoolInput("hide_boosts", { source: profile }),
|
||||||
hideCollections: useBoolInput("hide_collections", { source: profile }),
|
hideCollections: useBoolInput("hide_collections", { source: profile }),
|
||||||
webVisibility: useTextInput("web_visibility", { source: profile, valueSelector: (p) => p.source?.web_visibility }),
|
webVisibility: useTextInput("web_visibility", { source: profile, valueSelector: (p) => p.source?.web_visibility }),
|
||||||
fields: useFieldArrayInput("fields_attributes", {
|
fields: useFieldArrayInput("fields_attributes", {
|
||||||
|
@ -257,6 +258,10 @@ function UserProfileForm({ data: profile }) {
|
||||||
field={form.enableRSS}
|
field={form.enableRSS}
|
||||||
label="Enable RSS feed of posts."
|
label="Enable RSS feed of posts."
|
||||||
/>
|
/>
|
||||||
|
<Checkbox
|
||||||
|
field={form.hideBoosts}
|
||||||
|
label="Hide boosts from your public page"
|
||||||
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
field={form.hideCollections}
|
field={form.hideCollections}
|
||||||
label="Hide who you follow / are followed by."
|
label="Hide who you follow / are followed by."
|
||||||
|
|
|
@ -247,6 +247,16 @@
|
||||||
class="status expanded"
|
class="status expanded"
|
||||||
{{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }}
|
{{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }}
|
||||||
>
|
>
|
||||||
|
{{- if .ReblogAccount }}
|
||||||
|
<div class="boosted text-cutoff">
|
||||||
|
<i class="fa fa-retweet" aria-hidden="true"></i> 
|
||||||
|
{{- if $.account.DisplayName }}
|
||||||
|
{{- emojify $.account.Emojis (escape $.account.DisplayName) }} boosted
|
||||||
|
{{- else }}
|
||||||
|
{{- $.account.Username }} boosted
|
||||||
|
{{- end }}
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
||||||
{{- include "status.tmpl" . | indent 6 }}
|
{{- include "status.tmpl" . | indent 6 }}
|
||||||
</article>
|
</article>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -48,6 +48,16 @@
|
||||||
alt="Avatar for {{ .Username -}}"
|
alt="Avatar for {{ .Username -}}"
|
||||||
title="Avatar for {{ .Username -}}"
|
title="Avatar for {{ .Username -}}"
|
||||||
>
|
>
|
||||||
|
{{ if $.ReblogAccount }}
|
||||||
|
<img
|
||||||
|
class="boosted-avatar"
|
||||||
|
src="{{ $.ReblogAccount.Avatar }}"
|
||||||
|
alt="Avatar for {{ $.ReblogAccount.Username -}}"
|
||||||
|
title="Avatar for {{ $.ReblogAccount.Username -}}"
|
||||||
|
>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
</picture>
|
</picture>
|
||||||
<div class="author-strap">
|
<div class="author-strap">
|
||||||
<span class="displayname text-cutoff">
|
<span class="displayname text-cutoff">
|
||||||
|
|
Loading…
Reference in a new issue