@@ -61,6 +61,8 @@ @interface MRDetailViewController ()<UITableViewDataSource, UITableViewDelegate,
61
61
@property (strong , nonatomic ) NSMutableArray *activityList;
62
62
@property (strong , nonatomic ) NSMutableArray *activityCList;
63
63
@property (strong , nonatomic ) NSMutableArray *allDiscussions;
64
+ @property (strong , nonatomic ) NSString *reviewGoodPath;
65
+ @property (assign , nonatomic ) BOOL isLike;
64
66
@end
65
67
66
68
@implementation MRDetailViewController
@@ -88,6 +90,7 @@ - (void)viewDidLoad{
88
90
self.referencePath = [NSString stringWithFormat: @" /api/user/%@ /project/%@ /resource_reference/%@ " , _curMRPR.des_owner_name, _curMRPR.des_project_name,self .curMRPR.iid];
89
91
self.activityPath = [NSString stringWithFormat: @" /api/user/%@ /project/%@ /git/merge/%@ /activities" , _curMRPR.des_owner_name, _curMRPR.des_project_name,self .curMRPR.iid];
90
92
self.diffPath = [NSString stringWithFormat: @" /api/user/%@ /project/%@ /git/merge/%@ /commitDiffContent" ,_curMRPR.des_owner_name, _curMRPR.des_project_name,self .curMRPR.iid];
93
+ self.reviewGoodPath = [NSString stringWithFormat: @" /api/user/%@ /project/%@ /git/merge/%@ /review_good" ,_curMRPR.des_owner_name, _curMRPR.des_project_name,self .curMRPR.iid];
91
94
__weak typeof (self) weakSelf = self;
92
95
_myTableView = ({
93
96
UITableView *tableView = [[UITableView alloc ] initWithFrame: self .view.bounds style: UITableViewStyleGrouped];
@@ -273,17 +276,11 @@ - (void)refresh{
273
276
[weakSelf.view endLoading ];
274
277
[weakSelf.myRefreshControl endRefreshing ];
275
278
if (data) {
276
- if (weakSelf.curMRPRInfo .contentHeight > 1 ) {
277
- [(MRPRBaseInfo *)data setContentHeight: weakSelf.curMRPRInfo.contentHeight];
278
- }
279
+
279
280
weakSelf.curReviewersInfo = data;
280
281
281
282
[weakSelf.myTableView reloadData ];
282
- [weakSelf configBottomView ];
283
283
}
284
- [weakSelf.view configBlankPage: EaseBlankPageTypeView hasData: (_curMRPRInfo != nil ) hasError: (error != nil ) reloadButtonBlock: ^(id sender) {
285
- [weakSelf refresh ];
286
- }];
287
284
}];
288
285
289
286
[[CodingNetAPIClient sharedJsonClient ] requestJsonDataWithPath: self .referencePath withParams: @{@" iid" : _curMRPR.iid } withMethodType: Get andBlock: ^(id data, NSError *error) {
@@ -555,10 +552,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
555
552
else {
556
553
Reviewer* tmpReviewer = [self checkUserisReviewer ];
557
554
if (tmpReviewer == nil ){
555
+ self.isLike = YES ;
558
556
[cell setImageStr: @" PRReviewer" isowner: NO hasLikeMr: YES ];
559
557
} else {
558
+ self.isLike = NO ;
560
559
[cell setImageStr: @" PRReviewer" isowner: NO hasLikeMr: NO ];
561
560
}
561
+
562
562
}
563
563
// [cell setImageStr:@"PRReviewer" andTitle:@"评审者"];
564
564
[tableView addLineforPlainCell: cell forRowAtIndexPath: indexPath withLeftSpace: 50 ];
@@ -687,25 +687,34 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
687
687
}
688
688
}else if (indexPath.section == 2 ){// Disclosure
689
689
if (indexPath.row == 0 ) {
690
- if (![self CurrentUserIsOwer ]) return ;
691
- NSArray *apparray= [[NSBundle mainBundle ]loadNibNamed:@" ReviewerListController" owner: nil options: nil ];
692
- ReviewerListController *appview=[apparray firstObject ];
693
- appview.currentProject = self.curProject ;
694
- appview.curMRPR = self.curMRPR ;
695
690
696
- [self .navigationController pushViewController: appview animated: YES ];
697
- }else {
698
- MRPRFilesViewController *vc = [MRPRFilesViewController new ];
699
- vc.curMRPR = _curMRPR;
700
- vc.curMRPRInfo = _curMRPRInfo;
701
- vc.curProject = _curProject;
702
- [self .navigationController pushViewController: vc animated: YES ];
703
- if ([[FunctionTipsManager shareManager ] needToTip: kFunctionTipStr_LineNote_FileChange ]) {
704
- [[FunctionTipsManager shareManager ] markTiped: kFunctionTipStr_LineNote_FileChange ];
705
- [[FunctionTipsManager shareManager ] markTiped: kFunctionTipStr_LineNote_MRPR ];
706
- NProjectItemCell *cell = (NProjectItemCell *)[tableView cellForRowAtIndexPath: indexPath];
707
- [cell removeTip ];
691
+ if ([self CurrentUserIsOwer ]) {
692
+ NSArray *apparray= [[NSBundle mainBundle ]loadNibNamed:@" ReviewerListController" owner: nil options: nil ];
693
+ ReviewerListController *appview=[apparray firstObject ];
694
+ appview.currentProject = self.curProject ;
695
+ appview.curMRPR = self.curMRPR ;
696
+
697
+ [self .navigationController pushViewController: appview animated: YES ];
708
698
}
699
+ else {
700
+ __weak typeof (self) weakSelf = self;
701
+ if (!self.isLike ) {
702
+ [[CodingNetAPIClient sharedJsonClient ] requestJsonDataWithPath: self .reviewGoodPath withParams: nil withMethodType: Delete andBlock: ^(id data, NSError *error) {
703
+
704
+ [weakSelf refresh ];
705
+
706
+ }];
707
+ } else {
708
+ [[CodingNetAPIClient sharedJsonClient ] requestJsonDataWithPath: self .reviewGoodPath withParams: nil withMethodType: Post andBlock: ^(id data, NSError *error) {
709
+
710
+ [weakSelf refresh ];
711
+
712
+ }];
713
+ }
714
+
715
+ }
716
+ }else {
717
+
709
718
}
710
719
}else if (self.activityList .count > 0 && indexPath.section == 3 ){// Comment
711
720
0 commit comments