Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix - allow .admin value on APIPerson to be considered optional #600

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mlem/API/Models/Person/APIPerson.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct APIPerson: Decodable, Identifiable, Hashable {
let deleted: Bool
let sharedInboxUrl: URL?
let matrixUserId: String?
let admin: Bool
let admin: Bool? // this is no longer returned on beehaw...
let botAccount: Bool
let banExpires: Date?
let instanceId: Int
Expand Down
5 changes: 3 additions & 2 deletions Mlem/Views/Shared/Links/User/UserLabelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ struct UserLabelView: View {
@State var communityContext: GetCommunityResponse?

var blurAvatar: Bool { postContext?.nsfw ?? false ||
communityContext?.communityView.community.nsfw ?? false }
communityContext?.communityView.community.nsfw ?? false
}

init(
user: APIPerson,
Expand Down Expand Up @@ -146,7 +147,7 @@ struct UserLabelView: View {
return UserLabelView.flairDeveloper
}
}
if user.admin {
if user.admin == true {
return UserLabelView.flairAdmin
}
if user.botAccount {
Expand Down
2 changes: 1 addition & 1 deletion Mlem/Views/Shared/Posts/Post Sizes/Headline Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct HeadlinePost: View {

// computed
var usernameColor: Color {
if post.creator.admin {
if post.creator.admin == true {
return .red
}
if post.creator.botAccount {
Expand Down