Add link to github project to footer, move FanOutOnWriteService calls to

DistributionWorker. That isn't the heaviest service, yet, but gotta start
somewhere
This commit is contained in:
Eugen Rochko 2016-03-25 03:22:26 +01:00
parent 42dcb0d4cb
commit 8eeec389c1
5 changed files with 29 additions and 7 deletions

View File

@ -262,6 +262,21 @@ body {
font-weight: 400; font-weight: 400;
font-family: 'Roboto Mono', monospace; font-family: 'Roboto Mono', monospace;
} }
.powered-by {
font-size: 12px;
font-weight: 400;
color: darken(#d9e1e8, 25%);
a {
color: inherit;
text-decoration: underline;
&:hover {
text-decoration: none;
}
}
}
} }
.mastodon { .mastodon {

View File

@ -7,7 +7,7 @@ class PostStatusService < BaseService
def call(account, text, in_reply_to = nil) def call(account, text, in_reply_to = nil)
status = account.statuses.create!(text: text, thread: in_reply_to) status = account.statuses.create!(text: text, thread: in_reply_to)
process_mentions_service.(status) process_mentions_service.(status)
fan_out_on_write_service.(status) DistributionWorker.perform_async(status.id)
account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url]) account.ping!(account_url(account, format: 'atom'), [Rails.configuration.x.hub_url])
status status
end end
@ -17,8 +17,4 @@ class PostStatusService < BaseService
def process_mentions_service def process_mentions_service
@process_mentions_service ||= ProcessMentionsService.new @process_mentions_service ||= ProcessMentionsService.new
end end
def fan_out_on_write_service
@fan_out_on_write_service ||= FanOutOnWriteService.new
end
end end

View File

@ -38,7 +38,7 @@ class ProcessFeedService < BaseService
# If we added a status, go through accounts it mentions and create respective relations # If we added a status, go through accounts it mentions and create respective relations
unless status.new_record? unless status.new_record?
record_remote_mentions(status, entry.xpath('./xmlns:link[@rel="mentioned"]')) record_remote_mentions(status, entry.xpath('./xmlns:link[@rel="mentioned"]'))
fan_out_on_write_service.(status) DistributionWorker.perform_async(status.id)
end end
end end

View File

@ -1,6 +1,10 @@
- content_for :content do - content_for :content do
.container= yield .container= yield
.footer .footer
.domain= Rails.configuration.x.local_domain %span.domain= Rails.configuration.x.local_domain
%span.powered-by
\//
powered by
= link_to 'Mastodon', 'https://github.com/Gargron/mastodon'
= render template: "layouts/application" = render template: "layouts/application"

View File

@ -0,0 +1,7 @@
class DistributionWorker
include Sidekiq::Worker
def perform(status_id)
FanOutOnWriteService.new.(Status.find(status_id))
end
end