Skip to content

Commit

Permalink
fix - allow .admin value on APIPerson to be considered optional (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mormaer authored Sep 14, 2023
1 parent 5e95c0b commit 9aaa24f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
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

0 comments on commit 9aaa24f

Please sign in to comment.