Skip to content

Commit

Permalink
Optional fields
Browse files Browse the repository at this point in the history
  • Loading branch information
benpate committed Aug 29, 2024
1 parent 0c83e49 commit db84e68
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ func (user User) GetJSONLD() mapof.Any {
vocab.PropertyURL: user.ProfileURL,
vocab.PropertyName: user.DisplayName,
vocab.PropertyPreferredUsername: user.Username,
vocab.PropertySummary: user.StatusMessage,
vocab.PropertyTootDiscoverable: user.IsDiscoverable,
vocab.PropertyTootIndexable: user.IsIndexable,
vocab.PropertyInbox: user.ActivityPubInboxURL(),
Expand All @@ -246,25 +245,25 @@ func (user User) GetJSONLD() mapof.Any {
vocab.PropertyFollowers: user.ActivityPubFollowersURL(),
vocab.PropertyLiked: user.ActivityPubLikedURL(),
vocab.PropertyBlocked: user.ActivityPubBlockedURL(),
}

if user.StatusMessage != "" {
result[vocab.PropertySummary] = user.StatusMessage
}

vocab.PropertyIcon: mapof.Any{
if iconURL := user.ActivityPubIconURL(); iconURL != "" {
result[vocab.PropertyIcon] = mapof.Any{
vocab.PropertyType: vocab.ObjectTypeImage,
vocab.PropertyMediaType: "image/webp",
vocab.PropertyURL: user.ActivityPubIconURL(),
},
}
}

vocab.PropertyImage: mapof.Any{
if imageURL := user.ActivityPubImageURL(); imageURL != "" {
result[vocab.PropertyImage] = mapof.Any{
vocab.PropertyType: vocab.ObjectTypeImage,
vocab.PropertyMediaType: "image/webp",
vocab.PropertyURL: user.ActivityPubImageURL(),
},
}

// Conditionally add the Avatar URL
if avatarURL := user.ActivityPubIconURL(); avatarURL != "" {
result["icon"] = mapof.Any{
vocab.PropertyType: vocab.ObjectTypeImage,
vocab.PropertyURL: avatarURL,
}
}

Expand Down

0 comments on commit db84e68

Please sign in to comment.