chore: Helpcenter improvements (#6098)

This commit is contained in:
Sivin Varghese 2022-12-22 18:51:24 +05:30 committed by GitHub
parent 6a78254701
commit 8c88344170
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 3 deletions

View file

@ -227,6 +227,26 @@ export default {
},
},
watch: {
'$route.name'() {
const routeName = this.$route?.name;
const routeParams = this.$route?.params;
const updateMetaInAllPortals = routeName === 'list_all_portals';
const updateMetaInEditArticle =
routeName === 'edit_article' && routeParams?.recentlyCreated;
const updateMetaInLocaleArticles =
routeName === 'list_all_locale_articles' &&
routeParams?.recentlyDeleted;
if (
updateMetaInAllPortals ||
updateMetaInEditArticle ||
updateMetaInLocaleArticles
) {
this.fetchPortalAndItsCategories();
}
},
},
mounted() {
window.addEventListener('resize', this.handleResize);
this.handleResize();

View file

@ -236,8 +236,10 @@ export default {
});
},
articleCount() {
const { all_articles_count: count } = this.portal.meta;
return count;
const { allowed_locales: allowedLocales } = this.portal.config;
return allowedLocales.reduce((acc, locale) => {
return acc + locale.articles_count;
}, 0);
},
},
methods: {

View file

@ -105,7 +105,10 @@ export default {
return this.portal?.config?.allowed_locales;
},
articlesCount() {
return this.portal?.meta?.all_articles_count;
const { allowed_locales: allowedLocales } = this.portal.config;
return allowedLocales.reduce((acc, locale) => {
return acc + locale.articles_count;
}, 0);
},
},
mounted() {

View file

@ -151,6 +151,7 @@ export default {
params: {
portalSlug: this.selectedPortalSlug,
locale: this.locale,
recentlyDeleted: true,
},
});
} catch (error) {

View file

@ -87,6 +87,7 @@ export default {
articleSlug: articleId,
portalSlug: this.selectedPortalSlug,
locale: this.locale,
recentlyCreated: true,
},
});
} catch (error) {