@@ -52,6 +52,7 @@ @interface PRDetailViewController ()<UITableViewDataSource, UITableViewDelegate,
5252@property (strong , nonatomic ) ResourceReference *resourceReference;
5353@property (strong , nonatomic ) NSMutableArray *activityList;
5454@property (strong , nonatomic ) NSMutableArray *activityCList;
55+ @property (strong , nonatomic ) NSMutableArray *allDiscussions;
5556@end
5657
5758@implementation PRDetailViewController
@@ -74,6 +75,7 @@ - (void)viewDidLoad{
7475 [super viewDidLoad ];
7576 self.activityList = [[NSMutableArray alloc ] init ];
7677 self.activityCList = [[NSMutableArray alloc ] init ];
78+ self.allDiscussions = [[NSMutableArray alloc ] init ];
7779 self.title = [NSString stringWithFormat: @" %@ #%@ " , _curMRPR.des_project_name, _curMRPR.iid.stringValue];
7880 self.referencePath = [NSString stringWithFormat: @" /api/user/%@ /project/%@ /resource_reference/%@ " , _curMRPR.des_owner_name, _curMRPR.des_project_name,self .curMRPR.iid];
7981 self.activityPath = [NSString stringWithFormat: @" /api/user/%@ /project/%@ /git/merge/%@ /activities" , _curMRPR.des_owner_name, _curMRPR.des_project_name,self .curMRPR.iid];
@@ -160,8 +162,8 @@ - (void)configBottomView{
160162
161163-(void )sortActivityList {
162164 NSMutableArray *dataArray = [[NSMutableArray alloc ] initWithArray: self .activityList];
163- for (int i = 0 ; i < self.activityCList .count ; i ++) {
164- [dataArray addObject: self .activityCList [i]];
165+ for (int i = 0 ; i < self.allDiscussions .count ; i ++) {
166+ [dataArray addObject: self .allDiscussions [i]];
165167 }
166168 // NSArray *sortedArray = [[NSArray alloc] initWithArray:dataArray];
167169 self.activityList = [dataArray sortedArrayUsingComparator: ^NSComparisonResult (ProjectLineNote *obj1, ProjectLineNote *obj2) {
@@ -192,26 +194,31 @@ - (void)refresh{
192194 NSMutableArray *resultA = weakSelf.curMRPRInfo .discussions ;
193195 if (resultA != nil ){
194196 BOOL flag = false ;
195- if (weakSelf.activityCList == nil || weakSelf.activityCList .count <= 0 ) {
197+ if (weakSelf.allDiscussions == nil || weakSelf.allDiscussions .count <= 0 ) {
196198 for (int i = 0 ; i<resultA.count ; i ++) {
197199 NSArray *pArray = resultA[i];
198200 ProjectLineNote* addTmp = pArray[0 ];
199-
200- [weakSelf.activityCList addObject: addTmp];
201+ if (addTmp.path != nil ) {
202+ addTmp.action = @" mergeChanges" ;
203+ }
204+ [weakSelf.allDiscussions addObject: addTmp];
201205 }
202206
203207 } else {
204208 for (int i = 0 ; i< resultA.count ; i++) {
205209 NSArray *pArray = resultA[i];
206210 ProjectLineNote* addTmp = [pArray firstObject ];
211+ if (addTmp.path != nil ) {
212+ addTmp.action = @" mergeChanges" ;
213+ }
207214 flag = false ;
208- for (int j = 0 ; j < weakSelf.activityCList .count ; j ++) {
209- ProjectLineNote* addTmp1 = weakSelf.activityCList [j];
215+ for (int j = 0 ; j < weakSelf.allDiscussions .count ; j ++) {
216+ ProjectLineNote* addTmp1 = weakSelf.allDiscussions [j];
210217 if (addTmp.id == addTmp1.id ) {
211218 flag = true ;
212219 }
213220 }
214- [weakSelf.activityCList addObject: addTmp];
221+ [weakSelf.allDiscussions addObject: addTmp];
215222 }
216223 }
217224 }
@@ -246,9 +253,6 @@ - (void)refresh{
246253 weakSelf.resourceReference = [NSObject objectOfClass: @" ResourceReference" fromJSON: data[@" data" ]];
247254 [weakSelf.myTableView reloadData ];
248255 }
249- [weakSelf.view configBlankPage: EaseBlankPageTypeView hasData: (_curMRPRInfo != nil ) hasError: (error != nil ) reloadButtonBlock: ^(id sender) {
250- [weakSelf refresh ];
251- }];
252256 }];
253257
254258
@@ -261,7 +265,6 @@ - (void)refresh{
261265 if (weakSelf.activityList == nil || weakSelf.activityList .count <= 0 ) {
262266 for (int i = 0 ; i<resultA.count ; i ++) {
263267 ProjectLineNote* addTmp = resultA[i];
264-
265268 [weakSelf.activityList addObject: addTmp];
266269 }
267270 } else {
@@ -281,9 +284,6 @@ - (void)refresh{
281284 [weakSelf.myTableView reloadData ];
282285 }
283286 }
284- [weakSelf.view configBlankPage: EaseBlankPageTypeView hasData: (_curMRPRInfo != nil ) hasError: (error != nil ) reloadButtonBlock: ^(id sender) {
285- [weakSelf refresh ];
286- }];
287287 }];
288288
289289 // 推送过来的页面,可能 curProject 对象为空
@@ -493,18 +493,18 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
493493 }
494494 }else if (self.activityList .count > 0 && indexPath.section == 3 ){// Comment
495495 ProjectLineNote *curCommentItem = self.activityList [indexPath.row];
496- if (curCommentItem.noteable_type ! = nil ) {
496+ if (curCommentItem.action = = nil ) {
497497 DynamicCommentCell *cell = [tableView dequeueReusableCellWithIdentifier: curCommentItem.htmlMedia.imageItems.count> 0 ? kCellIdentifier_DynamicCommentCell_Media: kCellIdentifier_DynamicCommentCell forIndexPath: indexPath];
498498 cell.curComment = curCommentItem;
499499 cell.contentLabel .delegate = self;
500- [cell configTop: (indexPath.row == 0 ) andBottom: (indexPath.row == _curMRPRInfo .discussions.count - 1 )];
500+ [cell configTop: (indexPath.row == 0 ) andBottom: (indexPath.row == self .activityList.count + self .curMRPRInfo .discussions.count - 1 )];
501501 cell.backgroundColor = kColorTableBG ;
502502 return cell;
503503 } else {
504504
505505 DynamicActivityCell *cell = [tableView dequeueReusableCellWithIdentifier: kCellIdentifier_DynamicActivityCell forIndexPath: indexPath];
506506 cell.curActivity = curCommentItem;
507- [cell configTop: (indexPath.row == 0 ) andBottom: (indexPath.row == self .activityList.count - 1 )];
507+ [cell configTop: (indexPath.row == 0 ) andBottom: (indexPath.row == self .activityList.count + self .curMRPRInfo.discussions.count - 1 )];
508508 cell.backgroundColor = kColorTableBG ;
509509 return cell;
510510 }
@@ -559,10 +559,10 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
559559 }else if (self.activityList .count > 0 && indexPath.section == 3 ){// Comment
560560 NSLog (@" test %lu " , indexPath.row );
561561 ProjectLineNote *curCommentItem = self.activityList [indexPath.row];
562- if (curCommentItem.noteable_type ! = nil ) {
562+ if (curCommentItem.action = = nil ) {
563563 return [DynamicCommentCell cellHeightWithObj: curCommentItem];
564564 } else {
565- return [DynamicActivityCell cellHeightWithObj: curCommentItem];
565+ return [DynamicActivityCell cellHeightWithObj: curCommentItem contentHeight: 0 ];
566566 }
567567 }else {// Add Comment
568568 return [AddCommentCell cellHeight ];
@@ -602,6 +602,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
602602 if (![self CurrentUserIsOwer ]) return ;
603603 NSArray *apparray= [[NSBundle mainBundle ]loadNibNamed:@" ReviewerListController" owner: nil options: nil ];
604604 ReviewerListController *appview=[apparray firstObject ];
605+ appview.currentProject = self.curProject ;
605606 appview.reviewers = self.curReviewersInfo .reviewers ;
606607 appview.volunteer_reviewers = self.curReviewersInfo .volunteer_reviewers ;
607608
0 commit comments