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: Treat user as nullable #1454

Merged
merged 1 commit into from
Jun 14, 2024
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 Mail/Views/Alerts/LogoutConfirmationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct LogoutConfirmationView: View {
Text(MailResourcesStrings.Localizable.confirmLogoutTitle)
.textStyle(.bodyMedium)
.padding(.bottom, UIPadding.alertTitleBottom)
Text(MailResourcesStrings.Localizable.confirmLogoutDescription(account.user.email))
Text(MailResourcesStrings.Localizable.confirmLogoutDescription(account.user?.email ?? ""))
.textStyle(.bodySecondary)
.padding(.bottom, UIPadding.alertDescriptionBottom)
ModalButtonsView(primaryButtonTitle: MailResourcesStrings.Localizable.buttonConfirm, primaryButtonAction: logout)
Expand Down
2 changes: 1 addition & 1 deletion Mail/Views/Bottom sheets/Actions/ActionsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct ActionsView: View {
target messages: [Message],
origin: ActionOrigin,
completionHandler: ((Action) -> Void)? = nil) {
let userIsStaff = mailboxManager.account.user.isStaff ?? false
let userIsStaff = mailboxManager.account.user?.isStaff ?? false
let actions = Action.actionsForMessages(messages, origin: origin, userIsStaff: userIsStaff)
quickActions = actions.quickActions
listActions = actions.listActions
Expand Down
5 changes: 3 additions & 2 deletions MailCore/Models/Contact/CommonContact.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ public final class CommonContact: Identifiable {
if correspondent.isMe(currentMailboxEmail: contextMailboxManager.mailbox.email) {
fullName = MailResourcesStrings.Localizable.contactMe
color = UIColor.backgroundColor(from: email.hash, with: UIConstants.avatarColors)
if correspondent.isCurrentUser(currentAccountEmail: contextMailboxManager.account.user.email),
let avatarString = contextMailboxManager.account.user.avatar,
if let currentUser = contextMailboxManager.account.user,
correspondent.isCurrentUser(currentAccountEmail: currentUser.email),
let avatarString = currentUser.avatar,
let avatarURL = URL(string: avatarString) {
avatarImageRequest = AvatarImageRequest(imageRequest: ImageRequest(url: avatarURL), shouldAuthenticate: false)
} else {
Expand Down
Loading