Beispiel #1
0
        public GroupInfoViewModel GetInfoViewModel(Guid groupId)
        {
            var group = _groupService.Get(groupId);

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

            groupInfo.CanHide = _groupService.CanHide(group);

            if (group.ImageId.HasValue)
            {
                _lightboxHelper.FillGalleryPreview(groupInfo, Enumerable.Repeat(group.ImageId.Value, 1));
            }

            return(groupInfo);
        }
Beispiel #2
0
        private IntranetActivityPreviewModelBase GetBaseModel(IFeedItem feedItem, bool isGroupFeed)
        {
            if (feedItem is IntranetActivity activity)
            {
                var baseModel = new IntranetActivityPreviewModelBase
                {
                    Id            = feedItem.Id,
                    Links         = _linkService.GetLinks(feedItem.Id),
                    Type          = _localizationService.Translate(activity.Type.ToString()),
                    CommentsCount = _commentsService.GetCount(feedItem.Id),
                    Likes         = _likesService.GetLikeModels(activity.Id),
                    GroupInfo     = isGroupFeed ? null : _feedActivityHelper.GetGroupInfo(feedItem.Id),
                    ActivityType  = feedItem.Type,
                };
                if (feedItem is Social social)
                {
                    baseModel.LinkPreviewId = social.LinkPreviewId;
                    baseModel.LinkPreview   = social.LinkPreview;
                }
                _lightboxHelper.FillGalleryPreview(baseModel, activity.MediaIds);

                return(baseModel);
            }

            _logger.Warn <FeedPresentationService>("Feed item is not IntranetActivity (id={0};type={1})", feedItem.Id, feedItem.Type.ToInt());

            return(null);
        }