about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-25 03:22:26 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-25 03:22:26 +0100
commit8eeec389c11298ad1be163dd65c5ae79e06867ca (patch)
tree2e0e2ba68cbc25c003c6b55ef2a392666b90a8df
parent42dcb0d4cb119ecaac824fb1cace1fb011075b5e (diff)
Add link to github project to footer, move FanOutOnWriteService calls to
DistributionWorker. That isn't the heaviest service, yet, but gotta start
somewhere
-rw-r--r--app/assets/stylesheets/application.scss15
-rw-r--r--app/services/post_status_service.rb6
-rw-r--r--app/services/process_feed_service.rb2
-rw-r--r--app/views/layouts/public.html.haml6
-rw-r--r--app/workers/distribution_worker.rb7
5 files changed, 29 insertions, 7 deletions
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 5e89c210b..e34f0ba32 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -262,6 +262,21 @@ body {
     font-weight: 400;
     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 {
diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb
index e8335639c..69e39c1a6 100644
--- a/app/services/post_status_service.rb
+++ b/app/services/post_status_service.rb
@@ -7,7 +7,7 @@ class PostStatusService < BaseService
   def call(account, text, in_reply_to = nil)
     status = account.statuses.create!(text: text, thread: in_reply_to)
     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])
     status
   end
@@ -17,8 +17,4 @@ class PostStatusService < BaseService
   def process_mentions_service
     @process_mentions_service ||= ProcessMentionsService.new
   end
-
-  def fan_out_on_write_service
-    @fan_out_on_write_service ||= FanOutOnWriteService.new
-  end
 end
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index e842031f5..047d0e747 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -38,7 +38,7 @@ class ProcessFeedService < BaseService
     # If we added a status, go through accounts it mentions and create respective relations
     unless status.new_record?
       record_remote_mentions(status, entry.xpath('./xmlns:link[@rel="mentioned"]'))
-      fan_out_on_write_service.(status)
+      DistributionWorker.perform_async(status.id)
     end
   end
 
diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml
index 2234df225..14c37e0dd 100644
--- a/app/views/layouts/public.html.haml
+++ b/app/views/layouts/public.html.haml
@@ -1,6 +1,10 @@
 - content_for :content do
   .container= yield
   .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"
diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb
new file mode 100644
index 000000000..d529ed87f
--- /dev/null
+++ b/app/workers/distribution_worker.rb
@@ -0,0 +1,7 @@
+class DistributionWorker
+  include Sidekiq::Worker
+
+  def perform(status_id)
+    FanOutOnWriteService.new.(Status.find(status_id))
+  end
+end