about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-05-29 13:52:26 +0200
committerThibaut Girka <thib@sitedethib.com>2018-05-29 13:52:26 +0200
commitc087738270e7fb16b1d284e8dd72cf99b4238bb8 (patch)
tree23327fe190fd90589c9dc8d64e96fcf0b7d28ddd /app/services
parent8b98afa781018bc7cfdb325f6b1fca0b1edcd8cb (diff)
parent90908fc24ba57c877de75fe117b8cc234e29d4f0 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/services')
-rw-r--r--app/services/process_hashtags_service.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/process_hashtags_service.rb b/app/services/process_hashtags_service.rb
index 5b45c865f..0695922b8 100644
--- a/app/services/process_hashtags_service.rb
+++ b/app/services/process_hashtags_service.rb
@@ -4,8 +4,10 @@ class ProcessHashtagsService < BaseService
   def call(status, tags = [])
     tags = Extractor.extract_hashtags(status.text) if status.local?
 
-    tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |tag|
-      status.tags << Tag.where(name: tag).first_or_initialize(name: tag)
+    tags.map { |str| str.mb_chars.downcase }.uniq(&:to_s).each do |name|
+      tag = Tag.where(name: name).first_or_create(name: name)
+      status.tags << tag
+      TrendingTags.record_use!(tag, status.account, status.created_at)
     end
   end
 end