From 8db1823226e64cc1ba9c83ff64c07bbfcebd8c5c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 2 Aug 2019 11:07:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 8 ++------ dump.rdb | Bin 551 -> 668 bytes 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 0475eb0da..9d7beb6c1 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -3,7 +3,7 @@ class MemosController < ApplicationController before_action :set_memo, only: [:show, :edit, :update, :destroy, :sticky_or_cancel, :hidden, :more_reply] before_action :validate_memo_params, only: [:create, :update] before_action :owner_or_admin, only: [:edit, :update, :destroy] - before_action :is_admin, only: [:sticky_or_cancel, :hidden] + before_action :require_business, only: [:sticky_or_cancel, :hidden] include ApplicationHelper # GET /memos @@ -132,7 +132,7 @@ class MemosController < ApplicationController def hidden tip_exception("不能对主贴进行隐藏操作") if @memo.parent_id.nil? begin - @memo.update_attributes!(hidden: !@memo.hidden) + @memo.update_attributes!(hidden: @memo.hidden == 0 ? 1 : 0) normal_status("更新成功") rescue Exception => e tip_exception("更新失败,原因:#{e}") @@ -182,10 +182,6 @@ class MemosController < ApplicationController tip_exception(403, "无权限操作") unless @memo.author == current_user || current_user.admin? || current_user.business? end - def is_admin - tip_exception(403, "无权限操作") unless current_user.admin? || current_user.business? - end - # Never trust parameters from the scary internet, only allow the white list through. def memo_params params.require(:memo).permit(:subject, :content, :forum_id) diff --git a/dump.rdb b/dump.rdb index a799840b19b627ba79861403e776c55d27442bac..4687968bdc78f7e61538606ad77386166339f236 100644 GIT binary patch delta 421 zcmWmAO=}ZD7y#hiP11&>B7*c}$#%hm9~0+uXC^1pDyX0!3Oz|WGy86vrb%=^T574b z;7Ko*UOd=yz4;f4SAT)GvR(!63a$A3gy*FGx$zNSIry^t;!m^8Awgppe>=5@{aa+| z^1b$KyY6|-!1KbO)Bn30xlNPjQ7`JdVz>p5rnc96T0#l^#Jrq4JYKsF$}+5z7=d66 zaibMd%%q6A)at~tnx<)dbi=3Jdh{5^)9`tNam}LJs}GyIQ8q1$;biUf&ZU9b800%+ zJKY?NU}sevz4sU1zH7W*N6Sy5yNk69iY$CnE3y*8-}}GjQ)vw6I$?rX!%_*_GEPnS z;hM|96p#!|5%q|Oxg>%x+2t(8l!Oy+Vz$m&ou;N5tG)AczxwL86Ba9#!~$VVBL8ZN zQ)IZ@7RbiV38e{_ST2UueShXzX*a+X;fhBp2i7dkpob!ByBL1bZYk)3BHWHUB6IAk_8Eif=KGc7b` zFlH@bG&eOZVm4!AH8?pj12i`}P9i`d19D|_av*;LbaHiNAn;)A z7c?QZee%e3X^vN9SB{g@}Rpw8d??$RI>m8