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:
Sam Saffron
2019-11-28 13:13:13 +11:00
parent c218036107
commit 7371b427cd
5 changed files with 12 additions and 6 deletions

View File

@ -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,