示例#1
0
        public async Task CanGetPublicKnowledgebaseArticles()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                Name = "CanGetPublicKnowledgebaseArticlesPublic1", Published = true
            };
            var article2 = new KnowledgebaseArticle {
                Name = "CanGetPublicKnowledgebaseArticlesPublic2", Published = true
            };
            var article3 = new KnowledgebaseArticle {
                Name = "CanGetPublicKnowledgebaseArticlesNotPublic", Published = false
            };

            await _knowledgebaseService.InsertKnowledgebaseArticle(article1);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article2);

            var found = await _knowledgebaseService.GetPublicKnowledgebaseArticles();

            Assert.AreEqual(2, found.Count);
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesPublic1"));
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesPublic2"));
            Assert.AreEqual(false, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesNotPublic"));
        }
示例#2
0
        public virtual async Task DeleteKnowledgebaseArticle(KnowledgebaseArticle knowledgebaseArticle)
        {
            await _knowledgebaseService.DeleteKnowledgebaseArticle(knowledgebaseArticle);

            await _customerActivityService.InsertActivity("DeleteKnowledgebaseArticle", knowledgebaseArticle.Id,
                                                          _translationService.GetResource("ActivityLog.DeleteKnowledgebaseArticle"), knowledgebaseArticle.Name);
        }
        public async Task AddArticleCommentTokens(LiquidObject liquidObject, KnowledgebaseArticle article, KnowledgebaseArticleComment articleComment, Store store, Language language)
        {
            var liquidKnowledgebase = new LiquidKnowledgebase(article, articleComment, store, language);

            liquidObject.Knowledgebase = liquidKnowledgebase;
            await _mediator.EntityTokensAdded(articleComment, liquidKnowledgebase, liquidObject);
        }
示例#4
0
 /// <summary>
 /// Deletes knowledgebase article
 /// </summary>
 /// <param name="id"></param>
 public virtual void DeleteKnowledgebaseArticle(KnowledgebaseArticle ka)
 {
     _knowledgebaseArticleRepository.Delete(ka);
     _cacheManager.RemoveByPattern(ARTICLES_PATTERN_KEY);
     _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY);
     _eventPublisher.EntityDeleted(ka);
 }
示例#5
0
        public async Task CanGetKnowledgebaseArticles()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle()
            {
                Published = true
            };
            var article2 = new KnowledgebaseArticle()
            {
                Published = true
            };
            var article3 = new KnowledgebaseArticle()
            {
                Published = true
            };

            await _knowledgebaseService.InsertKnowledgebaseArticle(article1);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article2);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article3);

            var all = await _knowledgebaseService.GetKnowledgebaseArticles();

            Assert.AreEqual(3, all.Count());
        }
示例#6
0
        public async Task CanGetRelatedKnowledgebaseArticles()
        {
            ClearArticleRepository();

            var article = new KnowledgebaseArticle {
                Name      = "CanGetRelatedKnowledgebaseArticlesMain",
                Published = true
            };

            var related1 = new KnowledgebaseArticle {
                Name      = "CanGetRelatedKnowledgebaseArticlesRelated1",
                Published = true
            };

            var related2 = new KnowledgebaseArticle {
                Name      = "CanGetRelatedKnowledgebaseArticlesRelated2",
                Published = true
            };

            await _knowledgebaseService.InsertKnowledgebaseArticle(related1);

            await _knowledgebaseService.InsertKnowledgebaseArticle(related2);

            article.RelatedArticles.Add(related1.Id);
            article.RelatedArticles.Add(related2.Id);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article);

            var found = await _knowledgebaseService.GetRelatedKnowledgebaseArticles(article.Id);

            Assert.AreEqual(2, found.Count);
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetRelatedKnowledgebaseArticlesRelated1"));
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetRelatedKnowledgebaseArticlesRelated2"));
        }
示例#7
0
        public async Task CanGetPublicKnowledgebaseArticlesByKeyword()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                Name      = "CanGetPublicKnowledgebaseArticlesByKeyword1",
                Published = true,
            };

            var article2 = new KnowledgebaseArticle {
                Name      = "test",
                Content   = "CanGetPublicKnowledgebaseArticlesByKeyword2",
                Published = true,
            };

            var article3 = new KnowledgebaseArticle {
                Name      = "Tomato",
                Content   = "Tomato",
                Published = true,
            };

            await _knowledgebaseService.InsertKnowledgebaseArticle(article1);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article2);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article3);

            var found = await _knowledgebaseService.GetPublicKnowledgebaseArticlesByKeyword("keyword");

            Assert.AreEqual(2, found.Count);
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesByKeyword1"));
            Assert.AreEqual(true, found.Any(x => x.Name == "test"));
            Assert.AreEqual(false, found.Any(x => x.Name == "Tomato"));
        }
示例#8
0
        public virtual void DeleteKnowledgebaseArticle(KnowledgebaseArticle knowledgebaseArticle)
        {
            _knowledgebaseService.DeleteKnowledgebaseArticle(knowledgebaseArticle);

            _customerActivityService.InsertActivity("DeleteKnowledgebaseArticle", knowledgebaseArticle.Id,
                                                    _localizationService.GetResource("ActivityLog.DeleteKnowledgebaseArticle"), knowledgebaseArticle.Name);
        }
示例#9
0
        public async Task CanGetPublicKnowledgebaseArticlesByCategory()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                Name             = "CanGetPublicKnowledgebaseArticlesByCategory1",
                Published        = true,
                ParentCategoryId = "CanGetPublicKnowledgebaseArticlesByCategory1"
            };

            var article2 = new KnowledgebaseArticle {
                Name             = "CanGetPublicKnowledgebaseArticlesByCategory2",
                Published        = true,
                ParentCategoryId = "CanGetPublicKnowledgebaseArticlesByCategory1"
            };

            var article3 = new KnowledgebaseArticle {
                Name             = "CanGetPublicKnowledgebaseArticlesByCategory3",
                Published        = true,
                ParentCategoryId = "CanGetPublicKnowledgebaseArticlesByCategory3"
            };

            await _knowledgebaseService.InsertKnowledgebaseArticle(article1);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article2);

            await _knowledgebaseService.InsertKnowledgebaseArticle(article3);

            var found = await _knowledgebaseService.GetPublicKnowledgebaseArticlesByCategory("CanGetPublicKnowledgebaseArticlesByCategory1");

            Assert.AreEqual(2, found.Count);
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesByCategory1"));
            Assert.AreEqual(true, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesByCategory2"));
            Assert.AreEqual(false, found.Any(x => x.Name == "CanGetPublicKnowledgebaseArticlesByCategory3"));
        }
示例#10
0
 public LiquidKnowledgebase(KnowledgebaseArticle article, KnowledgebaseArticleComment articleComment, Store store, Language language)
 {
     _article         = article;
     _articleComment  = articleComment;
     _store           = store;
     _language        = language;
     AdditionalTokens = new Dictionary <string, string>();
 }
        /// <summary>
        /// Deletes knowledgebase article
        /// </summary>
        /// <param name="id"></param>
        public virtual async Task DeleteKnowledgebaseArticle(KnowledgebaseArticle ka)
        {
            await _knowledgebaseArticleRepository.DeleteAsync(ka);

            _cacheManager.RemoveByPattern(ARTICLES_PATTERN_KEY);
            _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY);
            await _eventPublisher.EntityDeleted(ka);
        }
示例#12
0
 /// <summary>
 /// Edits knowledgebase article
 /// </summary>
 /// <param name="ka"></param>
 public virtual void UpdateKnowledgebaseArticle(KnowledgebaseArticle ka)
 {
     ka.UpdatedOnUtc = DateTime.UtcNow;
     _knowledgebaseArticleRepository.Update(ka);
     _cacheManager.RemoveByPattern(ARTICLES_PATTERN_KEY);
     _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY);
     _eventPublisher.EntityUpdated(ka);
 }
        /// <summary>
        /// Inserts knowledgebase article
        /// </summary>
        /// <param name="ka"></param>
        public virtual async Task InsertKnowledgebaseArticle(KnowledgebaseArticle ka)
        {
            ka.CreatedOnUtc = DateTime.UtcNow;
            ka.UpdatedOnUtc = DateTime.UtcNow;
            await _knowledgebaseArticleRepository.InsertAsync(ka);

            _cacheManager.RemoveByPattern(ARTICLES_PATTERN_KEY);
            _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY);
            await _eventPublisher.EntityInserted(ka);
        }
        /// <summary>
        /// Deletes knowledgebase article
        /// </summary>
        /// <param name="id"></param>
        public virtual async Task DeleteKnowledgebaseArticle(KnowledgebaseArticle ka)
        {
            await _knowledgebaseArticleRepository.DeleteAsync(ka);

            await _cacheManager.RemoveByPrefix(ARTICLES_PATTERN_KEY);

            await _cacheManager.RemoveByPrefix(CATEGORIES_PATTERN_KEY);

            await _mediator.EntityDeleted(ka);
        }
示例#15
0
        /// <summary>
        /// Deletes knowledgebase article
        /// </summary>
        /// <param name="id"></param>
        public virtual async Task DeleteKnowledgebaseArticle(KnowledgebaseArticle ka)
        {
            await _knowledgebaseArticleRepository.DeleteAsync(ka);

            await _cacheBase.RemoveByPrefix(CacheKey.ARTICLES_PATTERN_KEY);

            await _cacheBase.RemoveByPrefix(CacheKey.KNOWLEDGEBASE_CATEGORIES_PATTERN_KEY);

            await _mediator.EntityDeleted(ka);
        }
示例#16
0
 public LiquidObjectBuilder AddArticleCommentTokens(KnowledgebaseArticle article, KnowledgebaseArticleComment articleComment, Store store, Language language)
 {
     _chain.Add(async liquidObject =>
     {
         var liquidKnowledgebase    = new LiquidKnowledgebase(article, articleComment, store, language);
         liquidObject.Knowledgebase = liquidKnowledgebase;
         await _mediator.EntityTokensAdded(articleComment, liquidKnowledgebase, liquidObject);
     });
     return(this);
 }
示例#17
0
        /// <summary>
        /// Edits knowledgebase article
        /// </summary>
        /// <param name="ka"></param>
        public virtual async Task UpdateKnowledgebaseArticle(KnowledgebaseArticle ka)
        {
            ka.UpdatedOnUtc = DateTime.UtcNow;
            await _knowledgebaseArticleRepository.UpdateAsync(ka);

            await _cacheBase.RemoveByPrefix(CacheKey.ARTICLES_PATTERN_KEY);

            await _cacheBase.RemoveByPrefix(CacheKey.KNOWLEDGEBASE_CATEGORIES_PATTERN_KEY);

            await _mediator.EntityUpdated(ka);
        }
示例#18
0
        /// <summary>
        /// Edits knowledgebase article
        /// </summary>
        /// <param name="ka"></param>
        public virtual async Task UpdateKnowledgebaseArticle(KnowledgebaseArticle ka)
        {
            ka.UpdatedOnUtc = DateTime.UtcNow;
            await _knowledgebaseArticleRepository.UpdateAsync(ka);

            await _cacheManager.RemoveByPattern(ARTICLES_PATTERN_KEY);

            await _cacheManager.RemoveByPattern(CATEGORIES_PATTERN_KEY);

            await _mediator.EntityUpdated(ka);
        }
示例#19
0
        public async Task CanDeleteKnowledgebaseArticle()
        {
            ClearArticleRepository();

            var toDelete = new KnowledgebaseArticle();
            await _knowledgebaseService.InsertKnowledgebaseArticle(toDelete);

            Assert.AreEqual(1, _articleRepository.Table.Count());
            await _knowledgebaseService.DeleteKnowledgebaseArticle(toDelete);

            Assert.AreEqual(0, _articleRepository.Table.Count());
        }
示例#20
0
        public async Task CanGetKnowledgebaseArticle()
        {
            var article = new KnowledgebaseArticle()
            {
                Name = "CanGetKnowledgebaseArticle"
            };
            await _knowledgebaseService.InsertKnowledgebaseArticle(article);

            var actual = _articleRepository.Table.Where(x => x.Name == "CanGetKnowledgebaseArticle").First();
            var found  = await _knowledgebaseService.GetKnowledgebaseArticle(actual.Id);

            Assert.AreEqual(actual.Name, found.Name);
        }
示例#21
0
        public async Task GetKnowledgebaseArticlesByName()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                Name = "GetKnowledgebaseArticlesByName1", Published = true
            };

            await _knowledgebaseService.InsertKnowledgebaseArticle(article1);

            var found = await _knowledgebaseService.GetKnowledgebaseArticlesByName("GetKnowledgebaseArticlesByName1");

            Assert.AreEqual(1, found.Count);
            Assert.AreEqual("GetKnowledgebaseArticlesByName1", found.First().Name);
        }
        public void GetKnowledgebaseArticle()
        {
            KnowledgebaseArticleCollection knowledgebaseArticles = TestSetup.KayakoApiService.Knowledgebase.GetKnowledgebaseArticles();

            Assert.IsNotNull(knowledgebaseArticles, "No knowledgebase articles were returned");
            Assert.IsNotEmpty(knowledgebaseArticles, "No knowledgebase articles were returned");

            KnowledgebaseArticle knowledgebaseArticleToGet = knowledgebaseArticles[new Random().Next(knowledgebaseArticles.Count)];

            Trace.WriteLine("GetKnowledgebaseArticle using knowledgebase article id: " + knowledgebaseArticleToGet.Id);

            KnowledgebaseArticle knowledgebaseArticle = TestSetup.KayakoApiService.Knowledgebase.GetKnowledgebaseArticle(knowledgebaseArticleToGet.Id);

            AssertObjectXmlEqual(knowledgebaseArticle, knowledgebaseArticleToGet);
        }
示例#23
0
        public virtual KnowledgebaseArticle UpdateKnowledgebaseArticleModel(KnowledgebaseArticle knowledgebaseArticle, KnowledgebaseArticleModel model)
        {
            knowledgebaseArticle = model.ToEntity(knowledgebaseArticle);
            knowledgebaseArticle.UpdatedOnUtc = DateTime.UtcNow;
            knowledgebaseArticle.Locales      = model.Locales.ToLocalizedProperty(knowledgebaseArticle, x => x.Name, _urlRecordService);
            model.SeName = knowledgebaseArticle.ValidateSeName(model.SeName, knowledgebaseArticle.Name, true);
            knowledgebaseArticle.SeName        = model.SeName;
            knowledgebaseArticle.AllowComments = model.AllowComments;
            _knowledgebaseService.UpdateKnowledgebaseArticle(knowledgebaseArticle);

            _urlRecordService.SaveSlug(knowledgebaseArticle, model.SeName, "");

            _customerActivityService.InsertActivity("UpdateKnowledgebaseArticle", knowledgebaseArticle.Id,
                                                    _localizationService.GetResource("ActivityLog.UpdateKnowledgebaseArticle"), knowledgebaseArticle.Name);
            return(knowledgebaseArticle);
        }
示例#24
0
        public void CanGetKnowledgebaseArticles()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle();
            var article2 = new KnowledgebaseArticle();
            var article3 = new KnowledgebaseArticle();

            _knowledgebaseService.InsertKnowledgebaseArticle(article1);
            _knowledgebaseService.InsertKnowledgebaseArticle(article2);
            _knowledgebaseService.InsertKnowledgebaseArticle(article3);

            var all = _knowledgebaseService.GetKnowledgebaseArticles();

            Assert.AreEqual(3, all.Count());
        }
示例#25
0
        public async Task CanUpdateKnowledgebaseArticle()
        {
            ClearArticleRepository();

            var article = new KnowledgebaseArticle()
            {
                Name = "CanUpdateKnowledgebaseArticle"
            };
            await _knowledgebaseService.InsertKnowledgebaseArticle(article);

            article.Name = "CanUpdateKnowledgebaseArticle1";
            await _knowledgebaseService.UpdateKnowledgebaseArticle(article);

            var found = _articleRepository.Table.Where(x => x.Name == "CanUpdateKnowledgebaseArticle1");

            Assert.AreEqual(1, found.Count());
        }
示例#26
0
        public void CanGetHomepageKnowledgebaseArticles()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                ShowOnHomepage = true, Published = true, Name = "homepage"
            };
            var article2 = new KnowledgebaseArticle {
                ShowOnHomepage = false, Published = true, Name = "not homepage"
            };

            _knowledgebaseService.InsertKnowledgebaseArticle(article1);
            _knowledgebaseService.InsertKnowledgebaseArticle(article2);

            var homepage = _knowledgebaseService.GetHomepageKnowledgebaseArticles();

            Assert.AreEqual(1, homepage.Count);
            Assert.AreEqual("homepage", homepage.First().Name);
        }
示例#27
0
        public void CanGetPublicKnowledgebaseArticle()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                Name = "CanGetPublicKnowledgebaseArticlePublic", Published = true
            };
            var article2 = new KnowledgebaseArticle {
                Name = "CanGetPublicKnowledgebaseArticleNotPublic", Published = false
            };

            _knowledgebaseService.InsertKnowledgebaseArticle(article1);
            _knowledgebaseService.InsertKnowledgebaseArticle(article2);

            var found1 = _knowledgebaseService.GetPublicKnowledgebaseArticle(article1.Id);
            var found2 = _knowledgebaseService.GetPublicKnowledgebaseArticle(article2.Id);

            Assert.AreEqual("CanGetPublicKnowledgebaseArticlePublic", found1.Name);
            Assert.AreEqual(null, found2);
        }
示例#28
0
        public void GetKnowledgebaseArticlesByCategoryId()
        {
            ClearArticleRepository();

            var article1 = new KnowledgebaseArticle {
                ParentCategoryId = "GetKnowledgebaseArticlesByCategoryId1"
            };
            var article2 = new KnowledgebaseArticle {
                ParentCategoryId = "GetKnowledgebaseArticlesByCategoryId1"
            };
            var article3 = new KnowledgebaseArticle {
                ParentCategoryId = "GetKnowledgebaseArticlesByCategoryId2"
            };

            _knowledgebaseService.InsertKnowledgebaseArticle(article1);
            _knowledgebaseService.InsertKnowledgebaseArticle(article2);
            _knowledgebaseService.InsertKnowledgebaseArticle(article3);

            var found = _knowledgebaseService.GetKnowledgebaseArticlesByCategoryId("GetKnowledgebaseArticlesByCategoryId1");

            Assert.AreEqual(2, found.Count);
        }
示例#29
0
        private async Task PrepareKnowledgebaseArticleModel(KnowledgebaseArticleModel model, KnowledgebaseArticle article, ICustomerService customerService)
        {
            model.Content                      = article.GetTranslation(y => y.Content, _workContext.WorkingLanguage.Id);
            model.Name                         = article.GetTranslation(y => y.Name, _workContext.WorkingLanguage.Id);
            model.Id                           = article.Id;
            model.ParentCategoryId             = article.ParentCategoryId;
            model.SeName                       = article.GetTranslation(y => y.SeName, _workContext.WorkingLanguage.Id);
            model.AllowComments                = article.AllowComments;
            model.AddNewComment.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnArticleCommentPage;

            model.MetaTitle       = article.GetTranslation(y => y.MetaTitle, _workContext.WorkingLanguage.Id);
            model.MetaDescription = article.GetTranslation(y => y.MetaDescription, _workContext.WorkingLanguage.Id);
            model.MetaKeywords    = article.GetTranslation(y => y.MetaKeywords, _workContext.WorkingLanguage.Id);

            var articleComments = await _knowledgebaseService.GetArticleCommentsByArticleId(article.Id);

            foreach (var ac in articleComments)
            {
                var customer = await customerService.GetCustomerById(ac.CustomerId);

                var commentModel = new KnowledgebaseArticleCommentModel
                {
                    Id           = ac.Id,
                    CustomerId   = ac.CustomerId,
                    CustomerName = customer.FormatUserName(_customerSettings.CustomerNameFormat),
                    CommentText  = ac.CommentText,
                    CreatedOn    = _dateTimeService.ConvertToUserTime(ac.CreatedOnUtc, DateTimeKind.Utc),
                };
                model.Comments.Add(commentModel);
            }

            foreach (var id in article.RelatedArticles)
            {
                var a = await _knowledgebaseService.GetPublicKnowledgebaseArticle(id);

                if (a != null)
                {
                    model.RelatedArticles.Add(new KnowledgebaseArticleModel
                    {
                        SeName = a.SeName,
                        Id     = a.Id,
                        Name   = a.Name
                    });
                }
            }

            var category = await _knowledgebaseService.GetKnowledgebaseCategory(article.ParentCategoryId);

            if (category != null)
            {
                string breadcrumbCacheKey = string.Format(CacheKeyConst.KNOWLEDGEBASE_CATEGORY_BREADCRUMB_KEY,
                                                          article.ParentCategoryId,
                                                          string.Join(",", _workContext.CurrentCustomer.GetCustomerGroupIds()),
                                                          _workContext.CurrentStore.Id,
                                                          _workContext.WorkingLanguage.Id);
                model.CategoryBreadcrumb = await _cacheBase.GetAsync(breadcrumbCacheKey, async() =>
                                                                     (await category.GetCategoryBreadCrumb(_knowledgebaseService, _aclService, _workContext))
                                                                     .Select(catBr => new KnowledgebaseCategoryModel
                {
                    Id = catBr.Id,
                    Name = catBr.GetTranslation(x => x.Name, _workContext.WorkingLanguage.Id),
                    SeName = catBr.GetSeName(_workContext.WorkingLanguage.Id)
                })
                                                                     .ToList()
                                                                     );
            }
        }
        private async Task PrepareKnowledgebaseArticleModel(KnowledgebaseArticleModel model, KnowledgebaseArticle article, ICustomerService customerService)
        {
            model.Content                      = article.GetLocalized(y => y.Content, _workContext.WorkingLanguage.Id);
            model.Name                         = article.GetLocalized(y => y.Name, _workContext.WorkingLanguage.Id);
            model.Id                           = article.Id;
            model.ParentCategoryId             = article.ParentCategoryId;
            model.SeName                       = article.GetLocalized(y => y.SeName, _workContext.WorkingLanguage.Id);
            model.AllowComments                = article.AllowComments;
            model.AddNewComment.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnArticleCommentPage;
            var articleComments = await _knowledgebaseService.GetArticleCommentsByArticleId(article.Id);

            foreach (var ac in articleComments)
            {
                var customer = await customerService.GetCustomerById(ac.CustomerId);

                var commentModel = new KnowledgebaseArticleCommentModel {
                    Id                   = ac.Id,
                    CustomerId           = ac.CustomerId,
                    CustomerName         = customer.FormatUserName(_customerSettings.CustomerNameFormat),
                    CommentText          = ac.CommentText,
                    CreatedOn            = _dateTimeHelper.ConvertToUserTime(ac.CreatedOnUtc, DateTimeKind.Utc),
                    AllowViewingProfiles = _customerSettings.AllowViewingProfiles && customer != null && !customer.IsGuest(),
                };
                if (_customerSettings.AllowCustomersToUploadAvatars)
                {
                    commentModel.CustomerAvatarUrl = await _pictureService.GetPictureUrl(
                        customer.GetAttributeFromEntity <string>(SystemCustomerAttributeNames.AvatarPictureId),
                        _mediaSettings.AvatarPictureSize,
                        _customerSettings.DefaultAvatarEnabled,
                        defaultPictureType : PictureType.Avatar);
                }

                model.Comments.Add(commentModel);
            }

            foreach (var id in article.RelatedArticles)
            {
                var a = await _knowledgebaseService.GetPublicKnowledgebaseArticle(id);

                if (a != null)
                {
                    model.RelatedArticles.Add(new KnowledgebaseArticleModel {
                        SeName = a.SeName,
                        Id     = a.Id,
                        Name   = a.Name
                    });
                }
            }

            var category = await _knowledgebaseService.GetKnowledgebaseCategory(article.ParentCategoryId);

            if (category != null)
            {
                string breadcrumbCacheKey = string.Format(ModelCacheEventConst.KNOWLEDGEBASE_CATEGORY_BREADCRUMB_KEY,
                                                          article.ParentCategoryId,
                                                          string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()),
                                                          _storeContext.CurrentStore.Id,
                                                          _workContext.WorkingLanguage.Id);
                model.CategoryBreadcrumb = await _cacheManager.GetAsync(breadcrumbCacheKey, async() =>
                                                                        (await category.GetCategoryBreadCrumb(_knowledgebaseService, _aclService, _storeMappingService))
                                                                        .Select(catBr => new KnowledgebaseCategoryModel {
                    Id = catBr.Id,
                    Name = catBr.GetLocalized(x => x.Name, _workContext.WorkingLanguage.Id),
                    SeName = catBr.GetSeName(_workContext.WorkingLanguage.Id)
                })
                                                                        .ToList()
                                                                        );
            }
        }