about summary refs log tree commit diff
path: root/app/services/process_hashtags_service.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-05-29 09:06:00 -0500
committerGitHub <noreply@github.com>2018-05-29 09:06:00 -0500
commit6a1544bd4618706204eb8220c9da984be3103aa1 (patch)
tree23327fe190fd90589c9dc8d64e96fcf0b7d28ddd /app/services/process_hashtags_service.rb
parent8b98afa781018bc7cfdb325f6b1fca0b1edcd8cb (diff)
parentc087738270e7fb16b1d284e8dd72cf99b4238bb8 (diff)
Merge pull request #525 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/services/process_hashtags_service.rb')
-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