Skip to content

Commit

Permalink
hide author in posts search screen if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Momo Ozawa committed Nov 2, 2023
1 parent 1d02093 commit 8609031
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ class AbstractPostListViewController: UIViewController,
}
}

var shouldHideAuthor: Bool {
guard filterSettings.canFilterByAuthor() else {
return true
}
return filterSettings.currentPostAuthorFilter() == .mine
}

private let buttonAuthorFilter = AuthorFilterButton()

let refreshControl = UIRefreshControl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class PostListItemViewModel {
var statusColor: UIColor { statusViewModel.statusColor }
var accessibilityLabel: String? { makeAccessibilityLabel(for: post, statusViewModel: statusViewModel) }

init(post: Post, shouldHideAuthor: Bool = false) {
init(post: Post, shouldHideAuthor: Bool) {
self.post = post
self.content = makeContentString(for: post)
self.imageURL = post.featuredImageURL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ class PostListViewController: AbstractPostListViewController, UIViewControllerRe
}
}

private var shouldHideAuthor: Bool {
guard filterSettings.canFilterByAuthor() else {
return true
}
return filterSettings.currentPostAuthorFilter() == .mine
}

/// If set, when the post list appear it will show the tab for this status
var initialFilterWithPostStatus: BasePost.Status?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class PostSearchViewController: UIViewController, UITableViewDelegate, UIS
case let post as Post:
let cell = tableView.dequeueReusableCell(withIdentifier: Constants.postCellID, for: indexPath) as! PostListCell
assert(listViewController is InteractivePostViewDelegate)
let viewModel = PostListItemViewModel(post: post)
let viewModel = PostListItemViewModel(post: post, shouldHideAuthor: listViewController?.shouldHideAuthor ?? false)
cell.configure(with: viewModel, delegate: listViewController as? InteractivePostViewDelegate)
updateHighlights(for: [cell], searchTerm: self.viewModel.searchTerm)
return cell
Expand Down

0 comments on commit 8609031

Please sign in to comment.