GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 39cef6d9 authored by Christopher Fullarton's avatar Christopher Fullarton

Fixes quiz content deletion for public quizzes.

parent a557e906
......@@ -104,7 +104,7 @@ class App {
limit: '50mb',
extended: true,
}));
this._express.options('*', cors(options));
this._express.use('*', cors(options));
this._express.use(compress());
this._express.disable('x-powered-by');
......
......@@ -258,7 +258,9 @@ class QuizDAO extends AbstractDAO {
}
public async setQuizAsInactive(quizName: string, privateKey: string): Promise<void> {
const purgedQuizData = (await UserDAO.getUserByPrivateKey(privateKey)) ? {} : {
const quiz = await this.getQuizByName(quizName);
const purgedQuizData = quiz.visibility === QuizVisibility.Any || (await UserDAO.getUserByPrivateKey(privateKey)) ? {} : {
sessionConfig: null,
questionList: null,
};
......
......@@ -6,6 +6,7 @@ const options: cors.CorsOptions = {
methods: 'GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE',
origin: true,
preflightContinue: false,
exposedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept', 'X-Access-Token', 'authorization'],
};
export default options;
......@@ -686,7 +686,7 @@ export class QuizRouter extends AbstractRouter {
step: MessageProtocol.SaveQuiz,
payload: (
await QuizDAO.getQuizByName(quiz.name)
).toJSON(),
).toJSON({ getters: true }),
};
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment