Beispiel #1
0
        protected override UserModel MapToViewModel(IIntranetUser user)
        {
            var model = base.MapToViewModel(user);

            model.ProfileUrl = _profileLinkProvider.GetProfileLink(model.Id);
            return(model);
        }
Beispiel #2
0
        public IEnumerable <MentionUserModel> SearchMention(string query)
        {
            var searchResult = _elasticIndex.Search(new SearchTextQuery
            {
                Text = query,
                Take = 5,
                SearchableTypeIds = UintraSearchableTypeEnum.Member.ToInt().ToListOfOne(),
                OnlyPinned        = false,
                ApplyHighlights   = false
            });

            var results = searchResult.Documents.Select(d =>
            {
                var searchableUser = (SearchableMember)d;
                var user           = new MentionUserModel()
                {
                    Id    = Guid.Parse(searchableUser.Id.ToString()),
                    Value = searchableUser.FullName
                };
                user.Url = _profileLinkProvider.GetProfileLink(user.Id);
                return(user);
            });

            return(results);
        }
Beispiel #3
0
        protected override MemberModel MapToViewModel(IIntranetMember user)
        {
            var model = base.MapToViewModel(user);

            model.ProfileUrl   = _profileLinkProvider.GetProfileLink(user.Id);
            model.IsGroupAdmin = CurrentGroup().Map(CreatorId) == user.Id;
            return(model);
        }
        protected virtual void FillEditData(ProfileEditModel model)
        {
            var mediaSettings = GetMediaSettings();

            ViewData["AllowedMediaExtensions"] = mediaSettings.AllowedMediaExtensions;
            model.MediaRootId = mediaSettings.MediaRootId;
            model.ProfileUrl  = _profileLinkProvider.GetProfileLink(model.Id);
        }
Beispiel #5
0
        public virtual ActionResult LeftNavigationUserMenu()
        {
            var currentUser = _intranetUserService.GetCurrentUser();

            var result = new LeftNavigationUserMenuViewModel
            {
                CurrentUser = currentUser,
                ProfileLink = _profileLinkProvider.GetProfileLink(currentUser.Id)
            };

            return(PartialView(LeftNavigationUserMenuViewPath, result));
        }
Beispiel #6
0
        public async Task <IHttpActionResult> Edit([FromBody] ProfileEditModel editModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            await _profileService.Edit(editModel);

            var result = _profileLinkProvider.GetProfileLink(editModel.Id);

            return(Ok(result));
        }
Beispiel #7
0
        private MemberModel MapToViewModel(IIntranetMember user, Guid?groupId)
        {
            var model = user.Map <MemberModel>();

            model.ProfileUrl = _profileLinkProvider.GetProfileLink(user.Id);

            var isAdmin = groupId.HasValue && _groupMemberService
                          .IsMemberAdminOfGroup(user.Id, groupId.Value);

            model.IsGroupAdmin = isAdmin;
            model.IsCreator    = groupId.HasValue && _groupService.IsMemberCreator(user.Id, groupId.Value);

            return(model);
        }
        protected virtual CommentViewModel GetCommentView(CommentModel comment, Guid currentUserId, IIntranetUser creator)
        {
            var model = comment.Map <CommentViewModel>();

            model.ModifyDate        = _commentsService.WasChanged(comment) ? comment.ModifyDate : default(DateTime?);
            model.CanEdit           = _commentsService.CanEdit(comment, currentUserId);
            model.CanDelete         = _commentsService.CanDelete(comment, currentUserId);
            model.Creator           = creator;
            model.ElementOverviewId = GetOverviewElementId(comment.ActivityId);
            model.CommentViewId     = _commentsService.GetCommentViewId(comment.Id);
            model.CreatorProfileUrl = _profileLinkProvider.GetProfileLink(creator);
            model.LinkPreview       = comment.LinkPreview.Map <LinkPreviewViewModel>();
            return(model);
        }
Beispiel #9
0
        protected override MemberModel MapToViewModel(IIntranetMember user)
        {
            var model = base.MapToViewModel(user);

            model.ProfileUrl = _profileLinkProvider.GetProfileLink(user.Id);

            var isAdmin = _groupMemberService
                          .IsMemberAdminOfGroup(user.Id, CurrentGroup()
                                                .Match(Some: GroupId, None: () => Guid.Empty));

            model.IsGroupAdmin = isAdmin;
            model.IsCreator    = _groupService.IsMemberCreator(user.Id, CurrentGroup()
                                                               .Match(Some: GroupId, None: () => Guid.Empty));

            return(model);
        }
Beispiel #10
0
        public virtual CommentViewModel GetCommentView(CommentModel comment, Guid currentMemberId, IIntranetMember creator)
        {
            var likes    = _likesService.GetLikeModels(comment.Id).ToArray();
            var memberId = _intranetMemberService.GetCurrentMemberId();
            var model    = comment.Map <CommentViewModel>();

            model.ModifyDate         = _commentsService.WasChanged(comment) ? comment.ModifyDate.ToDateTimeFormat() : null;
            model.CanEdit            = _commentsService.CanEdit(comment, currentMemberId);
            model.CanDelete          = _commentsService.CanDelete(comment, currentMemberId);
            model.Creator            = creator.ToViewModel();
            model.ElementOverviewId  = GetOverviewElementId(comment.ActivityId);
            model.CommentViewId      = _commentsService.GetCommentViewId(comment.Id);
            model.CreatorProfileUrl  = creator == null ? null : _profileLinkProvider.GetProfileLink(creator);
            model.LinkPreview        = comment.LinkPreview.Map <LinkPreviewModel>();
            model.LikedByCurrentUser = likes.Any(el => el.UserId == memberId);
            model.Likes     = likes;
            model.LikeModel = GetLikesViewModel(comment.Id, memberId, likes);

            return(model);
        }
Beispiel #11
0
        protected virtual GroupInfoViewModel GetInfoViewModel(Guid groupId)
        {
            var group = _groupService.Get(groupId);

            var groupInfo     = group.Map <GroupInfoViewModel>();
            var currentMember = _memberService.GetCurrentMember();

            groupInfo.IsMember       = _groupMemberService.IsGroupMember(group.Id, currentMember.Id);
            groupInfo.CanUnsubscribe = group.CreatorId != currentMember.Id;

            groupInfo.Creator           = _memberService.Get(group.CreatorId).Map <MemberViewModel>();
            groupInfo.MembersCount      = _groupMemberService.GetMembersCount(group.Id);
            groupInfo.CreatorProfileUrl = _profileLinkProvider.GetProfileLink(group.CreatorId);

            if (group.ImageId.HasValue)
            {
                groupInfo.GroupImageUrl = _imageHelper.GetImageWithPreset(Umbraco.TypedMedia(group.ImageId.Value).Url, UmbracoAliases.ImagePresets.GroupImageThumbnail);
            }

            return(groupInfo);
        }
Beispiel #12
0
 protected virtual string GetProfileLink(Guid userId) => _profileLinkProvider.GetProfileLink(userId);
Beispiel #13
0
 protected UintraLinkModel  GetProfileLink(Guid userId) => _profileLinkProvider.GetProfileLink(userId);