Skip to content

Commit 29ca507

Browse files
committed
user_id 改为 user_global_key
1 parent b750ab7 commit 29ca507

11 files changed

Lines changed: 18 additions & 21 deletions

Coding_iOS/Controllers/EditTaskViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ - (void)doCommentToComment:(TaskComment *)toComment sender:(id)sender{
528528
_myMsgInputView.toUser = toComment.owner;
529529

530530
if (_toComment) {
531-
if ([_toComment.owner.global_key isEqualToString:[Login curLoginUser].global_key]) {
531+
if ([Login isLoginUserGlobalKey:_toComment.owner.global_key]) {
532532
__weak typeof(self) weakSelf = self;
533533
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此评论" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
534534
if (index == 0) {

Coding_iOS/Controllers/ProjectMemberListViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButto
266266
}
267267
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
268268
BOOL canEdit = NO;
269-
if (self.type == ProMemTypeProject && [Login isOwnerOfProjectWithOwnerId:self.myProject.owner_id]) {
269+
if (self.type == ProMemTypeProject && [Login isLoginUserGlobalKey:self.myProject.owner_user_name]) {
270270
ProjectMember *curMember;
271271
if (tableView == _mySearchDisplayController.searchResultsTableView) {
272272
curMember = [_searchResults objectAtIndex:indexPath.row];

Coding_iOS/Controllers/RootControllers/Tweet_RootViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
335335
weakSelf.commentToUser = ((Comment*)[weakSelf.commentTweet.comment_list objectAtIndex:weakSelf.commentIndex]).owner;
336336
weakSelf.myMsgInputView.toUser = ((Comment*)[weakSelf.commentTweet.comment_list objectAtIndex:weakSelf.commentIndex]).owner;
337337

338-
if (weakSelf.commentToUser.id.intValue == [Login curLoginUser].id.intValue) {
338+
if ([Login isLoginUserGlobalKey:weakSelf.commentToUser.global_key]) {
339339
ESWeakSelf
340340
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此评论" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
341341
ESStrongSelf

Coding_iOS/Controllers/TopicDetailViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ - (void)doCommentToTopic:(ProjectTopic *)toComment sender:(id)sender
340340
_myMsgInputView.toUser = toComment.owner;
341341

342342
if (_toComment) {
343-
if (_toComment.owner_id.intValue == [Login curLoginUser].id.intValue) {
343+
if ([Login isLoginUserGlobalKey:_toComment.owner.global_key]) {
344344
ESWeakSelf
345345
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此评论" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
346346
ESStrongSelf

Coding_iOS/Controllers/TweetDetailViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ - (void)doCommentToComment:(Comment *)toComment sender:(id)sender{
325325
_myMsgInputView.toUser = toComment.owner;
326326

327327
if (_toComment) {
328-
if (_toComment.owner_id.intValue == [Login curLoginUser].id.intValue) {
328+
if ([Login isLoginUserGlobalKey:_toComment.owner.global_key]) {
329329
ESWeakSelf;
330330
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此评论" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
331331
ESStrongSelf

Coding_iOS/Controllers/UserTweetsViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
242242

243243
weakSelf.myMsgInputView.toUser = ((Comment*)[weakSelf.commentTweet.comment_list objectAtIndex:weakSelf.commentIndex]).owner;
244244

245-
if (weakSelf.commentToUser.id.intValue == [Login curLoginUser].id.intValue) {
245+
if ([Login isLoginUserGlobalKey:weakSelf.commentToUser.global_key]) {
246246

247247
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"删除此评论" buttonTitles:nil destructiveTitle:@"确认删除" cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
248248
if (index == 0 && weakSelf.commentIndex >= 0) {

Coding_iOS/Models/Login.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
+ (User *)curLoginUser;
2525
+ (void)addUmengAliasWithCurUser:(BOOL)add;
2626
+ (void)setXGAccountWithCurUser;
27-
+ (BOOL)isOwnerOfProjectWithOwnerId:(NSNumber *)owner_id;
2827
+ (User *)userWithGlobaykeyOrEmail:(NSString *)textStr;
2928
+ (NSMutableDictionary *)readLoginDataList;
29+
+(BOOL)isLoginUserGlobalKey:(NSString *)global_key;
3030
@end

Coding_iOS/Models/Login.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,11 @@ + (User *)curLoginUser{
182182
}
183183
return curLoginUser;
184184
}
185-
+ (BOOL)isOwnerOfProjectWithOwnerId:(NSNumber *)owner_id{
186-
User *curLoginUser = [Login curLoginUser];
187-
if (curLoginUser) {
188-
return (curLoginUser.id.integerValue == owner_id.integerValue);
189-
}else{
185+
186+
+(BOOL)isLoginUserGlobalKey:(NSString *)global_key{
187+
if (global_key.length <= 0) {
190188
return NO;
191189
}
190+
return [[self curLoginUser].global_key isEqualToString:global_key];
192191
}
193192
@end

Coding_iOS/Models/ProjectTopic.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ - (NSString *)toDeletePath
163163

164164
- (BOOL)canEdit
165165
{
166-
return (self.owner_id.integerValue == [Login curLoginUser].id.integerValue // 讨论创建者
167-
|| [Login isOwnerOfProjectWithOwnerId:self.project.owner_id]); // 项目创建者
166+
return ([Login isLoginUserGlobalKey:self.owner.global_key] || // 讨论创建者
167+
[Login isLoginUserGlobalKey:self.project.owner_user_name]);// 项目创建者
168168
}
169169

170170
@end

Coding_iOS/Models/Tweets.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ - (NSDictionary *)toParams{
5858
case TweetTypeUserFriends:
5959
break;
6060
case TweetTypeUserSingle:
61-
if (_curUser && _curUser.id) {
62-
[params setObject:_curUser.id forKey:@"user_id"];
61+
if (_curUser && _curUser.global_key) {
62+
[params setObject:_curUser.global_key forKey:@"global_key"];
6363
}else if ([Login curLoginUser].id) {
64-
[params setObject:[Login curLoginUser].id forKey:@"user_id"];
64+
[params setObject:[Login curLoginUser].global_key forKey:@"global_key"];
6565
}
6666
break;
6767
default:

0 commit comments

Comments
 (0)