This commit is contained in:
BoHung Chiu 2022-05-24 17:57:55 +08:00
parent d3a42b1132
commit 23cba34a97
2 changed files with 9 additions and 6 deletions

View File

@ -212,11 +212,13 @@ class Admin::FeedsController < OrbitAdminController
site_feed.feed_name_translations = params[:feed][:title_translations]
site_feed.disabled = false
site_feed.feed_url = params[:feed][:url]
module_app = ModuleApp.where(:key=>site_feed.channel_key).first
sync_fields_data = SiteFeed::ModuleAppSyncFields.map{|f| [f, module_app[f]] }.to_h
other_site_feed = SiteFeed.where(:remote_site_url=>site_feed.remote_site_url).first
site_feed.channel_title_translations = other_site_feed.channel_title_translations if other_site_feed
module_app = ModuleApp.where(:key=>site_feed.channel_key).first
if module_app.feeds_model
sync_fields_data = SiteFeed::ModuleAppSyncFields.map{|f| [f, module_app[f]] }.to_h
site_feed.update(sync_fields_data)
end
site_feed.save
render :json => {"success" => true}.to_json
end

View File

@ -163,9 +163,10 @@ class SiteFeedAnnc
tmp["view_count"] = ""
end
feeds_time_field = self.feeds_time_field
if feeds_time_field
tmp[feeds_time_field] = tmp[feeds_time_field].blank? ? nil : tmp[feeds_time_field].to_time
end
feeds_time_field = 'postdate' if feeds_time_field.nil?
time_field_value = tmp[feeds_time_field]
tmp[feeds_time_field] = (time_field_value.blank? ? nil : time_field_value.to_time rescue time_field_value)
tmp[feeds_time_field] = time_field_value if tmp[feeds_time_field].nil?
return tmp
end
def cache_annc(force_refresh=false,locales=nil,trans=nil)