Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 3eb648a

Browse files
Huddiernystrom
authored andcommitted
Merge button status (#2189)
* Addresses #2178 Shows merge status without button when you cannot merge. * Swift naming
1 parent cbb20f8 commit 3eb648a

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

Classes/Issues/IssuesViewController.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,7 @@ final class IssuesViewController:
439439
// side effect so to jump to the last element when auto scrolling
440440
lastTimelineElement = objects.last
441441

442-
if viewerIsCollaborator,
443-
current.labels.status.status == .open,
442+
if current.labels.status.status == .open,
444443
let merge = current.mergeModel {
445444
objects.append(merge)
446445
}
@@ -478,7 +477,12 @@ final class IssuesViewController:
478477

479478
// controls
480479
case is IssueNeckLoadModel: return IssueNeckLoadSectionController(delegate: self)
481-
case is IssueMergeModel: return IssueMergeSectionController(model: model, client: client, resultID: resultID)
480+
case is IssueMergeModel: return IssueMergeSectionController(
481+
model: model,
482+
client: client,
483+
mergeCapable: viewerIsCollaborator,
484+
resultID: resultID
485+
)
482486

483487
// deprecated
484488
case is IssueDiffHunkModel: return IssueDiffHunkSectionController()

Classes/Issues/Merge/IssueMergeSectionController.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ ListBindingSectionControllerSelectionDelegate {
1717
private let model: IssueDetailsModel
1818
private let client: GithubClient
1919
private let resultID: String?
20+
private var isMergeCapable = false
2021
private var loading = false
2122

22-
init(model: IssueDetailsModel, client: GithubClient, resultID: String?) {
23+
init(
24+
model: IssueDetailsModel,
25+
client: GithubClient,
26+
mergeCapable: Bool,
27+
resultID: String?
28+
) {
2329
self.model = model
2430
self.client = client
31+
self.isMergeCapable = mergeCapable
2532
self.resultID = resultID
2633
super.init()
2734
dataSource = self
@@ -122,11 +129,13 @@ ListBindingSectionControllerSelectionDelegate {
122129
state: state
123130
))
124131

125-
viewModels.append(IssueMergeButtonModel(
126-
enabled: buttonEnabled,
127-
type: preferredMergeType,
128-
loading: loading
129-
))
132+
if isMergeCapable {
133+
viewModels.append(IssueMergeButtonModel(
134+
enabled: buttonEnabled,
135+
type: preferredMergeType,
136+
loading: loading
137+
))
138+
}
130139

131140
return viewModels
132141
}

Classes/Notifications/NotificationsViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ ReviewGitHubAccessDelegate
5555

5656
makeBackBarItemEmpty()
5757
resetRightBarItem()
58-
58+
5959
switch inboxType {
6060
case .unread:
6161
let item = UIBarButtonItem(
62-
image: UIImage(named: "bullets-hollow"),
62+
image: UIImage(named: "filter"),
6363
style: .plain,
6464
target: self,
6565
action: #selector(NotificationsViewController.onMore(sender:))

0 commit comments

Comments
 (0)