9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/services/newsmast_mastodon/update_channel_name_services.rb', line 9
def call(account, options = {})
return if is_non_channel?
return unless options[:type] == 'channel_feed'
return unless Object.const_defined?('NewsmastMastodon::CommunityAdmin')
return unless defined?(NewsmastMastodon::CommunityAdmin) && NewsmastMastodon::CommunityAdmin.respond_to?(:find_by)
return unless NewsmastMastodon::CommunityAdmin.table_exists?
= NewsmastMastodon::CommunityAdmin.find_by(
account_id: account.id,
is_boost_bot: true,
account_status: NewsmastMastodon::CommunityAdmin.account_statuses['active']
)
return unless
= .
.update!(
name: account.display_name.strip.presence,
description: account.note,
avatar_image: account.avatar,
banner_image: account.
)
rescue ActiveRecord::RecordInvalid => e
Rails.logger.error "[UpdateChannelNameServices] Community update failed: #{e.record.class} - #{e.message}"
end
|