Skip to content

Commit 2d465a4

Browse files
committed
can_edit_src_branch
1 parent b967f19 commit 2d465a4

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

Coding_iOS/Controllers/MRPRAcceptViewController.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ - (void)viewDidLoad{
2929

3030
self.curMRPR = self.curMRPRInfo.mrpr;
3131
self.curMRPR.del_source_branch = YES;
32+
self.curMRPR.can_edit_src_branch = ([_curMRPR isMR] && _curMRPRInfo.can_edit_src_branch.boolValue);
3233

3334
NSString *fromStr, *toStr;
3435
if (_curMRPR.isMR) {
@@ -60,7 +61,11 @@ - (void)viewDidLoad{
6061

6162
#pragma mark TableM
6263
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
63-
return 2;
64+
if ([_curMRPR isMR] && _curMRPRInfo.can_edit_src_branch.boolValue) {
65+
return 2;
66+
}else{
67+
return 1;
68+
}
6469
}
6570
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
6671
return 1;

Coding_iOS/Controllers/MRPRDetailViewController.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ - (void)actionMRPR:(UIButton *)sender{
190190
NSString *tipStr;
191191
if (sender.tag == MRPRActionAccept) {//合并
192192
if (_curMRPRInfo.mrpr.status == MRPRStatusCannotMerge) {//不能合并
193-
tipStr =
194-
@"呃... \nCoding 不能帮你在线自动合并这个合并请求。";
193+
tipStr = @"Coding 不能帮你在线自动合并这个合并请求。";
195194
kTipAlert(@"%@", tipStr);
196195
}else{
197196
MRPRAcceptViewController *vc = [MRPRAcceptViewController new];

Coding_iOS/Models/MRPR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef NS_ENUM(NSInteger, MRPRStatus) {
2828
@property (assign, nonatomic) BOOL isLoading;
2929

3030
//Post
31-
@property (assign, nonatomic) BOOL del_source_branch;
31+
@property (assign, nonatomic) BOOL del_source_branch, can_edit_src_branch;
3232
@property (strong, nonatomic) NSString *message;
3333

3434
+ (MRPR *)mrprWithPath:(NSString *)path;

Coding_iOS/Models/MRPR.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ - (NSString *)toAcceptPath{
7171
return [[self p_prePath] stringByAppendingString:@"merge"];
7272
}
7373
- (NSDictionary *)toAcceptParams{
74-
return @{@"del_source_branch": _del_source_branch? @"true": @"false",
75-
@"message" : _message? _message: @""};
74+
if (_can_edit_src_branch) {
75+
return @{@"del_source_branch": _del_source_branch? @"true": @"false",
76+
@"message" : _message? _message: @""};
77+
}else{
78+
return @{@"message" : _message? _message: @""};
79+
}
7680
}
7781
- (NSString *)toRefusePath{
7882
return [[self p_prePath] stringByAppendingString:@"refuse"];

0 commit comments

Comments
 (0)