Skip to content

Commit

Permalink
Show domain-block not for my instance (#1269) (#1270)
Browse files Browse the repository at this point in the history
Show domain-block not for my instance (#1259)
  • Loading branch information
zeitschlag authored Apr 10, 2024
1 parent 1a2cf27 commit a979287
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions Mastodon/Scene/Profile/ProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -418,22 +418,31 @@ extension ProfileViewController {
}

private func bindMoreBarButtonItem() {
Publishers.CombineLatest(
Publishers.CombineLatest3(
viewModel.$account,
viewModel.$me,
viewModel.$relationship
)
.asyncMap { [weak self] user, relationship -> UIMenu? in
guard let self, let relationship, let domain = user.domainFromAcct else { return nil }
.asyncMap { [weak self] user, me, relationship -> UIMenu? in
guard let self, let relationship, let domain = user.domainFromAcct, let myDomain = me.domainFromAcct else { return nil }

let name = user.displayNameWithFallback

var menuActions: [MastodonMenu.Action] = [
.muteUser(.init(name: name, isMuting: relationship.muting)),
.blockUser(.init(name: name, isBlocking: relationship.blocking)),
.blockDomain(.init(domain: domain, isBlocking: relationship.domainBlocking)),
.blockUser(.init(name: name, isBlocking: relationship.blocking))
]

if myDomain != domain {
menuActions.append(
.blockDomain(.init(domain: domain, isBlocking: relationship.domainBlocking))
)
}

menuActions.append(contentsOf: [
.reportUser(.init(name: name)),
.shareUser(.init(name: name)),
]
])

if relationship.following {
let showReblogs = relationship.showingReblogs// me.showingReblogsBy.contains(user)
Expand Down

0 comments on commit a979287

Please sign in to comment.