diff --git a/Kickstarter-iOS/Features/Comments/Controllers/CommentRepliesViewController.swift b/Kickstarter-iOS/Features/Comments/Controllers/CommentRepliesViewController.swift index 19a5ff8d9e..277ca7f4e1 100644 --- a/Kickstarter-iOS/Features/Comments/Controllers/CommentRepliesViewController.swift +++ b/Kickstarter-iOS/Features/Comments/Controllers/CommentRepliesViewController.swift @@ -198,8 +198,14 @@ final class CommentRepliesViewController: UITableViewController, MessageBannerVi } private func handleCommentCellHeaderTapped(in cell: UITableViewCell, _ author: Comment.Author) { - guard AppEnvironment.current.currentUser != nil, featureBlockUsersEnabled() else { return } - guard author.isBlocked == false else { return } + guard + featureBlockUsersEnabled(), + let currentUser = AppEnvironment.current.currentUser, + String(currentUser.id) != author.id, + !author.isBlocked + else { + return + } let actionSheet = UIAlertController .blockUserActionSheet( diff --git a/Kickstarter-iOS/Features/Comments/Controllers/CommentsViewController.swift b/Kickstarter-iOS/Features/Comments/Controllers/CommentsViewController.swift index 4fc9caec91..66b3aaeaa8 100644 --- a/Kickstarter-iOS/Features/Comments/Controllers/CommentsViewController.swift +++ b/Kickstarter-iOS/Features/Comments/Controllers/CommentsViewController.swift @@ -268,8 +268,14 @@ extension CommentsViewController { extension CommentsViewController: CommentCellDelegate { func commentCellDidTapHeader(_ cell: CommentCell, _ author: Comment.Author) { - guard AppEnvironment.current.currentUser != nil, featureBlockUsersEnabled() else { return } - guard author.isBlocked == false else { return } + guard + featureBlockUsersEnabled(), + let currentUser = AppEnvironment.current.currentUser, + String(currentUser.id) != author.id, + !author.isBlocked + else { + return + } let actionSheet = UIAlertController .blockUserActionSheet( diff --git a/Kickstarter-iOS/Features/Messages/Controller/MessagesViewController.swift b/Kickstarter-iOS/Features/Messages/Controller/MessagesViewController.swift index d9178c246c..cd0ea9b87c 100644 --- a/Kickstarter-iOS/Features/Messages/Controller/MessagesViewController.swift +++ b/Kickstarter-iOS/Features/Messages/Controller/MessagesViewController.swift @@ -224,8 +224,9 @@ extension MessagesViewController: BackingCellDelegate { extension MessagesViewController: MessageCellDelegate { func messageCellDidTapHeader(_ cell: MessageCell, _ user: User) { guard - AppEnvironment.current.currentUser != nil, featureBlockUsersEnabled(), + let currentUser = AppEnvironment.current.currentUser, + currentUser != user, !user.isBlocked else { return diff --git a/Kickstarter-iOS/Features/ProjectPage/Controller/ProjectPageViewController.swift b/Kickstarter-iOS/Features/ProjectPage/Controller/ProjectPageViewController.swift index 15640280e9..4429f29f7b 100644 --- a/Kickstarter-iOS/Features/ProjectPage/Controller/ProjectPageViewController.swift +++ b/Kickstarter-iOS/Features/ProjectPage/Controller/ProjectPageViewController.swift @@ -997,8 +997,9 @@ extension ProjectPageViewController: ProjectPamphletMainCellDelegate { goToCreatorForProject project: Project ) { guard - AppEnvironment.current.currentUser != nil, featureBlockUsersEnabled(), + let currentUser = AppEnvironment.current.currentUser, + currentUser != project.creator, !project.creator.isBlocked else { self.goToCreatorProfile(forProject: project) diff --git a/KsApi/models/User.swift b/KsApi/models/User.swift index 2f321e1a4c..98cb34cdd0 100644 --- a/KsApi/models/User.swift +++ b/KsApi/models/User.swift @@ -142,7 +142,7 @@ extension User: Decodable { case isAdmin = "is_admin" case isEmailVerified = "is_email_verified" case isFriend = "is_friend" - case isBlocked = "is_blocked" + case isBlocked case location case name case needsFreshFacebookToken = "needs_fresh_facebook_token" @@ -163,7 +163,7 @@ extension User: EncodableType { result["is_admin"] = self.isAdmin ?? false result["is_email_verified"] = self.isEmailVerified ?? false result["is_friend"] = self.isFriend ?? false - result["is_blocked"] = self.isBlocked ?? false + result["isBlocked"] = self.isBlocked ?? false result["location"] = self.location?.encode() result["name"] = self.name result["needs_password"] = self.needsPassword ?? false diff --git a/KsApi/models/UserTests.swift b/KsApi/models/UserTests.swift index b814a21978..49ae1f9e0d 100644 --- a/KsApi/models/UserTests.swift +++ b/KsApi/models/UserTests.swift @@ -40,7 +40,7 @@ final class UserTests: XCTestCase { "is_admin": false, "is_email_verified": false, "is_friend": false, - "is_blocked": false, + "isBlocked": false, "opted_out_of_recommendations": true, "show_public_profile": false, "social": true @@ -99,7 +99,7 @@ final class UserTests: XCTestCase { "is_admin": false, "is_email_verified": false, "is_friend": false, - "is_blocked": true, + "isBlocked": true, "opted_out_of_recommendations": true, "show_public_profile": false, "social": true