Browse Source

Fix a non-admin user edit its article caused article loses is_notice

master
Menci 6 years ago
parent
commit
9fb4a1d540
  1. 2
      modules/discussion.js

2
modules/discussion.js

@ -190,7 +190,7 @@ app.post('/article/:id/edit', async (req, res) => {
article.title = req.body.title;
article.content = req.body.content;
article.update_time = time;
article.is_notice = res.locals.user && res.locals.user.is_admin && req.body.is_notice === 'on';
article.is_notice = (res.locals.user && res.locals.user.is_admin ? req.body.is_notice === 'on' : article.is_notice);
await article.save();

Loading…
Cancel
Save