From faedbd4a114cb3def4c614e9b604b7f912ffcf99 Mon Sep 17 00:00:00 2001 From: Bohung Date: Wed, 1 Sep 2021 17:51:22 +0800 Subject: [PATCH] Fix bug. --- app/controllers/announcements_controller.rb | 6 +++--- app/models/bulletin.rb | 3 ++- app/views/announcements/show.html.erb | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index a51358d..f91d4d6 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -44,7 +44,7 @@ class AnnouncementsController < ApplicationController "source-site-link" => "", "subtitle" => a.subtitle, "statuses" => statuses, - "category" => a.category.title, + "category" => (a.category.title rescue ""), "postdate" => a.postdate, "author" => author, "is_top" => (a.is_top? ? 1 : 0), @@ -575,7 +575,7 @@ class AnnouncementsController < ApplicationController end end - return {} if announcement.category.disable + return {} if (announcement.category.disable rescue false) tags = announcement.tags.map{|tag| { "tag" => tag.name , @@ -788,7 +788,7 @@ class AnnouncementsController < ApplicationController "source-site-link" => "", "subtitle" => a.subtitle, "statuses" => statuses, - "category" => a.category.title, + "category" => (a.category.title rescue ""), "postdate" => a.postdate, "author" => author, "is_top" => (a.is_top? ? 1 : 0), diff --git a/app/models/bulletin.rb b/app/models/bulletin.rb index b752a89..1824630 100644 --- a/app/models/bulletin.rb +++ b/app/models/bulletin.rb @@ -65,7 +65,8 @@ class Bulletin field :open_comment, :type => Boolean, :default => false field :comment_end_time, :type => DateTime field :comment_role, :type => Array, :default => [] - + field :enable_sub_annc, :type => Boolean, :default => false + field :sub_annc_list, :type => Array, :default => [] mount_uploader :image, ImageUploader has_many :bulletin_links, :autosave => true, :dependent => :destroy diff --git a/app/views/announcements/show.html.erb b/app/views/announcements/show.html.erb index 8627995..a63f2b9 100644 --- a/app/views/announcements/show.html.erb +++ b/app/views/announcements/show.html.erb @@ -169,7 +169,7 @@
by <%= comment.account %>

-<% end %> +<% end rescue nil %> <% if action_data['show_comment_flag'] %>
@@ -177,4 +177,4 @@ <%= t('announcement.send_comment') %>
-<% end %> \ No newline at end of file +<% end rescue nil %> \ No newline at end of file