Introduce group basic federation, event new page and notifications
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,8 +1,41 @@
|
||||
import { RouteConfig } from "vue-router";
|
||||
import GroupList from "@/views/Group/GroupList.vue";
|
||||
import CreateGroup from "@/views/Group/Create.vue";
|
||||
import Group from "@/views/Group/Group.vue";
|
||||
import MyGroups from "@/views/Group/MyGroups.vue";
|
||||
|
||||
export enum ActorRouteName {
|
||||
GROUP_LIST = 'GroupList',
|
||||
GROUP = 'Group',
|
||||
CREATE_GROUP = 'CreateGroup',
|
||||
PROFILE = 'Profile',
|
||||
GROUP_LIST = "GroupList",
|
||||
GROUP = "Group",
|
||||
CREATE_GROUP = "CreateGroup",
|
||||
PROFILE = "Profile",
|
||||
MY_GROUPS = "MY_GROUPS",
|
||||
}
|
||||
|
||||
|
||||
export const actorRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: "/groups",
|
||||
name: ActorRouteName.GROUP_LIST,
|
||||
component: GroupList,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: "/groups/create",
|
||||
name: ActorRouteName.CREATE_GROUP,
|
||||
component: CreateGroup,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/@:preferredUsername",
|
||||
name: ActorRouteName.GROUP,
|
||||
component: Group,
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: "/groups/me",
|
||||
name: ActorRouteName.MY_GROUPS,
|
||||
component: MyGroups,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
];
|
||||
|
||||
34
js/src/router/conversation.ts
Normal file
34
js/src/router/conversation.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { RouteConfig } from "vue-router";
|
||||
import CreateConversation from "@/views/Conversations/Create.vue";
|
||||
import ConversationsList from "@/views/Conversations/ConversationsList.vue";
|
||||
import Conversation from "@/views/Conversations/Conversation.vue";
|
||||
|
||||
export enum ConversationRouteName {
|
||||
CONVERSATION_LIST = "CONVERSATION_LIST",
|
||||
CREATE_CONVERSATION = "CREATE_CONVERSATION",
|
||||
CONVERSATION = "CONVERSATION",
|
||||
}
|
||||
|
||||
export const conversationRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: "/@:preferredUsername/conversations",
|
||||
name: ConversationRouteName.CONVERSATION_LIST,
|
||||
component: ConversationsList,
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: "/@:preferredUsername/conversations/new",
|
||||
name: ConversationRouteName.CREATE_CONVERSATION,
|
||||
component: CreateConversation,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/@:preferredUsername/:slug/:id/:comment_id?",
|
||||
name: ConversationRouteName.CONVERSATION,
|
||||
component: Conversation,
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
];
|
||||
@@ -1,14 +1,14 @@
|
||||
import { beforeRegisterGuard } from '@/router/guards/register-guard';
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import ErrorPage from '@/views/Error.vue';
|
||||
import { beforeRegisterGuard } from "@/router/guards/register-guard";
|
||||
import { RouteConfig } from "vue-router";
|
||||
import ErrorPage from "../views/Error.vue";
|
||||
|
||||
export enum ErrorRouteName {
|
||||
ERROR = 'Error',
|
||||
ERROR = "Error",
|
||||
}
|
||||
|
||||
export const errorRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/error',
|
||||
path: "/error",
|
||||
name: ErrorRouteName.ERROR,
|
||||
component: ErrorPage,
|
||||
beforeEnter: beforeRegisterGuard,
|
||||
|
||||
@@ -1,114 +1,109 @@
|
||||
import EventList from '@/views/Event/EventList.vue';
|
||||
import Location from '@/views/Location.vue';
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import ParticipationWithAccount from '@/components/Participation/ParticipationWithAccount.vue';
|
||||
import UnloggedParticipation from '@/components/Participation/UnloggedParticipation.vue';
|
||||
import ParticipationWithoutAccount from '@/components/Participation/ParticipationWithoutAccount.vue';
|
||||
import ConfirmParticipation from '@/components/Participation/ConfirmParticipation.vue';
|
||||
import { RouteConfig } from "vue-router";
|
||||
import EventList from "../views/Event/EventList.vue";
|
||||
import Location from "../views/Location.vue";
|
||||
|
||||
// tslint:disable:space-in-parens
|
||||
const participations = () => import(/* webpackChunkName: "participations" */ '@/views/Event/Participants.vue');
|
||||
const editEvent = () => import(/* webpackChunkName: "edit-event" */ '@/views/Event/Edit.vue');
|
||||
const event = () => import(/* webpackChunkName: "event" */ '@/views/Event/Event.vue');
|
||||
const myEvents = () => import(/* webpackChunkName: "my-events" */ '@/views/Event/MyEvents.vue');
|
||||
const explore = () => import(/* webpackChunkName: "explore" */ '@/views/Event/Explore.vue');
|
||||
// tslint:enable
|
||||
const participations = () =>
|
||||
import(/* webpackChunkName: "participations" */ "@/views/Event/Participants.vue");
|
||||
const editEvent = () => import(/* webpackChunkName: "edit-event" */ "@/views/Event/Edit.vue");
|
||||
const event = () => import(/* webpackChunkName: "event" */ "@/views/Event/Event.vue");
|
||||
const myEvents = () => import(/* webpackChunkName: "my-events" */ "@/views/Event/MyEvents.vue");
|
||||
const explore = () => import(/* webpackChunkName: "explore" */ "@/views/Event/Explore.vue");
|
||||
|
||||
export enum EventRouteName {
|
||||
EVENT_LIST = 'EventList',
|
||||
CREATE_EVENT = 'CreateEvent',
|
||||
MY_EVENTS = 'MyEvents',
|
||||
EXPLORE = 'Explore',
|
||||
EDIT_EVENT = 'EditEvent',
|
||||
PARTICIPATIONS = 'Participations',
|
||||
EVENT = 'Event',
|
||||
EVENT_PARTICIPATE_WITH_ACCOUNT = 'EVENT_PARTICIPATE_WITH_ACCOUNT',
|
||||
EVENT_PARTICIPATE_WITHOUT_ACCOUNT = 'EVENT_PARTICIPATE_WITHOUT_ACCOUNT',
|
||||
EVENT_PARTICIPATE_LOGGED_OUT = 'EVENT_PARTICIPATE_LOGGED_OUT',
|
||||
EVENT_PARTICIPATE_CONFIRM = 'EVENT_PARTICIPATE_CONFIRM',
|
||||
LOCATION = 'Location',
|
||||
TAG = 'Tag',
|
||||
EVENT_LIST = "EventList",
|
||||
CREATE_EVENT = "CreateEvent",
|
||||
MY_EVENTS = "MyEvents",
|
||||
EXPLORE = "Explore",
|
||||
EDIT_EVENT = "EditEvent",
|
||||
PARTICIPATIONS = "Participations",
|
||||
EVENT = "Event",
|
||||
EVENT_PARTICIPATE_WITH_ACCOUNT = "EVENT_PARTICIPATE_WITH_ACCOUNT",
|
||||
EVENT_PARTICIPATE_WITHOUT_ACCOUNT = "EVENT_PARTICIPATE_WITHOUT_ACCOUNT",
|
||||
EVENT_PARTICIPATE_LOGGED_OUT = "EVENT_PARTICIPATE_LOGGED_OUT",
|
||||
EVENT_PARTICIPATE_CONFIRM = "EVENT_PARTICIPATE_CONFIRM",
|
||||
LOCATION = "Location",
|
||||
TAG = "Tag",
|
||||
}
|
||||
|
||||
export const eventRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/events/list/:location?',
|
||||
path: "/events/list/:location?",
|
||||
name: EventRouteName.EVENT_LIST,
|
||||
component: EventList,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/events/create',
|
||||
path: "/events/create",
|
||||
name: EventRouteName.CREATE_EVENT,
|
||||
component: editEvent,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/events/explore',
|
||||
path: "/events/explore",
|
||||
name: EventRouteName.EXPLORE,
|
||||
component: explore,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/events/me',
|
||||
path: "/events/me",
|
||||
name: EventRouteName.MY_EVENTS,
|
||||
component: myEvents,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/events/edit/:eventId',
|
||||
path: "/events/edit/:eventId",
|
||||
name: EventRouteName.EDIT_EVENT,
|
||||
component: editEvent,
|
||||
meta: { requiredAuth: true },
|
||||
props: { isUpdate: true },
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/events/:eventId/participations',
|
||||
path: "/events/:eventId/participations",
|
||||
name: EventRouteName.PARTICIPATIONS,
|
||||
component: participations,
|
||||
meta: { requiredAuth: true },
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/location/new',
|
||||
path: "/location/new",
|
||||
name: EventRouteName.LOCATION,
|
||||
component: Location,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/events/:uuid',
|
||||
path: "/events/:uuid",
|
||||
name: EventRouteName.EVENT,
|
||||
component: event,
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/events/:uuid/participate',
|
||||
path: "/events/:uuid/participate",
|
||||
name: EventRouteName.EVENT_PARTICIPATE_LOGGED_OUT,
|
||||
component: UnloggedParticipation,
|
||||
component: () => import("../components/Participation/UnloggedParticipation.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/events/:uuid/participate/with-account',
|
||||
path: "/events/:uuid/participate/with-account",
|
||||
name: EventRouteName.EVENT_PARTICIPATE_WITH_ACCOUNT,
|
||||
component: ParticipationWithAccount,
|
||||
component: () => import("../components/Participation/ParticipationWithAccount.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/events/:uuid/participate/without-account',
|
||||
path: "/events/:uuid/participate/without-account",
|
||||
name: EventRouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT,
|
||||
component: ParticipationWithoutAccount,
|
||||
component: () => import("../components/Participation/ParticipationWithoutAccount.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/participation/email/confirm/:token',
|
||||
path: "/participation/email/confirm/:token",
|
||||
name: EventRouteName.EVENT_PARTICIPATE_CONFIRM,
|
||||
component: ConfirmParticipation,
|
||||
component: () => import("../components/Participation/ConfirmParticipation.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/tag/:tag',
|
||||
path: "/tag/:tag",
|
||||
name: EventRouteName.TAG,
|
||||
redirect: '/search/:tag',
|
||||
redirect: "/search/:tag",
|
||||
},
|
||||
];
|
||||
|
||||
73
js/src/router/groups.ts
Normal file
73
js/src/router/groups.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { RouteConfig } from "vue-router";
|
||||
|
||||
export enum GroupsRouteName {
|
||||
TODO_LISTS = "TODO_LISTS",
|
||||
TODO_LIST = "TODO_LIST",
|
||||
TODO = "TODO",
|
||||
GROUP_SETTINGS = "GROUP_SETTINGS",
|
||||
GROUP_PUBLIC_SETTINGS = "GROUP_PUBLIC_SETTINGS",
|
||||
GROUP_MEMBERS_SETTINGS = "GROUP_MEMBERS_SETTINGS",
|
||||
RESOURCES = "RESOURCES",
|
||||
RESOURCE_FOLDER_ROOT = "RESOURCE_FOLDER_ROOT",
|
||||
RESOURCE_FOLDER = "RESOURCE_FOLDER",
|
||||
}
|
||||
|
||||
const resourceFolder = () => import("@/views/Resources/ResourceFolder.vue");
|
||||
|
||||
export const groupsRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: "/@:preferredUsername/todo-lists",
|
||||
name: GroupsRouteName.TODO_LISTS,
|
||||
component: () => import("@/views/Todos/TodoLists.vue"),
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/todo-lists/:id",
|
||||
name: GroupsRouteName.TODO_LIST,
|
||||
component: () => import("@/views/Todos/TodoList.vue"),
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/todo/:todoId",
|
||||
name: GroupsRouteName.TODO,
|
||||
component: () => import("@/views/Todos/Todo.vue"),
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/@:preferredUsername/resources",
|
||||
name: GroupsRouteName.RESOURCE_FOLDER_ROOT,
|
||||
component: resourceFolder,
|
||||
props: { path: "/" },
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/@:preferredUsername/resources/:path+",
|
||||
name: GroupsRouteName.RESOURCE_FOLDER,
|
||||
component: resourceFolder,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: "/@:preferredUsername/settings",
|
||||
component: () => import("@/views/Group/Settings.vue"),
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
redirect: { name: GroupsRouteName.GROUP_PUBLIC_SETTINGS },
|
||||
name: GroupsRouteName.GROUP_SETTINGS,
|
||||
children: [
|
||||
{
|
||||
path: "public",
|
||||
name: GroupsRouteName.GROUP_PUBLIC_SETTINGS,
|
||||
},
|
||||
{
|
||||
path: "members",
|
||||
name: GroupsRouteName.GROUP_MEMBERS_SETTINGS,
|
||||
component: () => import("../views/Group/GroupMembers.vue"),
|
||||
props: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -1,12 +1,14 @@
|
||||
import { NavigationGuard } from 'vue-router';
|
||||
import { UserRouteName } from '@/router/user';
|
||||
import { LoginErrorCode } from '@/types/login-error-code.model';
|
||||
import { AUTH_ACCESS_TOKEN } from '@/constants';
|
||||
import { NavigationGuard } from "vue-router";
|
||||
import { UserRouteName } from "@/router/user";
|
||||
import { LoginErrorCode } from "@/types/login-error-code.model";
|
||||
import { AUTH_ACCESS_TOKEN } from "@/constants";
|
||||
|
||||
export const authGuardIfNeeded: NavigationGuard = async function (to, from, next) {
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const authGuardIfNeeded: NavigationGuard = async (to, from, next) => {
|
||||
if (to.meta.requiredAuth !== true) return next();
|
||||
|
||||
// We can't use "currentUser" from apollo here because we may not have loaded the user from the local storage yet
|
||||
// We can't use "currentUser" from apollo here
|
||||
// because we may not have loaded the user from the local storage yet
|
||||
if (!localStorage.getItem(AUTH_ACCESS_TOKEN)) {
|
||||
return next({
|
||||
name: UserRouteName.LOGIN,
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import { apolloProvider } from '@/vue-apollo';
|
||||
import { CONFIG } from '@/graphql/config';
|
||||
import { IConfig } from '@/types/config.model';
|
||||
import { NavigationGuard } from 'vue-router';
|
||||
import { ErrorRouteName } from '@/router/error';
|
||||
import { ErrorCode } from '@/types/error-code.model';
|
||||
import { NavigationGuard } from "vue-router";
|
||||
import { CONFIG } from "../../graphql/config";
|
||||
import { ErrorCode } from "../../types/error-code.model";
|
||||
import apolloProvider from "../../vue-apollo";
|
||||
|
||||
export const beforeRegisterGuard: NavigationGuard = async function (to, from, next) {
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const beforeRegisterGuard: NavigationGuard = async (to, from, next) => {
|
||||
const { data } = await apolloProvider.defaultClient.query({
|
||||
query: CONFIG,
|
||||
});
|
||||
|
||||
const config: IConfig = data.config;
|
||||
const { config } = data;
|
||||
|
||||
if (!config.registrationsOpen && !config.registrationsWhitelist) {
|
||||
return next({
|
||||
name: ErrorRouteName.ERROR,
|
||||
name: "Error",
|
||||
query: { code: ErrorCode.REGISTRATION_CLOSED },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
import VueScrollTo from 'vue-scrollto';
|
||||
import PageNotFound from '@/views/PageNotFound.vue';
|
||||
import Home from '@/views/Home.vue';
|
||||
import { UserRouteName, userRoutes } from './user';
|
||||
import { EventRouteName, eventRoutes } from '@/router/event';
|
||||
import { ActorRouteName } from '@/router/actor';
|
||||
import { ErrorRouteName, errorRoutes } from '@/router/error';
|
||||
import { authGuardIfNeeded } from '@/router/guards/auth-guard';
|
||||
import Search from '@/views/Search.vue';
|
||||
import { SettingsRouteName, settingsRoutes } from '@/router/settings';
|
||||
import Vue from "vue";
|
||||
import Router, { Route } from "vue-router";
|
||||
import VueScrollTo from "vue-scrollto";
|
||||
import { PositionResult } from "vue-router/types/router.d";
|
||||
import PageNotFound from "../views/PageNotFound.vue";
|
||||
import Home from "../views/Home.vue";
|
||||
import { eventRoutes } from "./event";
|
||||
import { actorRoutes } from "./actor";
|
||||
import { errorRoutes } from "./error";
|
||||
import { authGuardIfNeeded } from "./guards/auth-guard";
|
||||
import Search from "../views/Search.vue";
|
||||
import { settingsRoutes } from "./settings";
|
||||
import { groupsRoutes } from "./groups";
|
||||
import { conversationRoutes } from "./conversation";
|
||||
import { userRoutes } from "./user";
|
||||
import RouteName from "./name";
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
enum GlobalRouteName {
|
||||
HOME = 'Home',
|
||||
ABOUT = 'About',
|
||||
PAGE_NOT_FOUND = 'PageNotFound',
|
||||
SEARCH = 'Search',
|
||||
TERMS = 'TERMS',
|
||||
INTERACT = 'INTERACT',
|
||||
}
|
||||
|
||||
function scrollBehavior(to, from, savedPosition) {
|
||||
function scrollBehavior(
|
||||
to: Route,
|
||||
from: Route,
|
||||
savedPosition: any
|
||||
): PositionResult | undefined | null {
|
||||
if (to.hash) {
|
||||
VueScrollTo.scrollTo(to.hash, 700);
|
||||
return {
|
||||
@@ -37,65 +36,57 @@ function scrollBehavior(to, from, savedPosition) {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
|
||||
// Hack to merge enums
|
||||
// tslint:disable:variable-name
|
||||
export const RouteName = {
|
||||
...GlobalRouteName,
|
||||
...UserRouteName,
|
||||
...EventRouteName,
|
||||
...ActorRouteName,
|
||||
...SettingsRouteName,
|
||||
...ErrorRouteName,
|
||||
};
|
||||
|
||||
const router = new Router({
|
||||
scrollBehavior,
|
||||
mode: 'history',
|
||||
base: '/',
|
||||
mode: "history",
|
||||
base: "/",
|
||||
routes: [
|
||||
...userRoutes,
|
||||
...eventRoutes,
|
||||
...settingsRoutes,
|
||||
...actorRoutes,
|
||||
...groupsRoutes,
|
||||
...conversationRoutes,
|
||||
...errorRoutes,
|
||||
{
|
||||
path: '/search/:searchTerm/:searchType?',
|
||||
path: "/search/:searchTerm/:searchType?",
|
||||
name: RouteName.SEARCH,
|
||||
component: Search,
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
path: "/",
|
||||
name: RouteName.HOME,
|
||||
component: Home,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
path: "/about",
|
||||
name: RouteName.ABOUT,
|
||||
component: () => import(/* webpackChunkName: "about" */ '@/views/About.vue'),
|
||||
component: () => import(/* webpackChunkName: "about" */ "@/views/About.vue"),
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/terms',
|
||||
path: "/terms",
|
||||
name: RouteName.TERMS,
|
||||
component: () => import(/* webpackChunkName: "cookies" */ '@/views/Terms.vue'),
|
||||
component: () => import(/* webpackChunkName: "cookies" */ "@/views/Terms.vue"),
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/interact',
|
||||
path: "/interact",
|
||||
name: RouteName.INTERACT,
|
||||
component: () => import(/* webpackChunkName: "cookies" */ '@/views/Interact.vue'),
|
||||
component: () => import(/* webpackChunkName: "cookies" */ "@/views/Interact.vue"),
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/404',
|
||||
path: "/404",
|
||||
name: RouteName.PAGE_NOT_FOUND,
|
||||
component: PageNotFound,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
path: "*",
|
||||
redirect: { name: RouteName.PAGE_NOT_FOUND },
|
||||
},
|
||||
],
|
||||
|
||||
29
js/src/router/name.ts
Normal file
29
js/src/router/name.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { EventRouteName } from "./event";
|
||||
import { ActorRouteName } from "./actor";
|
||||
import { ErrorRouteName } from "./error";
|
||||
import { SettingsRouteName } from "./settings";
|
||||
import { GroupsRouteName } from "./groups";
|
||||
import { ConversationRouteName } from "./conversation";
|
||||
import { UserRouteName } from "./user";
|
||||
|
||||
enum GlobalRouteName {
|
||||
HOME = "Home",
|
||||
ABOUT = "About",
|
||||
PAGE_NOT_FOUND = "PageNotFound",
|
||||
SEARCH = "Search",
|
||||
TERMS = "TERMS",
|
||||
INTERACT = "INTERACT",
|
||||
}
|
||||
|
||||
// Hack to merge enums
|
||||
// tslint:disable:variable-name
|
||||
export default {
|
||||
...GlobalRouteName,
|
||||
...UserRouteName,
|
||||
...EventRouteName,
|
||||
...ActorRouteName,
|
||||
...SettingsRouteName,
|
||||
...GroupsRouteName,
|
||||
...ConversationRouteName,
|
||||
...ErrorRouteName,
|
||||
};
|
||||
@@ -1,43 +1,42 @@
|
||||
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 { 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";
|
||||
|
||||
export enum SettingsRouteName {
|
||||
SETTINGS = 'SETTINGS',
|
||||
ACCOUNT_SETTINGS = 'ACCOUNT_SETTINGS',
|
||||
ACCOUNT_SETTINGS_GENERAL = 'ACCOUNT_SETTINGS_GENERAL',
|
||||
PREFERENCES = 'PREFERENCES',
|
||||
NOTIFICATIONS = 'NOTIFICATIONS',
|
||||
ADMIN = 'ADMIN',
|
||||
ADMIN_DASHBOARD = 'ADMIN_DASHBOARD',
|
||||
ADMIN_SETTINGS = 'ADMIN_SETTINGS',
|
||||
RELAYS = 'Relays',
|
||||
RELAY_FOLLOWINGS = 'Followings',
|
||||
RELAY_FOLLOWERS = 'Followers',
|
||||
MODERATION = 'MODERATION',
|
||||
REPORTS = 'Reports',
|
||||
REPORT = 'Report',
|
||||
REPORT_LOGS = 'Logs',
|
||||
CREATE_IDENTITY = 'CreateIdentity',
|
||||
UPDATE_IDENTITY = 'UpdateIdentity',
|
||||
IDENTITIES = 'IDENTITIES',
|
||||
SETTINGS = "SETTINGS",
|
||||
ACCOUNT_SETTINGS = "ACCOUNT_SETTINGS",
|
||||
ACCOUNT_SETTINGS_GENERAL = "ACCOUNT_SETTINGS_GENERAL",
|
||||
PREFERENCES = "PREFERENCES",
|
||||
NOTIFICATIONS = "NOTIFICATIONS",
|
||||
ADMIN = "ADMIN",
|
||||
ADMIN_DASHBOARD = "ADMIN_DASHBOARD",
|
||||
ADMIN_SETTINGS = "ADMIN_SETTINGS",
|
||||
RELAYS = "Relays",
|
||||
RELAY_FOLLOWINGS = "Followings",
|
||||
RELAY_FOLLOWERS = "Followers",
|
||||
MODERATION = "MODERATION",
|
||||
REPORTS = "Reports",
|
||||
REPORT = "Report",
|
||||
REPORT_LOGS = "Logs",
|
||||
CREATE_IDENTITY = "CreateIdentity",
|
||||
UPDATE_IDENTITY = "UpdateIdentity",
|
||||
IDENTITIES = "IDENTITIES",
|
||||
}
|
||||
|
||||
export const settingsRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/settings',
|
||||
path: "/settings",
|
||||
component: Settings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
@@ -45,62 +44,62 @@ export const settingsRoutes: RouteConfig[] = [
|
||||
name: SettingsRouteName.SETTINGS,
|
||||
children: [
|
||||
{
|
||||
path: 'account',
|
||||
path: "account",
|
||||
name: SettingsRouteName.ACCOUNT_SETTINGS,
|
||||
redirect: { name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL },
|
||||
},
|
||||
{
|
||||
path: 'account/general',
|
||||
path: "account/general",
|
||||
name: SettingsRouteName.ACCOUNT_SETTINGS_GENERAL,
|
||||
component: AccountSettings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'preferences',
|
||||
path: "preferences",
|
||||
name: SettingsRouteName.PREFERENCES,
|
||||
component: Preferences,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'notifications',
|
||||
path: "notifications",
|
||||
name: SettingsRouteName.NOTIFICATIONS,
|
||||
component: Notifications,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'admin',
|
||||
path: "admin",
|
||||
name: SettingsRouteName.ADMIN,
|
||||
redirect: { name: SettingsRouteName.ADMIN_DASHBOARD },
|
||||
},
|
||||
{
|
||||
path: 'admin/dashboard',
|
||||
path: "admin/dashboard",
|
||||
name: SettingsRouteName.ADMIN_DASHBOARD,
|
||||
component: Dashboard,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'admin/settings',
|
||||
path: "admin/settings",
|
||||
name: SettingsRouteName.ADMIN_SETTINGS,
|
||||
component: AdminSettings,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: 'admin/relays',
|
||||
path: "admin/relays",
|
||||
name: SettingsRouteName.RELAYS,
|
||||
redirect: { name: SettingsRouteName.RELAY_FOLLOWINGS },
|
||||
component: Follows,
|
||||
children: [
|
||||
{
|
||||
path: 'followings',
|
||||
path: "followings",
|
||||
name: SettingsRouteName.RELAY_FOLLOWINGS,
|
||||
component: Followings,
|
||||
},
|
||||
{
|
||||
path: 'followers',
|
||||
path: "followers",
|
||||
name: SettingsRouteName.RELAY_FOLLOWERS,
|
||||
component: Followers,
|
||||
},
|
||||
@@ -109,44 +108,44 @@ export const settingsRoutes: RouteConfig[] = [
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation',
|
||||
path: "/moderation",
|
||||
name: SettingsRouteName.MODERATION,
|
||||
redirect: { name: SettingsRouteName.REPORTS },
|
||||
},
|
||||
{
|
||||
path: '/moderation/reports/:filter?',
|
||||
path: "/moderation/reports/:filter?",
|
||||
name: SettingsRouteName.REPORTS,
|
||||
component: ReportList,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation/report/:reportId',
|
||||
path: "/moderation/report/:reportId",
|
||||
name: SettingsRouteName.REPORT,
|
||||
component: Report,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/moderation/logs',
|
||||
path: "/moderation/logs",
|
||||
name: SettingsRouteName.REPORT_LOGS,
|
||||
component: Logs,
|
||||
props: true,
|
||||
meta: { requiredAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/identity',
|
||||
path: "/identity",
|
||||
name: SettingsRouteName.IDENTITIES,
|
||||
redirect: { name: SettingsRouteName.UPDATE_IDENTITY },
|
||||
},
|
||||
{
|
||||
path: '/identity/create',
|
||||
path: "/identity/create",
|
||||
name: SettingsRouteName.CREATE_IDENTITY,
|
||||
component: EditIdentity,
|
||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: false }),
|
||||
},
|
||||
{
|
||||
path: '/identity/update/:identityName?',
|
||||
path: "/identity/update/:identityName?",
|
||||
name: SettingsRouteName.UPDATE_IDENTITY,
|
||||
component: EditIdentity,
|
||||
props: (route) => ({ identityName: route.params.identityName, isUpdate: true }),
|
||||
|
||||
@@ -1,80 +1,75 @@
|
||||
import RegisterUser from '@/views/User/Register.vue';
|
||||
import RegisterProfile from '@/views/Account/Register.vue';
|
||||
import Login from '@/views/User/Login.vue';
|
||||
import Validate from '@/views/User/Validate.vue';
|
||||
import ResendConfirmation from '@/views/User/ResendConfirmation.vue';
|
||||
import SendPasswordReset from '@/views/User/SendPasswordReset.vue';
|
||||
import PasswordReset from '@/views/User/PasswordReset.vue';
|
||||
import { beforeRegisterGuard } from '@/router/guards/register-guard';
|
||||
import { RouteConfig } from 'vue-router';
|
||||
import EmailValidate from '@/views/User/EmailValidate.vue';
|
||||
import { beforeRegisterGuard } from "@/router/guards/register-guard";
|
||||
import { RouteConfig } from "vue-router";
|
||||
|
||||
export enum UserRouteName {
|
||||
REGISTER = 'Register',
|
||||
REGISTER_PROFILE = 'RegisterProfile',
|
||||
RESEND_CONFIRMATION = 'ResendConfirmation',
|
||||
SEND_PASSWORD_RESET = 'SendPasswordReset',
|
||||
PASSWORD_RESET = 'PasswordReset',
|
||||
VALIDATE = 'Validate',
|
||||
LOGIN = 'Login',
|
||||
REGISTER = "Register",
|
||||
REGISTER_PROFILE = "RegisterProfile",
|
||||
RESEND_CONFIRMATION = "ResendConfirmation",
|
||||
SEND_PASSWORD_RESET = "SendPasswordReset",
|
||||
PASSWORD_RESET = "PasswordReset",
|
||||
VALIDATE = "Validate",
|
||||
LOGIN = "Login",
|
||||
}
|
||||
|
||||
export const userRoutes: RouteConfig[] = [
|
||||
{
|
||||
path: '/register/user',
|
||||
path: "/register/user",
|
||||
name: UserRouteName.REGISTER,
|
||||
component: RegisterUser,
|
||||
component: () => import("@/views/User/Register.vue"),
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
beforeEnter: beforeRegisterGuard,
|
||||
},
|
||||
{
|
||||
path: '/register/profile',
|
||||
path: "/register/profile",
|
||||
name: UserRouteName.REGISTER_PROFILE,
|
||||
component: RegisterProfile,
|
||||
component: () => import("@/views/Account/Register.vue"),
|
||||
// We can only pass string values through params, therefore
|
||||
props: (route) => ({ email: route.params.email, userAlreadyActivated: route.params.userAlreadyActivated === 'true' }),
|
||||
props: (route) => ({
|
||||
email: route.params.email,
|
||||
userAlreadyActivated: route.params.userAlreadyActivated === "true",
|
||||
}),
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/resend-instructions',
|
||||
path: "/resend-instructions",
|
||||
name: UserRouteName.RESEND_CONFIRMATION,
|
||||
component: ResendConfirmation,
|
||||
component: () => import("@/views/User/ResendConfirmation.vue"),
|
||||
props: true,
|
||||
meta: { requiresAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/password-reset/send',
|
||||
path: "/password-reset/send",
|
||||
name: UserRouteName.SEND_PASSWORD_RESET,
|
||||
component: SendPasswordReset,
|
||||
component: () => import("@/views/User/SendPasswordReset.vue"),
|
||||
props: true,
|
||||
meta: { requiresAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/password-reset/:token',
|
||||
path: "/password-reset/:token",
|
||||
name: UserRouteName.PASSWORD_RESET,
|
||||
component: PasswordReset,
|
||||
component: () => import("@/views/User/PasswordReset.vue"),
|
||||
meta: { requiresAuth: false },
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/validate/email/:token',
|
||||
path: "/validate/email/:token",
|
||||
name: UserRouteName.VALIDATE,
|
||||
component: EmailValidate,
|
||||
component: () => import("@/views/User/EmailValidate.vue"),
|
||||
props: true,
|
||||
meta: { requiresAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/validate/:token',
|
||||
path: "/validate/:token",
|
||||
name: UserRouteName.VALIDATE,
|
||||
component: Validate,
|
||||
component: () => import("@/views/User/Validate.vue"),
|
||||
props: true,
|
||||
meta: { requiresAuth: false },
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
path: "/login",
|
||||
name: UserRouteName.LOGIN,
|
||||
component: Login,
|
||||
component: () => import("@/views/User/Login.vue"),
|
||||
props: true,
|
||||
meta: { requiredAuth: false },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user