From 7f4b054a8b21dbe59092f0264c3c302075c34e15 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 20 Nov 2025 11:30:26 +0000 Subject: [PATCH] =?UTF-8?q?add=20show=5Ffeed=20category=E3=80=81hashtags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/announcements_controller.rb | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index 24a7458..5dc978e 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -850,6 +850,26 @@ class AnnouncementsController < ApplicationController locale = OrbitHelper.get_site_locale.to_s url_to_edit = "#" return nil if announcement.blank? + + category_title = "" + if announcement["category"].present? && announcement["category"]["title_translations"].present? + category_title = announcement["category"]["title_translations"][locale] rescue "" + end + + orbithashtags_data = announcement["orbithashtags"] rescue [] + + orbithashtags_output = "" + if orbithashtags_data.is_a?(Array) && orbithashtags_data.any? + orbithashtags_output = orbithashtags_data.map do |hashtag_obj| + name = hashtag_obj["name"].to_s rescue "" + next if name.blank? + + "#{name}" + end.compact.join(" ") + end + + orbithashtags = orbithashtags_output.html_safe + tags = [] announcement["tags"].each{|tag| @@ -932,6 +952,8 @@ class AnnouncementsController < ApplicationController "update_user" => update_user, "updated_at" => (datetime.in_time_zone(Time.zone.utc_offset / 3600).strftime('%Y-%m-%d %H:%M') rescue ""), "body" => announcement["text_translations"][locale], + "category" => category_title, + "orbithashtags" => orbithashtags, "image" => announcement["image"]["original"], "img_src" => img_src, "img_description" => img_description,