From 5ae0c57a1a73c897442a1c7a9aea43cf70279776 Mon Sep 17 00:00:00 2001 From: bohung Date: Fri, 15 May 2020 22:46:28 +0800 Subject: [PATCH] fix bug. --- app/controllers/admin/announcements_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/announcements_controller.rb index 98dcae1..6414b79 100644 --- a/app/controllers/admin/announcements_controller.rb +++ b/app/controllers/admin/announcements_controller.rb @@ -14,12 +14,12 @@ class Admin::AnnouncementsController < OrbitAdminController def index Bulletin.remove_expired_status @tags = @module_app.tags - @categories = @module_app.categories.enabled - @filter_fields = filter_fields(@categories, @tags) @table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified] if AnnouncementSetting.first.is_display_edit_only && !current_user.is_admin? && !current_user.is_manager?(@module_app) current_user_is_sub_manager = !current_user.is_manager?(@module_app) && (current_user.is_sub_manager?(@module_app) || current_user.is_sub_manager_with_role?(@module_app)) rescue false if current_user_is_sub_manager + @categories = current_user.approved_categories.select{|c| c.module_app_id == @module_app.id} rescue [] + @filter_fields = filter_fields(@categories, @tags) @bulletins = Bulletin.where(:create_user_id=>current_user.id,:title.ne => "",:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category")) @@ -27,8 +27,12 @@ class Admin::AnnouncementsController < OrbitAdminController .with_status(filters("status")) else @bulletins = Bulletin.where(:uid=>nil) + @categories = @module_app.categories.enabled + @filter_fields = filter_fields(@categories, @tags) end else + @categories = @module_app.categories.enabled + @filter_fields = filter_fields(@categories, @tags) @bulletins = Bulletin.where(:title.ne => "",:is_preview.in=>[false,nil]) .order_by(sort) .with_categories(filters("category"))