mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:41:31 +08:00
DEV: correct a few Ruby 2.7 deprecations
Note: ``` def foo(bar: 1) end foo({bar: 2}) # raises a deprecation, instead use: foo(**{bar: 2}) ``` Additionally when matching regexes always use strings. It does not make sense to match a non string to a regex.
This commit is contained in:
parent
c218036107
commit
7371b427cd
|
@ -25,7 +25,13 @@ class MetadataController < ApplicationController
|
|||
private
|
||||
|
||||
def default_manifest
|
||||
display = Regexp.new(SiteSetting.pwa_display_browser_regex).match(request.user_agent) ? 'browser' : 'standalone'
|
||||
display = "standalone"
|
||||
if request.user_agent
|
||||
regex = Regexp.new(SiteSetting.pwa_display_browser_regex)
|
||||
if regex.match(request.user_agent)
|
||||
display = "browser"
|
||||
end
|
||||
end
|
||||
|
||||
manifest = {
|
||||
name: SiteSetting.title,
|
||||
|
|
|
@ -33,8 +33,8 @@ class ReviewablesController < ApplicationController
|
|||
filters[filter_key] = params[filter_key]
|
||||
end
|
||||
|
||||
total_rows = Reviewable.list_for(current_user, filters).count
|
||||
reviewables = Reviewable.list_for(current_user, filters.merge(limit: PER_PAGE, offset: offset)).to_a
|
||||
total_rows = Reviewable.list_for(current_user, **filters).count
|
||||
reviewables = Reviewable.list_for(current_user, **filters.merge(limit: PER_PAGE, offset: offset)).to_a
|
||||
|
||||
claimed_topics = ReviewableClaimedTopic.claimed_hash(reviewables.map { |r| r.topic_id }.uniq)
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ class TopicsController < ApplicationController
|
|||
topic_status_update = topic.set_or_create_timer(
|
||||
status_type,
|
||||
params[:time],
|
||||
options
|
||||
**options
|
||||
)
|
||||
|
||||
if topic.save
|
||||
|
|
|
@ -146,7 +146,7 @@ class RemoteTheme < ActiveRecord::Base
|
|||
importer.all_files.each do |filename|
|
||||
next unless opts = ThemeField.opts_from_file_path(filename)
|
||||
value = importer[filename]
|
||||
updated_fields << theme.set_field(opts.merge(value: value))
|
||||
updated_fields << theme.set_field(**opts.merge(value: value))
|
||||
end
|
||||
|
||||
# Destroy fields that no longer exist in the remote theme
|
||||
|
|
|
@ -11,7 +11,7 @@ module UserNameSuggester
|
|||
end
|
||||
|
||||
def self.parse_name_from_email(name_or_email)
|
||||
return name_or_email if name_or_email !~ User::EMAIL
|
||||
return name_or_email if name_or_email.to_s !~ User::EMAIL
|
||||
|
||||
# When 'walter@white.com' take 'walter'
|
||||
name = Regexp.last_match[1]
|
||||
|
|
Loading…
Reference in New Issue
Block a user