]> cat aescling's git repositories - mastodon.git/commitdiff
Clarify keyword arguments with ** (#12769)
authorDaigo 3 Dango <zunda@users.noreply.github.com>
Fri, 10 Jan 2020 20:57:05 +0000 (10:57 -1000)
committerYamagishi Kazutoshi <ykzts@desire.sh>
Fri, 10 Jan 2020 20:57:05 +0000 (05:57 +0900)
This change is to suppress the warning below on on ruby-2.7.0:

- warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/

app/helpers/accounts_helper.rb
app/lib/activitypub/activity.rb
app/services/activitypub/process_collection_service.rb

index 53939adfcb3145b34dcdb479fc74742c17f9b5da..e02bc24475dff54b2aab3bb75b3f80796e95dacd 100644 (file)
@@ -3,7 +3,7 @@
 module AccountsHelper
   def display_name(account, **options)
     if options[:custom_emojify]
-      Formatter.instance.format_display_name(account, options)
+      Formatter.instance.format_display_name(account, **options)
     else
       account.display_name.presence || account.username
     end
index 49b1dc9cd05cc1a575521d8a7cede782de1045a6..ee35e1e8da299f169b1bd6ad0d3aa61459378160 100644 (file)
@@ -21,7 +21,7 @@ class ActivityPub::Activity
   class << self
     def factory(json, account, **options)
       @json = json
-      klass&.new(json, account, options)
+      klass&.new(json, account, **options)
     end
 
     private
index a2a2e7071545aae129896eac2102a9317cb23aaa..e6ccaccc90f3e61cbdf27ab095c59e82330e7213 100644 (file)
@@ -37,7 +37,7 @@ class ActivityPub::ProcessCollectionService < BaseService
   end
 
   def process_item(item)
-    activity = ActivityPub::Activity.factory(item, @account, @options)
+    activity = ActivityPub::Activity.factory(item, @account, **@options)
     activity&.perform
   end