core: 添加加域成功提示 (#87)

This commit is contained in:
undefined committed 2021-04-06 18:06:04 +08:00
1 parent 5bbce72a68
commit acf533cdba
6 files changed
+19 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.21.10",
"version": "2.21.11",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+6 -1
View File
@@ -256,6 +256,11 @@ class DomainJoinApplicationsHandler extends ManageHandler {
class DomainJoinHandler extends Handler {
joinSettings: any;
constructor(ctx) {
super(ctx);
this.noCheckPermView = true;
}
async prepare() {
const r = await domain.getRoles(this.domain);
const roles = r.map((role) => role._id);
@@ -283,7 +288,7 @@ class DomainJoinHandler extends Handler {
}
}
await domain.setUserRole(this.domain._id, this.user._id, this.joinSettings.role);
this.response.redirect = this.url('domain_main');
this.response.redirect = this.url('domain_main', { query: { notification: 'Successfully joined domain.' } });
}
}
+1 -1
View File
@@ -3,6 +3,7 @@ import superagent from 'superagent';
import { PassThrough } from 'stream';
import { PermissionError, InvalidTokenError, RemoteOnlineJudgeError } from '../error';
import { Logger } from '../logger';
import { logAndReturn } from '../utils';
import { ProblemAdd } from '../lib/ui';
import { PERM } from '../model/builtin';
import token from '../model/token';
@@ -12,7 +13,6 @@ import {
Handler, Types, Route, post,
} from '../service/server';
import storage from '../service/storage';
import { logAndReturn } from '../utils';
const logger = new Logger('remote');
+3
View File
@@ -381,6 +381,7 @@ export class Handler extends HandlerCommon {
csrfToken: string;
loginMethods: any;
noCheckPermView: boolean;
__param: Record<string, ParamOption[]>;
constructor(ctx: Koa.Context) {
@@ -424,6 +425,7 @@ export class Handler extends HandlerCommon {
this.session = {};
const xff = system.get('server.xff');
if (xff) this.request.ip = this.request.headers[xff.toLowerCase()] || this.request.ip;
this.noCheckPermView = true;
}
// eslint-disable-next-line class-methods-use-this
@@ -494,6 +496,7 @@ export class Handler extends HandlerCommon {
icon: global.Hydro.lib[key].icon,
text: global.Hydro.lib[key].text,
}));
if (!this.noCheckPermView) this.checkPerm(PERM.PERM_VIEW);
}
async finish() {
@@ -0,0 +1,7 @@
import { AutoloadPage } from 'vj/misc/Page';
import Notification from 'vj/components/notification/index';
export default new AutoloadPage('notificationPage', () => {
const text = new URL(window.location.href).searchParams.get('notification');
if (text) new Notification(text).show();
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.5.8",
"version": "4.5.9",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",