mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Enable federation in/out of profile PropertyValue fields (#1722)
Co-authored-by: kim <grufwub@gmail.com> Co-authored-by: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
This commit is contained in:
@@ -77,7 +77,7 @@ func (c *converter) AccountToAPIAccountSensitive(ctx context.Context, a *gtsmode
|
||||
Language: a.Language,
|
||||
StatusContentType: statusContentType,
|
||||
Note: a.NoteRaw,
|
||||
Fields: apiAccount.Fields,
|
||||
Fields: c.fieldsToAPIFields(a.FieldsRaw),
|
||||
FollowRequestsCount: frc,
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||
aviURLStatic string
|
||||
headerURL string
|
||||
headerURLStatic string
|
||||
fields = make([]apimodel.Field, len(a.Fields))
|
||||
)
|
||||
|
||||
if a.AvatarMediaAttachment != nil {
|
||||
@@ -144,19 +143,8 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||
headerURLStatic = a.HeaderMediaAttachment.Thumbnail.URL
|
||||
}
|
||||
|
||||
// GTS model fields -> frontend.
|
||||
for i, field := range a.Fields {
|
||||
mField := apimodel.Field{
|
||||
Name: field.Name,
|
||||
Value: field.Value,
|
||||
}
|
||||
|
||||
if !field.VerifiedAt.IsZero() {
|
||||
mField.VerifiedAt = util.FormatISO8601(field.VerifiedAt)
|
||||
}
|
||||
|
||||
fields[i] = mField
|
||||
}
|
||||
// convert account gts model fields to front api model fields
|
||||
fields := c.fieldsToAPIFields(a.Fields)
|
||||
|
||||
// GTS model emojis -> frontend.
|
||||
apiEmojis, err := c.convertEmojisToAPIEmojis(ctx, a.Emojis, a.EmojiIDs)
|
||||
@@ -239,6 +227,25 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
|
||||
return accountFrontend, nil
|
||||
}
|
||||
|
||||
func (c *converter) fieldsToAPIFields(f []*gtsmodel.Field) []apimodel.Field {
|
||||
fields := make([]apimodel.Field, len(f))
|
||||
|
||||
for i, field := range f {
|
||||
mField := apimodel.Field{
|
||||
Name: field.Name,
|
||||
Value: field.Value,
|
||||
}
|
||||
|
||||
if !field.VerifiedAt.IsZero() {
|
||||
mField.VerifiedAt = func() *string { s := util.FormatISO8601(field.VerifiedAt); return &s }()
|
||||
}
|
||||
|
||||
fields[i] = mField
|
||||
}
|
||||
|
||||
return fields
|
||||
}
|
||||
|
||||
func (c *converter) AccountToAPIAccountBlocked(ctx context.Context, a *gtsmodel.Account) (*apimodel.Account, error) {
|
||||
var (
|
||||
acct string
|
||||
|
Reference in New Issue
Block a user