public CommentViewModel(CommentDiscussion parent, Comment comment, int currentUserId, int deepLevel) { DeepLevel = deepLevel; IsVisibleToPlayer = comment.IsVisibleToPlayer; HasMasterAccess = comment.Project.HasMasterAccess(currentUserId); CanModerateFinance = comment.Project.HasMasterAccess(currentUserId, acl => acl.CanManageMoney) || comment.Finance?.PaymentType?.UserId == currentUserId; IsCommentByPlayer = comment.IsCommentByPlayer; Author = comment.Author; AuthorAvatar = AvatarIdentification.FromOptional(comment.Author.SelectedAvatarId); AuthorEmail = comment.Author.Email; CreatedTime = comment.CreatedAt; Finance = comment.Finance; CommentText = comment.CommentText.Text.ToHtmlString(); CommentId = comment.CommentId; ProjectId = comment.ProjectId; CommentDiscussionId = comment.CommentDiscussionId; IsRead = comment.IsReadByUser(currentUserId); ChildComments = parent.Comments.Where(c => c.ParentCommentId == comment.CommentId) .Select(c => new CommentViewModel(parent, c, currentUserId, deepLevel + 1)) .OrderBy(c => c.CreatedTime); ExtraAction = comment.ExtraAction == null ? null : (CommentExtraAction?)comment.ExtraAction.Value; IsVisible = comment.IsVisibleTo(currentUserId); }
public UserProfileDetailsViewModel(User user, AccessReason reason) { User = new UserLinkViewModel(user); Reason = reason; SocialNetworkAccess = (ContactsAccessTypeView)user.GetSocialNetworkAccess(); Avatar = AvatarIdentification.FromOptional(user.SelectedAvatarId); if (HasAccess) { Email = user.Email; FullName = user.FullName; Skype = user.Extra?.Skype; Telegram = user.Extra?.Telegram; Livejournal = user.Extra?.Livejournal; PhoneNumber = user.Extra?.PhoneNumber ?? ""; IsVerifiedUser = user.VerifiedProfileFlag; IsAdmin = user.Auth.IsAdmin; } if (HasAccess || user.Extra.SocialNetworksAccess == ContactsAccessType.Public) { Vk = user.Extra?.Vk; AllrpgId = user.Allrpg?.Sid; } }
private record Key(AvatarIdentification Id, int Size) { }