Skip to content

Commit

Permalink
fix: models.CredentialAccount.Source.Privacy
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmo-ds committed Dec 11, 2023
1 parent 85c690f commit bdd1eed
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 43 deletions.
25 changes: 6 additions & 19 deletions models/Account.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
package models

type PostPrivacy = string

const (
// PostPrivacyPublic Public post
PostPrivacyPublic PostPrivacy = "public"
// PostPrivacyUnlisted Unlisted post
PostPrivacyUnlisted PostPrivacy = "unlisted"
// PostPrivacyPrivate Followers-only post
PostPrivacyPrivate PostPrivacy = "private"
// PostPrivacyDirect Direct post
PostPrivacyDirect PostPrivacy = "direct"
)

type Account struct {
ID string `json:"id"`
Username string `json:"username"`
Expand Down Expand Up @@ -49,12 +36,12 @@ type AccountField struct {
type CredentialAccount struct {
Account
Source struct {
Privacy PostPrivacy `json:"privacy"`
Sensitive bool `json:"sensitive"`
Language string `json:"language"`
Note string `json:"note"`
Fields []AccountField `json:"fields"`
FollowRequestsCount int `json:"follow_requests_count"`
Privacy StatusVisibility `json:"privacy"`
Sensitive bool `json:"sensitive"`
Language string `json:"language"`
Note string `json:"note"`
Fields []AccountField `json:"fields"`
FollowRequestsCount int `json:"follow_requests_count"`
} `json:"source"`
Role *struct {
Id string `json:"id"`
Expand Down
2 changes: 1 addition & 1 deletion models/Instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type (
SupportedMimeTypes []string `json:"supported_mime_types"`
} `json:"media_attachments"`
} `json:"configuration"`
ContactAccount Account `json:"contact_account"`
ContactAccount *Account `json:"contact_account,omitempty"`
Rules []InstanceRule `json:"rules"`
}
InstanceUrls struct {
Expand Down
47 changes: 24 additions & 23 deletions models/MkUser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,30 @@ import (
)

type MkUser struct {
ID string `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
Host *string `json:"host,omitempty"`
Location *string `json:"location"`
Description *string `json:"description"`
IsBot bool `json:"isBot"`
IsLocked bool `json:"isLocked"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt *string `json:"updatedAt"`
FollowersCount int `json:"followersCount"`
FollowingCount int `json:"followingCount"`
NotesCount int `json:"notesCount"`
AvatarUrl string `json:"avatarUrl"`
BannerUrl string `json:"bannerUrl"`
Fields []AccountField `json:"fields"`
Instance MkInstance `json:"instance"`
Mentions []string `json:"mentions"`
IsMuted bool `json:"isMuted"`
IsBlocked bool `json:"isBlocked"`
IsBlocking bool `json:"isBlocking"`
IsFollowing bool `json:"isFollowing"`
IsFollowed bool `json:"isFollowed"`
ID string `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
Host *string `json:"host,omitempty"`
Location *string `json:"location"`
Description *string `json:"description"`
IsBot bool `json:"isBot"`
IsLocked bool `json:"isLocked"`
CreatedAt string `json:"createdAt,omitempty"`
UpdatedAt *string `json:"updatedAt"`
FollowersCount int `json:"followersCount"`
FollowingCount int `json:"followingCount"`
NotesCount int `json:"notesCount"`
AvatarUrl string `json:"avatarUrl"`
BannerUrl string `json:"bannerUrl"`
Fields []AccountField `json:"fields"`
Instance MkInstance `json:"instance"`
Mentions []string `json:"mentions"`
IsMuted bool `json:"isMuted"`
IsBlocked bool `json:"isBlocked"`
IsBlocking bool `json:"isBlocking"`
IsFollowing bool `json:"isFollowing"`
IsFollowed bool `json:"isFollowed"`
FfVisibility MkNoteVisibility `json:"ffVisibility,omitempty"`
}

type MkInstance struct {
Expand Down
1 change: 1 addition & 0 deletions proxy/misskey/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func VerifyCredentials(ctx misstodon.Context) (models.CredentialAccount, error)
info.Source.Note = *result.Description
}
info.Source.Fields = info.Account.Fields
info.Source.Privacy = result.FfVisibility.ToStatusVisibility()
return info, nil
}

Expand Down

0 comments on commit bdd1eed

Please sign in to comment.