From 68438a7d92d371378d3f93464edabbb4b4d30048 Mon Sep 17 00:00:00 2001 From: Menci Date: Mon, 24 Apr 2017 18:23:11 +0800 Subject: [PATCH] Fix can't see problem without login --- models/problem.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/problem.js b/models/problem.js index b638819..29b0e98 100644 --- a/models/problem.js +++ b/models/problem.js @@ -240,9 +240,10 @@ class Problem extends Model { } async isAllowedUseBy(user) { + if (this.is_public) return true; if (!user) return false; if (await user.hasPrivilege('manage_problem')) return true; - return this.is_public || this.user_id === user.id; + return this.user_id === user.id; } async isAllowedManageBy(user) {