Merge branch 'home-i18n-fixes' into 'master'

Home i18n fixes

See merge request framasoft/mobilizon!611
This commit is contained in:
Thomas Citharel 2020-10-15 11:20:51 +02:00
commit 65a68c9d24
22 changed files with 237 additions and 121 deletions

View File

@ -4,7 +4,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build --modern",
"test:unit": "vue-cli-service test:unit", "test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e", "test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"

View File

@ -4,6 +4,7 @@ export const DASHBOARD = gql`
query { query {
dashboard { dashboard {
lastPublicEventPublished { lastPublicEventPublished {
id
uuid uuid
title title
picture { picture {
@ -12,10 +13,24 @@ export const DASHBOARD = gql`
url url
} }
} }
lastGroupCreated {
id
preferredUsername
domain
name
avatar {
id
url
}
}
numberOfUsers numberOfUsers
numberOfEvents numberOfEvents
numberOfComments numberOfComments
numberOfReports numberOfReports
numberOfGroups
numberOfFollowers
numberOfFollowings
numberOfConfirmedParticipationsToLocalEvents
} }
} }
`; `;

View File

@ -281,7 +281,7 @@
"Public feeds": "Public feeds", "Public feeds": "Public feeds",
"Public iCal Feed": "Public iCal Feed", "Public iCal Feed": "Public iCal Feed",
"Publish": "Publish", "Publish": "Publish",
"Published events": "Published events", "Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations": "Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations",
"RSS/Atom Feed": "RSS/Atom Feed", "RSS/Atom Feed": "RSS/Atom Feed",
"Read Framasofts statement of intent on the Framablog": "Read Framasofts statement of intent on the Framablog", "Read Framasofts statement of intent on the Framablog": "Read Framasofts statement of intent on the Framablog",
"Redirecting to event…": "Redirecting to event…", "Redirecting to event…": "Redirecting to event…",
@ -800,5 +800,8 @@
"To register for an event by choosing one of your identities": "To register for an event by choosing one of your identities", "To register for an event by choosing one of your identities": "To register for an event by choosing one of your identities",
"To create or join an group and start organizing with other people": "To create or join an group and start organizing with other people", "To create or join an group and start organizing with other people": "To create or join an group and start organizing with other people",
"About {instance}": "About {instance}", "About {instance}": "About {instance}",
"Please read the {fullRules} published by {instance}'s administrators.": "Please read the {fullRules} published by {instance}'s administrators." "Please read the {fullRules} published by {instance}'s administrators.": "Please read the {fullRules} published by {instance}'s administrators.",
"Instances following you": "Instances following you",
"Instances you follow": "Instances you follow",
"Last group created": "Last group created"
} }

View File

@ -532,7 +532,7 @@
"Public page": "Page publique", "Public page": "Page publique",
"Publication date": "Date de publication", "Publication date": "Date de publication",
"Publish": "Publier", "Publish": "Publier",
"Published events": "Événements publiés", "Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations": "Événements publiés avec <b>{comments}</b> commentaires et <b>{participations}</b> participations confirmées",
"RSS/Atom Feed": "Flux RSS/Atom", "RSS/Atom Feed": "Flux RSS/Atom",
"Radius": "Rayon", "Radius": "Rayon",
"Read Framasofts statement of intent on the Framablog": "Lire la note dintention de Framasoft sur le Framablog", "Read Framasofts statement of intent on the Framablog": "Lire la note dintention de Framasoft sur le Framablog",
@ -850,5 +850,8 @@
"To register for an event by choosing one of your identities": "Pour s'inscrire à un évènement en choisissant une de vos identités", "To register for an event by choosing one of your identities": "Pour s'inscrire à un évènement en choisissant une de vos identités",
"To create or join an group and start organizing with other people": "Pour créer ou rejoindre un groupe et commencer à vous organiser avec d'autres personnes", "To create or join an group and start organizing with other people": "Pour créer ou rejoindre un groupe et commencer à vous organiser avec d'autres personnes",
"About {instance}": "À propos de {instance}", "About {instance}": "À propos de {instance}",
"Please read the {fullRules} published by {instance}'s administrators.": "Merci de lire les {fullRules} publiées par les administrateur·ices de {instance}." "Please read the {fullRules} published by {instance}'s administrators.": "Merci de lire les {fullRules} publiées par les administrateur·ices de {instance}.",
"Instances following you": "Instances vous suivant",
"Instances you follow": "Instances que vous suivez",
"Last group created": "Dernier groupe créé"
} }

View File

@ -1,7 +1,4 @@
import { RouteConfig } from "vue-router"; import { RouteConfig } from "vue-router";
import CreateGroup from "@/views/Group/Create.vue";
import Group from "@/views/Group/Group.vue";
import MyGroups from "@/views/Group/MyGroups.vue";
export enum ActorRouteName { export enum ActorRouteName {
GROUP = "Group", GROUP = "Group",
@ -14,20 +11,20 @@ export const actorRoutes: RouteConfig[] = [
{ {
path: "/groups/create", path: "/groups/create",
name: ActorRouteName.CREATE_GROUP, name: ActorRouteName.CREATE_GROUP,
component: CreateGroup, component: () => import(/* webpackChunkName: "CreateGroup" */ "@/views/Group/Create.vue"),
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "/@:preferredUsername", path: "/@:preferredUsername",
name: ActorRouteName.GROUP, name: ActorRouteName.GROUP,
component: Group, component: () => import(/* webpackChunkName: "Group" */ "@/views/Group/Group.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{ {
path: "/groups/me", path: "/groups/me",
name: ActorRouteName.MY_GROUPS, name: ActorRouteName.MY_GROUPS,
component: MyGroups, component: () => import(/* webpackChunkName: "MyGroups" */ "@/views/Group/MyGroups.vue"),
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
]; ];

View File

@ -1,7 +1,4 @@
import { RouteConfig } from "vue-router"; import { RouteConfig } from "vue-router";
import CreateDiscussion from "@/views/Discussions/Create.vue";
import DiscussionsList from "@/views/Discussions/DiscussionsList.vue";
import discussion from "@/views/Discussions/Discussion.vue";
export enum DiscussionRouteName { export enum DiscussionRouteName {
DISCUSSION_LIST = "DISCUSSION_LIST", DISCUSSION_LIST = "DISCUSSION_LIST",
@ -13,21 +10,24 @@ export const discussionRoutes: RouteConfig[] = [
{ {
path: "/@:preferredUsername/discussions", path: "/@:preferredUsername/discussions",
name: DiscussionRouteName.DISCUSSION_LIST, name: DiscussionRouteName.DISCUSSION_LIST,
component: DiscussionsList, component: () =>
import(/* webpackChunkName: "DiscussionsList" */ "@/views/Discussions/DiscussionsList.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{ {
path: "/@:preferredUsername/discussions/new", path: "/@:preferredUsername/discussions/new",
name: DiscussionRouteName.CREATE_DISCUSSION, name: DiscussionRouteName.CREATE_DISCUSSION,
component: CreateDiscussion, component: () =>
import(/* webpackChunkName: "CreateDiscussion" */ "@/views/Discussions/Create.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "/@:preferredUsername/c/:slug/:comment_id?", path: "/@:preferredUsername/c/:slug/:comment_id?",
name: DiscussionRouteName.DISCUSSION, name: DiscussionRouteName.DISCUSSION,
component: discussion, component: () =>
import(/* webpackChunkName: "Discussion" */ "@/views/Discussions/Discussion.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },

View File

@ -1,6 +1,5 @@
import { beforeRegisterGuard } from "@/router/guards/register-guard"; import { beforeRegisterGuard } from "@/router/guards/register-guard";
import { RouteConfig } from "vue-router"; import { RouteConfig } from "vue-router";
import ErrorPage from "../views/Error.vue";
export enum ErrorRouteName { export enum ErrorRouteName {
ERROR = "Error", ERROR = "Error",
@ -10,7 +9,7 @@ export const errorRoutes: RouteConfig[] = [
{ {
path: "/error", path: "/error",
name: ErrorRouteName.ERROR, name: ErrorRouteName.ERROR,
component: ErrorPage, component: () => import(/* webpackChunkName: "Error" */ "../views/Error.vue"),
beforeEnter: beforeRegisterGuard, beforeEnter: beforeRegisterGuard,
}, },
]; ];

View File

@ -1,7 +1,4 @@
import { RouteConfig, Route } from "vue-router"; import { RouteConfig, Route } from "vue-router";
import EventList from "../views/Event/EventList.vue";
import Location from "../views/Location.vue";
import Search from "../views/Search.vue";
const participations = () => const participations = () =>
import(/* webpackChunkName: "participations" */ "@/views/Event/Participants.vue"); import(/* webpackChunkName: "participations" */ "@/views/Event/Participants.vue");
@ -29,7 +26,7 @@ export const eventRoutes: RouteConfig[] = [
{ {
path: "/events/list/:location?", path: "/events/list/:location?",
name: EventRouteName.EVENT_LIST, name: EventRouteName.EVENT_LIST,
component: EventList, component: () => import(/* webpackChunkName: "EventList" */ "@/views/Event/EventList.vue"),
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{ {
@ -68,7 +65,7 @@ export const eventRoutes: RouteConfig[] = [
{ {
path: "/location/new", path: "/location/new",
name: EventRouteName.LOCATION, name: EventRouteName.LOCATION,
component: Location, component: () => import(/* webpackChunkName: "Location" */ "@/views/Location.vue"),
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
@ -105,7 +102,7 @@ export const eventRoutes: RouteConfig[] = [
{ {
path: "/tag/:tag", path: "/tag/:tag",
name: EventRouteName.TAG, name: EventRouteName.TAG,
component: Search, component: () => import(/* webpackChunkName: "Search" */ "@/views/Search.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },

View File

@ -2,13 +2,11 @@ import Vue from "vue";
import Router, { Route } from "vue-router"; import Router, { Route } from "vue-router";
import VueScrollTo from "vue-scrollto"; import VueScrollTo from "vue-scrollto";
import { PositionResult } from "vue-router/types/router.d"; import { PositionResult } from "vue-router/types/router.d";
import PageNotFound from "../views/PageNotFound.vue";
import Home from "../views/Home.vue"; import Home from "../views/Home.vue";
import { eventRoutes } from "./event"; import { eventRoutes } from "./event";
import { actorRoutes } from "./actor"; import { actorRoutes } from "./actor";
import { errorRoutes } from "./error"; import { errorRoutes } from "./error";
import { authGuardIfNeeded } from "./guards/auth-guard"; import { authGuardIfNeeded } from "./guards/auth-guard";
import Search from "../views/Search.vue";
import { settingsRoutes } from "./settings"; import { settingsRoutes } from "./settings";
import { groupsRoutes } from "./groups"; import { groupsRoutes } from "./groups";
import { discussionRoutes } from "./discussion"; import { discussionRoutes } from "./discussion";
@ -51,7 +49,7 @@ const router = new Router({
{ {
path: "/search", path: "/search",
name: RouteName.SEARCH, name: RouteName.SEARCH,
component: Search, component: () => import(/* webpackChunkName: "search" */ "../views/Search.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
@ -115,12 +113,13 @@ const router = new Router({
{ {
path: "/auth/:provider/callback", path: "/auth/:provider/callback",
name: "auth-callback", name: "auth-callback",
component: () => import("@/views/User/ProviderValidation.vue"), component: () =>
import(/* webpackChunkName: "ProviderValidation" */ "@/views/User/ProviderValidation.vue"),
}, },
{ {
path: "/404", path: "/404",
name: RouteName.PAGE_NOT_FOUND, name: RouteName.PAGE_NOT_FOUND,
component: PageNotFound, component: () => import(/* webpackChunkName: "search" */ "../views/PageNotFound.vue"),
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },
{ {

View File

@ -1,23 +1,4 @@
import { RouteConfig } from "vue-router"; import { RouteConfig } from "vue-router";
import Settings from "@/views/Settings.vue";
import AccountSettings from "@/views/Settings/AccountSettings.vue";
import Preferences from "@/views/Settings/Preferences.vue";
import Notifications from "@/views/Settings/Notifications.vue";
import Dashboard from "@/views/Admin/Dashboard.vue";
import AdminSettings from "@/views/Admin/Settings.vue";
import Follows from "@/views/Admin/Follows.vue";
import Followings from "@/components/Admin/Followings.vue";
import Followers from "@/components/Admin/Followers.vue";
import ReportList from "@/views/Moderation/ReportList.vue";
import Report from "@/views/Moderation/Report.vue";
import Logs from "@/views/Moderation/Logs.vue";
import EditIdentity from "@/views/Account/children/EditIdentity.vue";
import Users from "../views/Admin/Users.vue";
import Profiles from "../views/Admin/Profiles.vue";
import AdminProfile from "../views/Admin/AdminProfile.vue";
import AdminUserProfile from "../views/Admin/AdminUserProfile.vue";
import GroupProfiles from "../views/Admin/GroupProfiles.vue";
import AdminGroupProfile from "../views/Admin/AdminGroupProfile.vue";
export enum SettingsRouteName { export enum SettingsRouteName {
SETTINGS = "SETTINGS", SETTINGS = "SETTINGS",
@ -49,7 +30,7 @@ export enum SettingsRouteName {
export const settingsRoutes: RouteConfig[] = [ export const settingsRoutes: RouteConfig[] = [
{ {
path: "/settings", path: "/settings",
component: Settings, component: () => import(/* webpackChunkName: "Settings" */ "@/views/Settings.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS }, redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS },
@ -63,21 +44,24 @@ export const settingsRoutes: RouteConfig[] = [
{ {
path: "account/general", path: "account/general",
name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL, name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL,
component: AccountSettings, component: () =>
import(/* webpackChunkName: "AccountSettings" */ "@/views/Settings/AccountSettings.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "preferences", path: "preferences",
name: SettingsRouteName.PREFERENCES, name: SettingsRouteName.PREFERENCES,
component: Preferences, component: () =>
import(/* webpackChunkName: "Preferences" */ "@/views/Settings/Preferences.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "notifications", path: "notifications",
name: SettingsRouteName.NOTIFICATIONS, name: SettingsRouteName.NOTIFICATIONS,
component: Notifications, component: () =>
import(/* webpackChunkName: "Notifications" */ "@/views/Settings/Notifications.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
@ -89,55 +73,61 @@ export const settingsRoutes: RouteConfig[] = [
{ {
path: "admin/dashboard", path: "admin/dashboard",
name: SettingsRouteName.ADMIN_DASHBOARD, name: SettingsRouteName.ADMIN_DASHBOARD,
component: Dashboard, component: () => import(/* webpackChunkName: "Dashboard" */ "@/views/Admin/Dashboard.vue"),
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/settings", path: "admin/settings",
name: SettingsRouteName.ADMIN_SETTINGS, name: SettingsRouteName.ADMIN_SETTINGS,
component: AdminSettings, component: () =>
import(/* webpackChunkName: "AdminSettings" */ "@/views/Admin/Settings.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/users", path: "admin/users",
name: SettingsRouteName.USERS, name: SettingsRouteName.USERS,
component: Users, component: () => import(/* webpackChunkName: "Users" */ "@/views/Admin/Users.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/users/:id", path: "admin/users/:id",
name: SettingsRouteName.ADMIN_USER_PROFILE, name: SettingsRouteName.ADMIN_USER_PROFILE,
component: AdminUserProfile, component: () =>
import(/* webpackChunkName: "AdminUserProfile" */ "@/views/Admin/AdminUserProfile.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/profiles", path: "admin/profiles",
name: SettingsRouteName.PROFILES, name: SettingsRouteName.PROFILES,
component: Profiles, component: () =>
import(/* webpackChunkName: "AdminProfiles" */ "@/views/Admin/Profiles.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/profiles/:id", path: "admin/profiles/:id",
name: SettingsRouteName.ADMIN_PROFILE, name: SettingsRouteName.ADMIN_PROFILE,
component: AdminProfile, component: () =>
import(/* webpackChunkName: "AdminProfile" */ "@/views/Admin/AdminProfile.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/groups", path: "admin/groups",
name: SettingsRouteName.ADMIN_GROUPS, name: SettingsRouteName.ADMIN_GROUPS,
component: GroupProfiles, component: () =>
import(/* webpackChunkName: "GroupProfiles" */ "@/views/Admin/GroupProfiles.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "admin/groups/:id", path: "admin/groups/:id",
name: SettingsRouteName.ADMIN_GROUP_PROFILE, name: SettingsRouteName.ADMIN_GROUP_PROFILE,
component: AdminGroupProfile, component: () =>
import(/* webpackChunkName: "AdminGroupProfile" */ "@/views/Admin/AdminGroupProfile.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
@ -145,17 +135,19 @@ export const settingsRoutes: RouteConfig[] = [
path: "admin/relays", path: "admin/relays",
name: SettingsRouteName.RELAYS, name: SettingsRouteName.RELAYS,
redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS }, redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS },
component: Follows, component: () => import(/* webpackChunkName: "Follows" */ "@/views/Admin/Follows.vue"),
children: [ children: [
{ {
path: "followings", path: "followings",
name: SettingsRouteName.RELAY_FOLLOWINGS, name: SettingsRouteName.RELAY_FOLLOWINGS,
component: Followings, component: () =>
import(/* webpackChunkName: "Followings" */ "@/components/Admin/Followings.vue"),
}, },
{ {
path: "followers", path: "followers",
name: SettingsRouteName.RELAY_FOLLOWERS, name: SettingsRouteName.RELAY_FOLLOWERS,
component: Followers, component: () =>
import(/* webpackChunkName: "Followers" */ "@/components/Admin/Followers.vue"),
}, },
], ],
props: true, props: true,
@ -169,21 +161,23 @@ export const settingsRoutes: RouteConfig[] = [
{ {
path: "/moderation/reports/:filter?", path: "/moderation/reports/:filter?",
name: SettingsRouteName.REPORTS, name: SettingsRouteName.REPORTS,
component: ReportList, component: () =>
import(/* webpackChunkName: "ReportList" */ "@/views/Moderation/ReportList.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "/moderation/report/:reportId", path: "/moderation/report/:reportId",
name: SettingsRouteName.REPORT, name: SettingsRouteName.REPORT,
component: Report, component: () => import(/* webpackChunkName: "Report" */ "@/views/Moderation/Report.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
{ {
path: "/moderation/logs", path: "/moderation/logs",
name: SettingsRouteName.REPORT_LOGS, name: SettingsRouteName.REPORT_LOGS,
component: Logs, component: () =>
import(/* webpackChunkName: "ModerationLogs" */ "@/views/Moderation/Logs.vue"),
props: true, props: true,
meta: { requiredAuth: true }, meta: { requiredAuth: true },
}, },
@ -195,13 +189,19 @@ export const settingsRoutes: RouteConfig[] = [
{ {
path: "/identity/create", path: "/identity/create",
name: SettingsRouteName.CREATE_IDENTITY, name: SettingsRouteName.CREATE_IDENTITY,
component: EditIdentity, component: () =>
import(
/* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue"
),
props: (route) => ({ identityName: route.params.identityName, isUpdate: false }), props: (route) => ({ identityName: route.params.identityName, isUpdate: false }),
}, },
{ {
path: "/identity/update/:identityName?", path: "/identity/update/:identityName?",
name: SettingsRouteName.UPDATE_IDENTITY, name: SettingsRouteName.UPDATE_IDENTITY,
component: EditIdentity, component: () =>
import(
/* webpackChunkName: "EditIdentity" */ "@/views/Account/children/EditIdentity.vue"
),
props: (route) => ({ identityName: route.params.identityName, isUpdate: true }), props: (route) => ({ identityName: route.params.identityName, isUpdate: true }),
}, },
], ],

View File

@ -16,7 +16,7 @@ export const userRoutes: RouteConfig[] = [
{ {
path: "/register/user", path: "/register/user",
name: UserRouteName.REGISTER, name: UserRouteName.REGISTER,
component: () => import("@/views/User/Register.vue"), component: () => import(/* webpackChunkName: "RegisterUser" */ "@/views/User/Register.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
beforeEnter: beforeRegisterGuard, beforeEnter: beforeRegisterGuard,
@ -24,7 +24,8 @@ export const userRoutes: RouteConfig[] = [
{ {
path: "/register/profile", path: "/register/profile",
name: UserRouteName.REGISTER_PROFILE, name: UserRouteName.REGISTER_PROFILE,
component: () => import("@/views/Account/Register.vue"), component: () =>
import(/* webpackChunkName: "RegisterProfile" */ "@/views/Account/Register.vue"),
// We can only pass string values through params, therefore // We can only pass string values through params, therefore
props: (route) => ({ props: (route) => ({
email: route.params.email, email: route.params.email,
@ -35,42 +36,46 @@ export const userRoutes: RouteConfig[] = [
{ {
path: "/resend-instructions", path: "/resend-instructions",
name: UserRouteName.RESEND_CONFIRMATION, name: UserRouteName.RESEND_CONFIRMATION,
component: () => import("@/views/User/ResendConfirmation.vue"), component: () =>
import(/* webpackChunkName: "ResendConfirmation" */ "@/views/User/ResendConfirmation.vue"),
props: true, props: true,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: "/password-reset/send", path: "/password-reset/send",
name: UserRouteName.SEND_PASSWORD_RESET, name: UserRouteName.SEND_PASSWORD_RESET,
component: () => import("@/views/User/SendPasswordReset.vue"), component: () =>
import(/* webpackChunkName: "SendPasswordReset" */ "@/views/User/SendPasswordReset.vue"),
props: true, props: true,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: "/password-reset/:token", path: "/password-reset/:token",
name: UserRouteName.PASSWORD_RESET, name: UserRouteName.PASSWORD_RESET,
component: () => import("@/views/User/PasswordReset.vue"), component: () =>
import(/* webpackChunkName: "PasswordReset" */ "@/views/User/PasswordReset.vue"),
meta: { requiresAuth: false }, meta: { requiresAuth: false },
props: true, props: true,
}, },
{ {
path: "/validate/email/:token", path: "/validate/email/:token",
name: UserRouteName.EMAIL_VALIDATE, name: UserRouteName.EMAIL_VALIDATE,
component: () => import("@/views/User/EmailValidate.vue"), component: () =>
import(/* webpackChunkName: "EmailValidate" */ "@/views/User/EmailValidate.vue"),
props: true, props: true,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: "/validate/:token", path: "/validate/:token",
name: UserRouteName.VALIDATE, name: UserRouteName.VALIDATE,
component: () => import("@/views/User/Validate.vue"), component: () => import(/* webpackChunkName: "Validate" */ "@/views/User/Validate.vue"),
props: true, props: true,
meta: { requiresAuth: false }, meta: { requiresAuth: false },
}, },
{ {
path: "/login", path: "/login",
name: UserRouteName.LOGIN, name: UserRouteName.LOGIN,
component: () => import("@/views/User/Login.vue"), component: () => import(/* webpackChunkName: "Login" */ "@/views/User/Login.vue"),
props: true, props: true,
meta: { requiredAuth: false }, meta: { requiredAuth: false },
}, },

View File

@ -1,11 +1,17 @@
import { IEvent } from "@/types/event.model"; import { IEvent } from "@/types/event.model";
import { IGroup } from "./actor";
export interface IDashboard { export interface IDashboard {
lastPublicEventPublished: IEvent; lastPublicEventPublished: IEvent;
lastGroupCreated: IGroup;
numberOfUsers: number; numberOfUsers: number;
numberOfEvents: number; numberOfEvents: number;
numberOfComments: number; numberOfComments: number;
numberOfReports: number; numberOfReports: number;
numberOfGroups: number;
numberOfFollowers: number;
numberOfFollowings: number;
numberOfConfirmedParticipationsToLocalEvents: number;
} }
export enum InstanceTermsType { export enum InstanceTermsType {

View File

@ -18,11 +18,23 @@
<div class="tile is-parent is-vertical is-6"> <div class="tile is-parent is-vertical is-6">
<article class="tile is-child box"> <article class="tile is-child box">
<p class="dashboard-number">{{ dashboard.numberOfEvents }}</p> <p class="dashboard-number">{{ dashboard.numberOfEvents }}</p>
<p>{{ $t("Published events") }}</p> <p
v-html="
$t(
'Published events with <b>{comments}</b> comments and <b>{participations}</b> confirmed participations',
{
comments: dashboard.numberOfComments,
participations: dashboard.numberOfConfirmedParticipationsToLocalEvents,
}
)
"
/>
</article> </article>
<article class="tile is-child box"> <article class="tile is-child box">
<p class="dashboard-number">{{ dashboard.numberOfComments }}</p> <router-link :to="{ name: RouteName.ADMIN_GROUPS }">
<p>{{ $t("Comments") }}</p> <p class="dashboard-number">{{ dashboard.numberOfGroups }}</p>
<p>{{ $t("Groups") }}</p>
</router-link>
</article> </article>
</div> </div>
<div class="tile is-parent is-vertical"> <div class="tile is-parent is-vertical">
@ -32,29 +44,66 @@
<p>{{ $t("Users") }}</p> <p>{{ $t("Users") }}</p>
</router-link> </router-link>
</article> </article>
<article class="tile is-child box">
<router-link :to="{ name: RouteName.RELAY_FOLLOWERS }">
<p class="dashboard-number">{{ dashboard.numberOfFollowers }}</p>
<p>{{ $t("Instances following you") }}</p>
</router-link>
</article>
</div>
<div class="tile is-parent is-vertical">
<article class="tile is-child box"> <article class="tile is-child box">
<router-link :to="{ name: RouteName.REPORTS }"> <router-link :to="{ name: RouteName.REPORTS }">
<p class="dashboard-number">{{ dashboard.numberOfReports }}</p> <p class="dashboard-number">{{ dashboard.numberOfReports }}</p>
<p>{{ $t("Opened reports") }}</p> <p>{{ $t("Opened reports") }}</p>
</router-link> </router-link>
</article> </article>
<article class="tile is-child box">
<router-link :to="{ name: RouteName.RELAY_FOLLOWINGS }">
<p class="dashboard-number">{{ dashboard.numberOfFollowings }}</p>
<p>{{ $t("Instances you follow") }}</p>
</router-link>
</article>
</div> </div>
</div> </div>
<div class="tile is-parent" v-if="dashboard.lastPublicEventPublished"> <div class="tile">
<router-link <div class="tile is-parent is-vertical is-6" v-if="dashboard.lastPublicEventPublished">
:to="{
name: RouteName.EVENT,
params: { uuid: dashboard.lastPublicEventPublished.uuid },
}"
>
<article class="tile is-child box"> <article class="tile is-child box">
<p class="dashboard-number">{{ $t("Last published event") }}</p> <router-link
<p class="subtitle">{{ dashboard.lastPublicEventPublished.title }}</p> :to="{
<figure class="image is-4by3" v-if="dashboard.lastPublicEventPublished.picture"> name: RouteName.EVENT,
<img :src="dashboard.lastPublicEventPublished.picture.url" /> params: { uuid: dashboard.lastPublicEventPublished.uuid },
</figure> }"
>
<p>{{ $t("Last published event") }}</p>
<p class="subtitle">{{ dashboard.lastPublicEventPublished.title }}</p>
<figure class="image is-4by3" v-if="dashboard.lastPublicEventPublished.picture">
<img :src="dashboard.lastPublicEventPublished.picture.url" />
</figure>
</router-link>
</article> </article>
</router-link> </div>
<div class="tile is-parent is-vertical" v-if="dashboard.lastGroupCreated">
<article class="tile is-child box">
<router-link
:to="{
name: RouteName.GROUP,
params: { preferredUsername: usernameWithDomain(dashboard.lastGroupCreated) },
}"
>
<p>{{ $t("Last group created") }}</p>
<p class="subtitle">
{{
dashboard.lastGroupCreated.name ||
dashboard.lastGroupCreated.preferredUsername
}}
</p>
<figure class="image is-4by3" v-if="dashboard.lastGroupCreated.avatar">
<img :src="dashboard.lastGroupCreated.avatar.url" />
</figure>
</router-link>
</article>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -65,6 +114,7 @@
import { Component, Vue } from "vue-property-decorator"; import { Component, Vue } from "vue-property-decorator";
import { DASHBOARD } from "@/graphql/admin"; import { DASHBOARD } from "@/graphql/admin";
import { IDashboard } from "@/types/admin.model"; import { IDashboard } from "@/types/admin.model";
import { usernameWithDomain } from "@/types/actor";
import RouteName from "../../router/name"; import RouteName from "../../router/name";
@Component({ @Component({
@ -85,6 +135,8 @@ export default class Dashboard extends Vue {
dashboard!: IDashboard; dashboard!: IDashboard;
RouteName = RouteName; RouteName = RouteName;
usernameWithDomain = usernameWithDomain;
} }
</script> </script>

View File

@ -114,7 +114,7 @@
</div> </div>
</form> </form>
</section> </section>
<b-message> <b-message v-else>
{{ $t("You are not an administrator for this group.") }} {{ $t("You are not an administrator for this group.") }}
</b-message> </b-message>
</div> </div>

View File

@ -34,7 +34,7 @@
</section> </section>
<div class="container section" v-if="config && (!currentUser.id || !currentActor.id)"> <div class="container section" v-if="config && (!currentUser.id || !currentActor.id)">
<section class="events-featured"> <section class="events-featured">
<h3 class="title">{{ $t("Featured events") }}</h3> <h2 class="title">{{ $t("Featured events") }}</h2>
<b-loading :active.sync="$apollo.loading" /> <b-loading :active.sync="$apollo.loading" />
<div v-if="filteredFeaturedEvents.length > 0" class="columns is-multiline"> <div v-if="filteredFeaturedEvents.length > 0" class="columns is-multiline">
<div <div
@ -108,7 +108,7 @@
</div> </div>
</section> </section>
<section class="events-featured"> <section class="events-featured">
<h3 class="title">{{ $t("Featured events") }}</h3> <h2 class="title">{{ $t("Featured events") }}</h2>
<b-loading :active.sync="$apollo.loading" /> <b-loading :active.sync="$apollo.loading" />
<div v-if="filteredFeaturedEvents.length > 0" class="columns is-multiline"> <div v-if="filteredFeaturedEvents.length > 0" class="columns is-multiline">
<div <div

View File

@ -37,12 +37,4 @@ module.exports = {
}, },
}, },
}, },
// configureWebpack: {
// optimization: {
// splitChunks: {
// minSize: 10000,
// maxSize: 250000,
// },
// },
// },
}; };

View File

@ -178,13 +178,25 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
_ -> nil _ -> nil
end end
last_group_created =
case Actors.list_actors(:Group) do
%Page{elements: [group | _]} -> group
_ -> nil
end
{:ok, {:ok,
%{ %{
number_of_users: Statistics.get_cached_value(:local_users), number_of_users: Statistics.get_cached_value(:local_users),
number_of_events: Statistics.get_cached_value(:local_events), number_of_events: Statistics.get_cached_value(:local_events),
number_of_groups: Statistics.get_cached_value(:local_groups),
number_of_comments: Statistics.get_cached_value(:local_comments), number_of_comments: Statistics.get_cached_value(:local_comments),
number_of_confirmed_participations_to_local_events:
Statistics.get_cached_value(:confirmed_participations_to_local_events),
number_of_reports: Mobilizon.Reports.count_opened_reports(), number_of_reports: Mobilizon.Reports.count_opened_reports(),
last_public_event_published: last_public_event_published number_of_followers: Statistics.get_cached_value(:instance_followers),
number_of_followings: Statistics.get_cached_value(:instance_followings),
last_public_event_published: last_public_event_published,
last_group_created: last_group_created
}} }}
end end

View File

@ -70,11 +70,19 @@ defmodule Mobilizon.GraphQL.Schema.AdminType do
end end
object :dashboard do object :dashboard do
field(:last_public_event_published, :event, description: "Last public event publish") field(:last_public_event_published, :event, description: "Last public event published")
field(:last_group_created, :group, description: "Last public group created")
field(:number_of_users, :integer, description: "The number of local users") field(:number_of_users, :integer, description: "The number of local users")
field(:number_of_events, :integer, description: "The number of local events") field(:number_of_events, :integer, description: "The number of local events")
field(:number_of_comments, :integer, description: "The number of local comments") field(:number_of_comments, :integer, description: "The number of local comments")
field(:number_of_groups, :integer, description: "The number of local groups")
field(:number_of_reports, :integer, description: "The number of current opened reports") field(:number_of_reports, :integer, description: "The number of current opened reports")
field(:number_of_followers, :integer, description: "The number of instance followers")
field(:number_of_followings, :integer, description: "The number of instance followings")
field(:number_of_confirmed_participations_to_local_events, :integer,
description: "The number of total confirmed participations to local events"
)
end end
object :admin_settings do object :admin_settings do

View File

@ -160,9 +160,7 @@ defmodule Mix.Tasks.Mobilizon.Instance do
database_password: dbpass database_password: dbpass
) )
Mix.shell().info( Mix.shell().info("Writing config to #{config_path}.")
"Writing config to #{config_path}. You should rename it to .env.production, .env.dev or .env.test"
)
File.write(config_path, result_config) File.write(config_path, result_config)
Mix.shell().info("Writing #{psql_path}.") Mix.shell().info("Writing #{psql_path}.")

View File

@ -283,16 +283,24 @@ defmodule Mobilizon.Discussions do
end end
@doc """ @doc """
Counts local comments. Counts local comments under events
""" """
@spec count_local_comments :: integer @spec count_local_comments_under_events :: integer
def count_local_comments, do: Repo.one(count_local_comments_query()) def count_local_comments_under_events do
count_local_comments_query()
|> filter_comments_under_events()
|> Repo.one()
end
@doc """ @doc """
Counts all comments. Counts all comments.
""" """
@spec count_comments :: integer @spec count_comments_under_events :: integer
def count_comments, do: Repo.one(count_comments_query()) def count_comments_under_events do
count_comments_query()
|> filter_comments_under_events()
|> Repo.one()
end
def get_discussion(discussion_id) do def get_discussion(discussion_id) do
Discussion Discussion
@ -423,11 +431,8 @@ defmodule Mobilizon.Discussions do
@spec count_local_comments_query :: Ecto.Query.t() @spec count_local_comments_query :: Ecto.Query.t()
defp count_local_comments_query do defp count_local_comments_query do
from( count_comments_query()
c in Comment, |> where([c], local: true)
select: count(c.id),
where: c.local == ^true and c.visibility in ^@public_visibility
)
end end
@spec count_comments_query :: Ecto.Query.t() @spec count_comments_query :: Ecto.Query.t()
@ -439,6 +444,10 @@ defmodule Mobilizon.Discussions do
) )
end end
defp filter_comments_under_events(query) do
where(query, [c], is_nil(c.discussion_id) and not is_nil(c.event_id))
end
@spec preload_for_comment(Ecto.Query.t()) :: Ecto.Query.t() @spec preload_for_comment(Ecto.Query.t()) :: Ecto.Query.t()
defp preload_for_comment(query), do: preload(query, ^@comment_preloads) defp preload_for_comment(query), do: preload(query, ^@comment_preloads)
end end

View File

@ -798,6 +798,15 @@ defmodule Mobilizon.Events do
@moderator_roles [:moderator, :administrator, :creator] @moderator_roles [:moderator, :administrator, :creator]
@doc """
Returns the number of participations for all local events
"""
@spec count_confirmed_participants_for_local_events :: integer()
def count_confirmed_participants_for_local_events do
count_confirmed_participants_for_local_events_query()
|> Repo.one()
end
@doc """ @doc """
Returns the list of participants for an event. Returns the list of participants for an event.
Default behaviour is to not return :not_approved or :not_confirmed participants Default behaviour is to not return :not_approved or :not_confirmed participants
@ -1548,6 +1557,14 @@ defmodule Mobilizon.Events do
from(s in Session, where: s.track_id == ^track_id) from(s in Session, where: s.track_id == ^track_id)
end end
@spec count_confirmed_participants_for_local_events_query :: Ecto.Query.t()
defp count_confirmed_participants_for_local_events_query do
Participant
|> join(:inner, [p], e in Event, on: p.event_id == e.id)
|> where([p, e], e.local and p.role not in [^:not_approved, ^:not_confirmed, ^:rejected])
|> select([p], count(p.id))
end
@spec list_participants_for_event_query(String.t()) :: Ecto.Query.t() @spec list_participants_for_event_query(String.t()) :: Ecto.Query.t()
defp list_participants_for_event_query(event_id) do defp list_participants_for_event_query(event_id) do
from( from(

View File

@ -26,8 +26,12 @@ defmodule Mobilizon.Service.Statistics do
Events.count_local_events() Events.count_local_events()
end end
defp create_cache(:confirmed_participations_to_local_events) do
Events.count_confirmed_participants_for_local_events()
end
defp create_cache(:local_comments) do defp create_cache(:local_comments) do
Discussions.count_local_comments() Discussions.count_local_comments_under_events()
end end
defp create_cache(:local_groups) do defp create_cache(:local_groups) do
@ -39,7 +43,7 @@ defmodule Mobilizon.Service.Statistics do
end end
defp create_cache(:federation_comments) do defp create_cache(:federation_comments) do
Discussions.count_comments() Discussions.count_comments_under_events()
end end
defp create_cache(:federation_groups) do defp create_cache(:federation_groups) do