Skip to content

Commit bffe241

Browse files
committed
【分支管理】 web 添加保护分支管理员动态消息,app 需同步
1 parent f339848 commit bffe241

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

Coding_iOS/Controllers/ProjectMemberActivityListViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,16 @@ - (void)goToVCWithItem:(HtmlMediaItem *)clickedItem activity:(ProjectActivity *)
167167
}else{
168168
linkPath = proAct.wiki_path;
169169
}
170+
}else if ([target_type isEqualToString:@"BranchMember"]){
171+
if ([@[@"add", @"remove"] containsObject:proAct.action]) {
172+
linkPath = [NSString stringWithFormat:@"/u/%@", proAct.target_user.global_key];
173+
}else{//deny_push/allow_push
174+
ProjectViewController *vc = [ProjectViewController codeVCWithCodeRef:proAct.ref_name andProject:project];
175+
[self.navigationController pushViewController:vc animated:YES];
176+
}
177+
}else if ([target_type isEqualToString:@"ProtectedBranch"]){
178+
ProjectViewController *vc = [ProjectViewController codeVCWithCodeRef:proAct.ref_name andProject:project];
179+
[self.navigationController pushViewController:vc animated:YES];
170180
}else{
171181
if ([target_type isEqualToString:@"Project"]){//转让项目之类的
172182
// }else if ([target_type isEqualToString:@"MergeRequestComment"]){//过期类型,已用CommitLineNote替代

Coding_iOS/Controllers/ProjectViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,16 @@ - (void)goToVCWithItem:(HtmlMediaItem *)clickedItem activity:(ProjectActivity *)
551551
}else{
552552
linkPath = proAct.wiki_path;
553553
}
554+
}else if ([target_type isEqualToString:@"BranchMember"]){
555+
if ([@[@"add", @"remove"] containsObject:proAct.action]) {
556+
linkPath = [NSString stringWithFormat:@"/u/%@", proAct.target_user.global_key];
557+
}else{//deny_push/allow_push
558+
ProjectViewController *vc = [ProjectViewController codeVCWithCodeRef:proAct.ref_name andProject:project];
559+
[self.navigationController pushViewController:vc animated:YES];
560+
}
561+
}else if ([target_type isEqualToString:@"ProtectedBranch"]){
562+
ProjectViewController *vc = [ProjectViewController codeVCWithCodeRef:proAct.ref_name andProject:project];
563+
[self.navigationController pushViewController:vc animated:YES];
554564
}else{
555565
if ([target_type isEqualToString:@"Project"]){//转让项目之类的
556566
// }else if ([target_type isEqualToString:@"MergeRequestComment"]){//过期类型,已用CommitLineNote替代

Coding_iOS/Models/ProjectActivity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@interface ProjectActivity : NSObject
2222
@property (readwrite, nonatomic, strong) NSNumber *id;
23-
@property (readwrite, nonatomic, strong) NSString *target_type, *action, *action_msg, *type, *ref, *ref_type, *ref_path, *pull_request_title, *merge_request_title, *comment_content, *merge_request_path, *pull_request_path, *version, *wiki_title, *wiki_path, *old_name;
23+
@property (readwrite, nonatomic, strong) NSString *target_type, *action, *action_msg, *type, *ref, *ref_type, *ref_path, *pull_request_title, *merge_request_title, *comment_content, *merge_request_path, *pull_request_path, *version, *wiki_title, *wiki_path, *old_name, *ref_name;
2424
@property (readwrite, nonatomic, strong) User *user, *target_user, *watcher;
2525
@property (readwrite, nonatomic, strong) NSDate *created_at;
2626
@property (readwrite, nonatomic, strong) Task *origin_task, *task;

Coding_iOS/Models/ProjectActivity.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ - (NSMutableString *)actionStr{
138138
if ([_action isEqualToString:@"comment"]) {
139139
[_actionStr appendFormat:@"%@", _project_topic.parent.title];
140140
}
141+
}else if ([_target_type isEqualToString:@"BranchMember"]){
142+
if ([@[@"add", @"remove"] containsObject:_action]) {
143+
[_actionStr appendString:@"分支管理员"];
144+
}else{//deny_push/allow_push
145+
[self addActionUser:self.target_user];
146+
[_actionStr appendString:@"直接 Push 保护分支"];
147+
}
148+
}else if ([_target_type isEqualToString:@"ProtectedBranch"]){
149+
// enable_protected_branch/allow_force_push/disable_protected_branch
141150
}else if ([_target_type isEqualToString:@"ProjectFile"]){
142151
if ([_action isEqualToString:@"rename"]) {
143152
[_actionStr appendString:@"修改了文件名称"];
@@ -259,6 +268,14 @@ - (NSMutableString *)contentStr{
259268
[_contentStr appendFormat:@"%@", _wiki_title];
260269
}else if ([_target_type isEqualToString:@"ProjectTweet"]){
261270
[_contentStr saveAppendString:_content];
271+
}else if ([_target_type isEqualToString:@"BranchMember"]){
272+
if ([@[@"add", @"remove"] containsObject:_action]) {
273+
[_contentStr saveAppendString:self.target_user.name];
274+
}else{//deny_push/allow_push
275+
[_contentStr saveAppendString:self.ref_name];
276+
}
277+
}else if ([_target_type isEqualToString:@"ProtectedBranch"]){
278+
[_contentStr saveAppendString:self.ref_name];
262279
}else{
263280
[_contentStr appendString:@"**未知**"];
264281
}

0 commit comments

Comments
 (0)