From 0f9c6f1e0766619605705734fc2dfbf3d6d89d75 Mon Sep 17 00:00:00 2001
From: Georg Gadinger
Date: Thu, 13 Oct 2022 21:23:12 +0200
Subject: [PATCH 01/16] typoed_email_validator: check for valid TLDs
i'm sure there are many more typos waiting to happen. one thing we
can already catch though is the usage of invalid TLDs.
this makes use of my new TLDv gem -- the data it uses can be updated
independently from the main gem.
---
Gemfile | 3 +++
Gemfile.lock | 4 ++++
app/validators/typoed_email_validator.rb | 17 +++++++++--------
.../user/registration_controller_spec.rb | 6 +++---
spec/models/user_spec.rb | 1 +
5 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/Gemfile b/Gemfile
index 880832ce..b63d1937 100644
--- a/Gemfile
+++ b/Gemfile
@@ -65,6 +65,9 @@ gem "redis"
gem "fake_email_validator"
+# TLD validation
+gem "tldv", "~> 0.1.0"
+
gem "jwt", "~> 2.5"
group :development do
diff --git a/Gemfile.lock b/Gemfile.lock
index d18ddfac..43bd3c94 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -518,6 +518,9 @@ GEM
thread_safe (0.3.6)
tilt (2.0.11)
timeout (0.3.0)
+ tldv (0.1.0)
+ tldv-data (~> 1.0)
+ tldv-data (1.0.2022101300)
turbo-rails (1.1.1)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
@@ -641,6 +644,7 @@ DEPENDENCIES
simplecov-cobertura
simplecov-json
spring (~> 4.1)
+ tldv (~> 0.1.0)
turbo-rails
twitter
twitter-text
diff --git a/app/validators/typoed_email_validator.rb b/app/validators/typoed_email_validator.rb
index 279c4950..8131bb48 100644
--- a/app/validators/typoed_email_validator.rb
+++ b/app/validators/typoed_email_validator.rb
@@ -1,15 +1,10 @@
# frozen_string_literal: true
+require "tldv"
+
class TypoedEmailValidator < ActiveModel::EachValidator
# this array contains "forbidden" email address endings
INVALID_ENDINGS = [
- # without @:
- ".carrd",
- ".con",
- ".coom",
- ".cmo",
- ".mail",
-
# with @:
*%w[
fmail.com
@@ -50,7 +45,13 @@ class TypoedEmailValidator < ActiveModel::EachValidator
return false unless value.include?("@")
# part after the @ needs to have at least one period
- return false if value.split("@", 2).last.count(".").zero?
+ _prefix, domain = value.split("@", 2)
+ domain_parts = domain.split(".")
+ return false if domain_parts.length == 1
+
+ # check if the TLD is valid
+ tld = domain_parts.last
+ return false unless TLDv.valid?(tld)
# finally, common typos
return false if INVALID_ENDINGS.any? { value.end_with?(_1) }
diff --git a/spec/controllers/user/registration_controller_spec.rb b/spec/controllers/user/registration_controller_spec.rb
index 025e3edd..c31f5670 100644
--- a/spec/controllers/user/registration_controller_spec.rb
+++ b/spec/controllers/user/registration_controller_spec.rb
@@ -30,7 +30,7 @@ describe User::RegistrationsController, type: :controller do
{
user: {
screen_name: "dio",
- email: "the-world-21@somewhere.everywhere",
+ email: "the-world-21@somewhere.everywhere.now",
password: "AReallySecurePassword456!",
password_confirmation: "AReallySecurePassword456!"
}
@@ -85,7 +85,7 @@ describe User::RegistrationsController, type: :controller do
{
user: {
screen_name: "Dio Brando",
- email: "the-world-21@somewhere.everywhere",
+ email: "the-world-21@somewhere.everywhere.now",
password: "AReallySecurePassword456!",
password_confirmation: "AReallySecurePassword456!"
}
@@ -102,7 +102,7 @@ describe User::RegistrationsController, type: :controller do
{
user: {
screen_name: "moderator",
- email: "the-world-21@somewhere.everywhere",
+ email: "the-world-21@somewhere.everywhere.now",
password: "AReallySecurePassword456!",
password_confirmation: "AReallySecurePassword456!"
}
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 5d12058f..d2714b22 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -64,6 +64,7 @@ RSpec.describe User, type: :model do
include_examples "valid email", "fritz.fantom@protonmail.com"
include_examples "valid email", "fritz.fantom@example.email"
include_examples "valid email", "fritz.fantom@enterprise.k8s.420stripes.k8s.needs.more.k8s.jira.atlassian.k8s.eu-central-1.s3.amazonaws.com"
+ include_examples "valid email", "fritz.fantom@emacs.horse"
include_examples "invalid email", "@jack"
# examples from the real world:
From 3761f9b4c576f27fcaf315f1643582a6172d4d55 Mon Sep 17 00:00:00 2001
From: Georg Gadinger
Date: Fri, 14 Oct 2022 07:17:42 +0200
Subject: [PATCH 02/16] FUNDING.yml: add GitHub Sponsors and Open Collective
---
.github/FUNDING.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 094e6207..7f83dbde 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,3 +1,5 @@
# These are supported funding model platforms
+github: retrospring
+open_collective: retrospring
patreon: retrospring
From 4352f73017493b49912bbd61b4ab3e17487162bc Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 17 Oct 2022 09:07:48 +0000
Subject: [PATCH 03/16] Bump regenerator-runtime from 0.13.9 to 0.13.10
Bumps [regenerator-runtime](https://github.com/facebook/regenerator) from 0.13.9 to 0.13.10.
- [Release notes](https://github.com/facebook/regenerator/releases)
- [Commits](https://github.com/facebook/regenerator/compare/regenerator-runtime@0.13.9...regenerator-runtime@0.13.10)
---
updated-dependencies:
- dependency-name: regenerator-runtime
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
package.json | 2 +-
yarn.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index 1e7df09d..fccee212 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
"lato-font": "^3.0.0",
"popper.js": "^1.16.1",
"rails_admin": "3.0.0",
- "regenerator-runtime": "^0.13.7",
+ "regenerator-runtime": "^0.13.10",
"sweetalert": "1.1.3",
"toastify-js": "^1.12.0",
"typescript": "^4.8.4"
diff --git a/yarn.lock b/yarn.lock
index f380abdb..a0ac3a46 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -6567,10 +6567,10 @@ regenerate@^1.4.2:
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==
-regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7, regenerator-runtime@^0.13.9:
- version "0.13.9"
- resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52"
- integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==
+regenerator-runtime@^0.13.10, regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.9:
+ version "0.13.10"
+ resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.10.tgz#ed07b19616bcbec5da6274ebc75ae95634bfc2ee"
+ integrity sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==
regenerator-transform@^0.15.0:
version "0.15.0"
From b77f01c32c78aa357ac64dc5a8c5e05a24c4abea Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 17 Oct 2022 09:08:40 +0000
Subject: [PATCH 04/16] Bump @babel/preset-env from 7.19.3 to 7.19.4
Bumps [@babel/preset-env](https://github.com/babel/babel/tree/HEAD/packages/babel-preset-env) from 7.19.3 to 7.19.4.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.19.4/packages/babel-preset-env)
---
updated-dependencies:
- dependency-name: "@babel/preset-env"
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
package.json | 2 +-
yarn.lock | 78 ++++++++++++++++++++++++++--------------------------
2 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/package.json b/package.json
index 1e7df09d..3d817001 100644
--- a/package.json
+++ b/package.json
@@ -26,7 +26,7 @@
},
"devDependencies": {
"@babel/core": "^7.19.3",
- "@babel/preset-env": "^7.19.3",
+ "@babel/preset-env": "^7.19.4",
"@rails/webpacker": "5.4.3",
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
diff --git a/yarn.lock b/yarn.lock
index f380abdb..8d009edf 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -24,10 +24,10 @@
dependencies:
"@babel/highlight" "^7.18.6"
-"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.19.3":
- version "7.19.3"
- resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.3.tgz#707b939793f867f5a73b2666e6d9a3396eb03151"
- integrity sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw==
+"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.19.3", "@babel/compat-data@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.19.4.tgz#95c86de137bf0317f3a570e1b6e996b427299747"
+ integrity sha512-CHIGpJcUQ5lU9KrPHTjBMhVwQG6CQjxfg36fGXl3qk/Gik1WwWachaXFuo0uCWJT/mStOKtcbFJCaVLihC1CMw==
"@babel/core@^7.15.0", "@babel/core@^7.19.3":
version "7.19.3"
@@ -316,10 +316,10 @@
dependencies:
"@babel/types" "^7.18.6"
-"@babel/helper-string-parser@^7.18.10":
- version "7.18.10"
- resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56"
- integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==
+"@babel/helper-string-parser@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
+ integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
"@babel/helper-validator-identifier@^7.16.7":
version "7.16.7"
@@ -484,14 +484,14 @@
"@babel/helper-plugin-utils" "^7.18.6"
"@babel/plugin-syntax-numeric-separator" "^7.10.4"
-"@babel/plugin-proposal-object-rest-spread@^7.14.7", "@babel/plugin-proposal-object-rest-spread@^7.18.9":
- version "7.18.9"
- resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz#f9434f6beb2c8cae9dfcf97d2a5941bbbf9ad4e7"
- integrity sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==
+"@babel/plugin-proposal-object-rest-spread@^7.14.7", "@babel/plugin-proposal-object-rest-spread@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.19.4.tgz#a8fc86e8180ff57290c91a75d83fe658189b642d"
+ integrity sha512-wHmj6LDxVDnL+3WhXteUBaoM1aVILZODAUjg11kHqG4cOlfgMQGxw6aCgvrXrmaJR3Bn14oZhImyCPZzRpC93Q==
dependencies:
- "@babel/compat-data" "^7.18.8"
- "@babel/helper-compilation-targets" "^7.18.9"
- "@babel/helper-plugin-utils" "^7.18.9"
+ "@babel/compat-data" "^7.19.4"
+ "@babel/helper-compilation-targets" "^7.19.3"
+ "@babel/helper-plugin-utils" "^7.19.0"
"@babel/plugin-syntax-object-rest-spread" "^7.8.3"
"@babel/plugin-transform-parameters" "^7.18.8"
@@ -673,12 +673,12 @@
dependencies:
"@babel/helper-plugin-utils" "^7.18.6"
-"@babel/plugin-transform-block-scoping@^7.18.9":
- version "7.18.9"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz#f9b7e018ac3f373c81452d6ada8bd5a18928926d"
- integrity sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==
+"@babel/plugin-transform-block-scoping@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.19.4.tgz#315d70f68ce64426db379a3d830e7ac30be02e9b"
+ integrity sha512-934S2VLLlt2hRJwPf4MczaOr4hYF0z+VKPwqTNxyKX7NthTiPfhuKFWQZHXRM0vh/wo/VyXB3s4bZUNA08l+tQ==
dependencies:
- "@babel/helper-plugin-utils" "^7.18.9"
+ "@babel/helper-plugin-utils" "^7.19.0"
"@babel/plugin-transform-classes@^7.19.0":
version "7.19.0"
@@ -702,12 +702,12 @@
dependencies:
"@babel/helper-plugin-utils" "^7.18.9"
-"@babel/plugin-transform-destructuring@^7.14.7", "@babel/plugin-transform-destructuring@^7.18.13":
- version "7.18.13"
- resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz#9e03bc4a94475d62b7f4114938e6c5c33372cbf5"
- integrity sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow==
+"@babel/plugin-transform-destructuring@^7.14.7", "@babel/plugin-transform-destructuring@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.19.4.tgz#46890722687b9b89e1369ad0bd8dc6c5a3b4319d"
+ integrity sha512-t0j0Hgidqf0aM86dF8U+vXYReUgJnlv4bZLsyoPnwZNrGY+7/38o8YjaELrvHeVfTZao15kjR0PVv0nju2iduA==
dependencies:
- "@babel/helper-plugin-utils" "^7.18.9"
+ "@babel/helper-plugin-utils" "^7.19.0"
"@babel/plugin-transform-dotall-regex@^7.18.6", "@babel/plugin-transform-dotall-regex@^7.4.4":
version "7.18.6"
@@ -924,12 +924,12 @@
"@babel/helper-create-regexp-features-plugin" "^7.18.6"
"@babel/helper-plugin-utils" "^7.18.6"
-"@babel/preset-env@^7.15.0", "@babel/preset-env@^7.19.3":
- version "7.19.3"
- resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.19.3.tgz#52cd19abaecb3f176a4ff9cc5e15b7bf06bec754"
- integrity sha512-ziye1OTc9dGFOAXSWKUqQblYHNlBOaDl8wzqf2iKXJAltYiR3hKHUKmkt+S9PppW7RQpq4fFCrwwpIDj/f5P4w==
+"@babel/preset-env@^7.15.0", "@babel/preset-env@^7.19.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.19.4.tgz#4c91ce2e1f994f717efb4237891c3ad2d808c94b"
+ integrity sha512-5QVOTXUdqTCjQuh2GGtdd7YEhoRXBMVGROAtsBeLGIbIz3obCBIfRMT1I3ZKkMgNzwkyCkftDXSSkHxnfVf4qg==
dependencies:
- "@babel/compat-data" "^7.19.3"
+ "@babel/compat-data" "^7.19.4"
"@babel/helper-compilation-targets" "^7.19.3"
"@babel/helper-plugin-utils" "^7.19.0"
"@babel/helper-validator-option" "^7.18.6"
@@ -944,7 +944,7 @@
"@babel/plugin-proposal-logical-assignment-operators" "^7.18.9"
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.6"
"@babel/plugin-proposal-numeric-separator" "^7.18.6"
- "@babel/plugin-proposal-object-rest-spread" "^7.18.9"
+ "@babel/plugin-proposal-object-rest-spread" "^7.19.4"
"@babel/plugin-proposal-optional-catch-binding" "^7.18.6"
"@babel/plugin-proposal-optional-chaining" "^7.18.9"
"@babel/plugin-proposal-private-methods" "^7.18.6"
@@ -968,10 +968,10 @@
"@babel/plugin-transform-arrow-functions" "^7.18.6"
"@babel/plugin-transform-async-to-generator" "^7.18.6"
"@babel/plugin-transform-block-scoped-functions" "^7.18.6"
- "@babel/plugin-transform-block-scoping" "^7.18.9"
+ "@babel/plugin-transform-block-scoping" "^7.19.4"
"@babel/plugin-transform-classes" "^7.19.0"
"@babel/plugin-transform-computed-properties" "^7.18.9"
- "@babel/plugin-transform-destructuring" "^7.18.13"
+ "@babel/plugin-transform-destructuring" "^7.19.4"
"@babel/plugin-transform-dotall-regex" "^7.18.6"
"@babel/plugin-transform-duplicate-keys" "^7.18.9"
"@babel/plugin-transform-exponentiation-operator" "^7.18.6"
@@ -998,7 +998,7 @@
"@babel/plugin-transform-unicode-escapes" "^7.18.10"
"@babel/plugin-transform-unicode-regex" "^7.18.6"
"@babel/preset-modules" "^0.1.5"
- "@babel/types" "^7.19.3"
+ "@babel/types" "^7.19.4"
babel-plugin-polyfill-corejs2 "^0.3.3"
babel-plugin-polyfill-corejs3 "^0.6.0"
babel-plugin-polyfill-regenerator "^0.4.1"
@@ -1064,12 +1064,12 @@
debug "^4.1.0"
globals "^11.1.0"
-"@babel/types@^7.16.7", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.19.3", "@babel/types@^7.4.4":
- version "7.19.3"
- resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.3.tgz#fc420e6bbe54880bce6779ffaf315f5e43ec9624"
- integrity sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw==
+"@babel/types@^7.16.7", "@babel/types@^7.18.10", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.0", "@babel/types@^7.19.3", "@babel/types@^7.19.4", "@babel/types@^7.4.4":
+ version "7.19.4"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.19.4.tgz#0dd5c91c573a202d600490a35b33246fed8a41c7"
+ integrity sha512-M5LK7nAeS6+9j7hAq+b3fQs+pNfUtTGq+yFFfHnauFA8zQtLRfmuipmsKDKKLuyG+wC8ABW43A153YNawNTEtw==
dependencies:
- "@babel/helper-string-parser" "^7.18.10"
+ "@babel/helper-string-parser" "^7.19.4"
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
From 171e91d25120b0221c104bd6b8cc2bcb6d7a3e5b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 21 Oct 2022 04:15:37 +0000
Subject: [PATCH 05/16] Bump nokogiri from 1.13.8 to 1.13.9
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.8 to 1.13.9.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.8...v1.13.9)
---
updated-dependencies:
- dependency-name: nokogiri
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
---
Gemfile.lock | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 43bd3c94..05c52f80 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -315,7 +315,7 @@ GEM
net-smtp (0.3.2)
net-protocol
nio4r (2.5.8)
- nokogiri (1.13.8)
+ nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
notiffany (0.1.3)
From c1b441d2a67832ad72e5d3dcb429971feb934921 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 24 Oct 2022 09:02:47 +0000
Subject: [PATCH 06/16] Bump rubocop from 1.36.0 to 1.37.1
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.36.0 to 1.37.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.36.0...v1.37.1)
---
updated-dependencies:
- dependency-name: rubocop
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
---
Gemfile | 2 +-
Gemfile.lock | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Gemfile b/Gemfile
index b63d1937..741dba8f 100644
--- a/Gemfile
+++ b/Gemfile
@@ -97,7 +97,7 @@ group :development, :test do
gem "rspec-mocks"
gem "rspec-rails", "~> 5.1"
gem "rspec-sidekiq", "~> 3.0", require: false
- gem "rubocop", "~> 1.36"
+ gem "rubocop", "~> 1.37"
gem "rubocop-rails", "~> 2.16"
gem "shoulda-matchers", "~> 5.2"
gem "simplecov", require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 05c52f80..d337cea7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -444,17 +444,17 @@ GEM
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.11.0)
- rubocop (1.36.0)
+ rubocop (1.37.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.20.1, < 2.0)
+ rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
- rubocop-ast (1.21.0)
+ rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
rubocop-rails (2.16.1)
activesupport (>= 4.2.0)
@@ -630,7 +630,7 @@ DEPENDENCIES
rspec-mocks
rspec-rails (~> 5.1)
rspec-sidekiq (~> 3.0)
- rubocop (~> 1.36)
+ rubocop (~> 1.37)
rubocop-rails (~> 2.16)
ruby-progressbar
sanitize
From 9bfc2b9dac0d036dba70b7d9dc6bde803010ed38 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Sun, 16 Oct 2022 16:16:12 +0200
Subject: [PATCH 07/16] Add top action bar to Inbox
---
app/javascript/styles/application.scss | 1 +
.../styles/components/_inbox-actions.scss | 5 ++++
app/views/inbox/_actions.haml | 23 +++++++++++++++++++
app/views/layouts/inbox.haml | 5 ++--
4 files changed, 31 insertions(+), 3 deletions(-)
create mode 100644 app/javascript/styles/components/_inbox-actions.scss
create mode 100644 app/views/inbox/_actions.haml
diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss
index b98740da..a90394a5 100644
--- a/app/javascript/styles/application.scss
+++ b/app/javascript/styles/application.scss
@@ -79,6 +79,7 @@
"components/entry",
"components/flags",
"components/icons",
+"components/inbox-actions",
"components/inbox-entry",
"components/jumbotron",
"components/locales",
diff --git a/app/javascript/styles/components/_inbox-actions.scss b/app/javascript/styles/components/_inbox-actions.scss
new file mode 100644
index 00000000..3a6c3dc8
--- /dev/null
+++ b/app/javascript/styles/components/_inbox-actions.scss
@@ -0,0 +1,5 @@
+.inbox-actions {
+ .form-group {
+ margin-bottom: 0;
+ }
+}
diff --git a/app/views/inbox/_actions.haml b/app/views/inbox/_actions.haml
new file mode 100644
index 00000000..304461e8
--- /dev/null
+++ b/app/views/inbox/_actions.haml
@@ -0,0 +1,23 @@
+.card.inbox-actions
+ .card-body
+ .d-md-flex
+ = bootstrap_form_tag url: inbox_path, method: :get, html: { class: "d-block" } do |f|
+ = f.text_field :author, value: params[:author], placeholder: t(".author.placeholder"), prepend: "@", hide_label: true,
+ append: f.button(t(".author.button"), name: nil, class: "btn btn-light", id: "ib-author")
+ .d-flex.ml-auto.mt-2.mt-md-0
+ %button.btn.btn-info.mr-auto{ type: :button, id: "ib-generate-question" }
+ = t(".questions.button")
+ .button-group.ml-1
+ %button.btn.btn-default{ data: { toggle: :dropdown }, aria: { expanded: false } }
+ %i.fa.fa-fw.fa-share-alt
+ %span.sr-only= t(".share.heading")
+ .dropdown-menu.dropdown-menu-right{ role: :menu }
+ %a.dropdown-item{ href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{user_url(current_user)}", target: "_blank" }
+ %i.fa.fa-fw.fa-twitter
+ = t(".share.button", service: "Twitter")
+ %a.dropdown-item{ href: "https://www.tumblr.com/share/link?url=#{user_url(current_user)}&name=Ask%20me%20anything%21", target: "_blank" }
+ %i.fa.fa-fw.fa-tumblr
+ = t(".share.button", service: "Tumblr")
+ %button.btn.btn-danger.ml-1{ type: :button, id: delete_id, disabled: (disabled ? :disabled : nil), data: { ib_count: inbox_count } }
+ %i.fa.fa-fw.fa-trash-o
+ %span.sr-only= t(".actions.delete")
diff --git a/app/views/layouts/inbox.haml b/app/views/layouts/inbox.haml
index 8b82f9d6..0aff256e 100644
--- a/app/views/layouts/inbox.haml
+++ b/app/views/layouts/inbox.haml
@@ -1,8 +1,7 @@
.container-lg.container--main
.row
- .col-md-3.col-xs-12.col-sm-4.order-2.order-sm-1
- = render 'inbox/sidebar', delete_id: @delete_id, disabled: @disabled, inbox_count: @inbox_count
- .col-md-9.col-xs-12.col-sm-8.order-1.order-sm-2
+ .col-sm-10.col-md-10.col-lg-9.mx-auto
+ = render 'inbox/actions', delete_id: @delete_id, disabled: @disabled, inbox_count: @inbox_count
= render 'layouts/messages'
= yield
From ccaf519b8fc59cb4f84f492d0f6bfd83db816dd7 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Sun, 16 Oct 2022 16:16:27 +0200
Subject: [PATCH 08/16] Remove sidebar template
---
app/views/inbox/_sidebar.haml | 27 ---------------------------
1 file changed, 27 deletions(-)
delete mode 100644 app/views/inbox/_sidebar.haml
diff --git a/app/views/inbox/_sidebar.haml b/app/views/inbox/_sidebar.haml
deleted file mode 100644
index afaf9ee7..00000000
--- a/app/views/inbox/_sidebar.haml
+++ /dev/null
@@ -1,27 +0,0 @@
-.card
- .card-header= t(".questions.heading")
- .card-body
- %button.btn.btn-block.btn-info{ type: :button, id: "ib-generate-question" }= t(".questions.button")
-.card
- .card-header= t(".share.heading")
- .card-body
- %a.btn.btn-block.btn-primary{ target: "_blank",
- href: "https://twitter.com/intent/tweet?text=Ask%20me%20anything%21&url=#{user_url(current_user)}" }
- %i.fa.fa-fw.fa-twitter
- = t(".share.button", service: "Twitter")
- %a.btn.btn-block.btn-primary{ target: "_blank",
- href: "https://www.tumblr.com/share/link?url=#{user_url(current_user)}&name=Ask%20me%20anything%21" }
- %i.fa.fa-fw.fa-tumblr
- = t(".share.button", service: "Tumblr")
-.card
- .card-header= t(".author.heading")
- .card-body
- %form#author-form
- = bootstrap_form_tag url: inbox_path, method: :get do |f|
- = f.text_field :author, value: params[:author], placeholder: t(".author.placeholder"), prepend: "@", hide_label: true
- = f.button t(".author.button"), name: nil, class: "btn btn-light btn-block btn-sm", id: "ib-author"
-.card
- .card-header= t(".actions.heading")
- .card-body
- %button.btn.btn-block.btn-danger{ type: :button, id: delete_id, disabled: (disabled ? :disabled : nil), data: { ib_count: inbox_count } }
- = t(".actions.delete")
From 02721fc22d75c39d115444b3a90a8eecd8516975 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Sun, 16 Oct 2022 16:16:43 +0200
Subject: [PATCH 09/16] Move sidebar locale namespace to actions
---
config/locales/views.en.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml
index aef0e4ed..0d9f5934 100644
--- a/config/locales/views.en.yml
+++ b/config/locales/views.en.yml
@@ -100,7 +100,7 @@ en:
title: "Share"
comments:
none: "There are no comments yet."
- placeholder: "Comment..."
+ placeholder: "Comment..."
smiles:
none: "No one smiled this yet."
application:
@@ -200,7 +200,7 @@ en:
settings: "service settings"
show:
empty: "Nothing to see here."
- sidebar:
+ actions:
actions:
heading: "Actions"
delete: "Delete all questions"
From 70d5f932fced1f0482c7c7da4b004c686ba602ed Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Thu, 20 Oct 2022 20:30:20 +0200
Subject: [PATCH 10/16] Adjust locales as requested in review
---
config/locales/views.en.yml | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml
index 0d9f5934..f30ef043 100644
--- a/config/locales/views.en.yml
+++ b/config/locales/views.en.yml
@@ -202,15 +202,12 @@ en:
empty: "Nothing to see here."
actions:
actions:
- heading: "Actions"
delete: "Delete all questions"
author:
- heading: "Show author"
button: "Show"
- placeholder: "username"
+ placeholder: "Filter by username"
questions:
- heading: "Out of questions?"
- button: "Get new question"
+ button: "Generate question"
share:
heading: "Share"
button: "Share on %{service}"
From d11aff1db9dea171cf8696bb1baa2168d2879165 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Mon, 24 Oct 2022 12:48:40 +0200
Subject: [PATCH 11/16] Decrease vertical spacing of inbox action bar
---
app/javascript/styles/components/_inbox-actions.scss | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/javascript/styles/components/_inbox-actions.scss b/app/javascript/styles/components/_inbox-actions.scss
index 3a6c3dc8..ee7b664d 100644
--- a/app/javascript/styles/components/_inbox-actions.scss
+++ b/app/javascript/styles/components/_inbox-actions.scss
@@ -2,4 +2,8 @@
.form-group {
margin-bottom: 0;
}
+
+ .card-body {
+ padding: $card-spacer-y $card-spacer-x;
+ }
}
From d3faccf85eb24279ed133a2894f03dace617cd05 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Mon, 24 Oct 2022 12:51:03 +0200
Subject: [PATCH 12/16] Apply review suggestions from @nilsding
Co-authored-by: Georg Gadinger
---
app/views/inbox/_actions.haml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/inbox/_actions.haml b/app/views/inbox/_actions.haml
index 304461e8..34927346 100644
--- a/app/views/inbox/_actions.haml
+++ b/app/views/inbox/_actions.haml
@@ -8,7 +8,7 @@
%button.btn.btn-info.mr-auto{ type: :button, id: "ib-generate-question" }
= t(".questions.button")
.button-group.ml-1
- %button.btn.btn-default{ data: { toggle: :dropdown }, aria: { expanded: false } }
+ %button.btn.btn-default{ title: t(".share.heading"), data: { toggle: :dropdown }, aria: { expanded: false } }
%i.fa.fa-fw.fa-share-alt
%span.sr-only= t(".share.heading")
.dropdown-menu.dropdown-menu-right{ role: :menu }
@@ -18,6 +18,6 @@
%a.dropdown-item{ href: "https://www.tumblr.com/share/link?url=#{user_url(current_user)}&name=Ask%20me%20anything%21", target: "_blank" }
%i.fa.fa-fw.fa-tumblr
= t(".share.button", service: "Tumblr")
- %button.btn.btn-danger.ml-1{ type: :button, id: delete_id, disabled: (disabled ? :disabled : nil), data: { ib_count: inbox_count } }
+ %button.btn.btn-danger.ml-1{ type: :button, title: t(".actions.delete"), id: delete_id, disabled: (disabled ? :disabled : nil), data: { ib_count: inbox_count } }
%i.fa.fa-fw.fa-trash-o
%span.sr-only= t(".actions.delete")
From c5efbee9382e042ee04f51063027152009931d16 Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Thu, 20 Oct 2022 21:59:44 +0200
Subject: [PATCH 13/16] Remove sidebar from timeline layout
---
app/views/layouts/feed.haml | 4 +---
app/views/shared/_sidebar.haml | 21 ---------------------
app/views/tabs/_feed.haml | 10 ++++++++++
config/locales/views.en.yml | 7 +++----
4 files changed, 14 insertions(+), 28 deletions(-)
delete mode 100644 app/views/shared/_sidebar.haml
diff --git a/app/views/layouts/feed.haml b/app/views/layouts/feed.haml
index 94434e16..e9239c39 100644
--- a/app/views/layouts/feed.haml
+++ b/app/views/layouts/feed.haml
@@ -1,8 +1,6 @@
.container-lg.container--main
.row
- .col-md-3.col-sm-4.d-none.d-sm-block
- = render 'shared/sidebar'
- .col-md-9.col-xs-12.col-sm-8
+ .col-sm-10.col-md-10.col-lg-9.mx-auto
= render 'layouts/messages'
= render 'tabs/feed', list: @list
= yield
diff --git a/app/views/shared/_sidebar.haml b/app/views/shared/_sidebar.haml
deleted file mode 100644
index 3ea4cf8a..00000000
--- a/app/views/shared/_sidebar.haml
+++ /dev/null
@@ -1,21 +0,0 @@
-.card.userbox
- %img.userbox__header{ src: current_user.profile_header.url(:mobile) }
- .card-body
- %img.userbox__avatar{ src: current_user.profile_picture.url(:small) }
- .profile__name
- - unless current_user.profile.display_name.blank?
- .profile__display-name
- = current_user.profile.display_name
- .profile__screen-name
- = current_user.screen_name
-- unless @list.nil?
- .card
- .card-header= t(".list.title")
- .card-body
- - if @list.members.empty?
- %p.text-muted= t(".list.none")
- - @list.members.each do |member|
- %a{ href: user_path(member.user), title: member.user.screen_name, data: { toggle: :tooltip, placement: :top } }
- %img.avatar-xs{ src: member.user.profile_picture.url(:medium) }
-
-= render "shared/links"
diff --git a/app/views/tabs/_feed.haml b/app/views/tabs/_feed.haml
index d1da004d..54c66280 100644
--- a/app/views/tabs/_feed.haml
+++ b/app/views/tabs/_feed.haml
@@ -10,6 +10,16 @@
- else
= t(".lists.title")
.dropdown-menu.dropdown-menu-right.dropdown-menu--lists
+ - if list
+ %h6.dropdown-header= t(".lists.members.title")
+ - if list.members.empty?
+ %p.text-muted= t(".list.members.none")
+ - else
+ %p.px-4
+ - list.members.each do |member|
+ %a{ href: user_path(member.user), title: member.user.screen_name, data: { toggle: :tooltip, placement: :top } }
+ %img.avatar-xs{ src: member.user.profile_picture.url(:small), loading: :lazy }
+ %li.dropdown-divider
- if current_user.lists.empty?
.p-3= t(".lists.notice_html")
- current_user.lists.each do |list|
diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml
index f30ef043..732e4891 100644
--- a/config/locales/views.en.yml
+++ b/config/locales/views.en.yml
@@ -511,10 +511,6 @@ en:
anonymous_block:
deleted_question: "Deleted question"
blocked: "blocked %{time} ago"
- sidebar:
- list:
- title: "Members"
- none: "No members yet."
tabs:
feed:
public: "Public"
@@ -531,6 +527,9 @@ en:
Once you have done that, the lists will be shown here.
When you select a list you'll get a timeline view of all users within that list.
+ members:
+ title: "Members"
+ none: "No members yet."
moderation:
all: "All reports"
answers: :activerecord.models.answer.other
From 14199059b49430c1cf25c2fe3bc3470b7c804d4a Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Mon, 24 Oct 2022 15:31:49 +0200
Subject: [PATCH 14/16] Filter out selected list from lists dropdown
---
app/controllers/timeline_controller.rb | 14 ++++++++++++--
app/views/layouts/feed.haml | 2 +-
app/views/tabs/_feed.haml | 7 +++----
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/app/controllers/timeline_controller.rb b/app/controllers/timeline_controller.rb
index a7542134..14a27a5c 100644
--- a/app/controllers/timeline_controller.rb
+++ b/app/controllers/timeline_controller.rb
@@ -2,14 +2,15 @@
class TimelineController < ApplicationController
before_action :authenticate_user!
+ before_action :set_list, only: %i[list]
+ before_action :set_lists
def index
paginate_timeline { |args| current_user.cursored_timeline(**args) }
end
def list
- @list = current_user.lists.find_by!(name: params[:list_name])
- @title = list_title(current_user.lists.find_by!(name: params[:list_name]))
+ @title = list_title(@list)
paginate_timeline { |args| @list.cursored_timeline(**args) }
end
@@ -20,6 +21,15 @@ class TimelineController < ApplicationController
private
+ def set_list
+ @list = current_user.lists.find_by!(name: params[:list_name]) if params[:list_name].present?
+ end
+
+ def set_lists
+ @lists = current_user.lists
+ @lists = @lists.where.not(id: @list.id) if @list.present?
+ end
+
def paginate_timeline
@timeline = yield(last_id: params[:last_id])
@timeline_last_id = @timeline.map(&:id).min
diff --git a/app/views/layouts/feed.haml b/app/views/layouts/feed.haml
index e9239c39..ee86df7c 100644
--- a/app/views/layouts/feed.haml
+++ b/app/views/layouts/feed.haml
@@ -2,6 +2,6 @@
.row
.col-sm-10.col-md-10.col-lg-9.mx-auto
= render 'layouts/messages'
- = render 'tabs/feed', list: @list
+ = render 'tabs/feed', lists: @lists, list: @list
= yield
.d-block.d-sm-none= render 'shared/links'
diff --git a/app/views/tabs/_feed.haml b/app/views/tabs/_feed.haml
index 54c66280..c0a1bec2 100644
--- a/app/views/tabs/_feed.haml
+++ b/app/views/tabs/_feed.haml
@@ -15,12 +15,11 @@
- if list.members.empty?
%p.text-muted= t(".list.members.none")
- else
- %p.px-4
+ %p.px-4.pb-2
- list.members.each do |member|
%a{ href: user_path(member.user), title: member.user.screen_name, data: { toggle: :tooltip, placement: :top } }
%img.avatar-xs{ src: member.user.profile_picture.url(:small), loading: :lazy }
- %li.dropdown-divider
- - if current_user.lists.empty?
+ - if !list && lists.empty?
.p-3= t(".lists.notice_html")
- - current_user.lists.each do |list|
+ - lists.each do |list|
%a.dropdown-item{ href: list_timeline_path(list.name) }= list.display_name
From 86869dc9935046847fb99e9ac965fc4cb72d4fac Mon Sep 17 00:00:00 2001
From: Andreas Nedbal
Date: Mon, 24 Oct 2022 15:32:23 +0200
Subject: [PATCH 15/16] Add tests for new instance variables in
TimelineController
---
spec/controllers/timeline_controller_spec.rb | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/spec/controllers/timeline_controller_spec.rb b/spec/controllers/timeline_controller_spec.rb
index 44bc3d26..ab1b275b 100644
--- a/spec/controllers/timeline_controller_spec.rb
+++ b/spec/controllers/timeline_controller_spec.rb
@@ -92,6 +92,11 @@ describe TimelineController do
it { should have_http_status(200) }
it_behaves_like "paginates", :followed_user_answers
+
+ it "assigns all lists to an instance variable" do
+ subject
+ expect(assigns(:lists)).to eq(user.lists)
+ end
end
describe "#list" do
@@ -108,6 +113,11 @@ describe TimelineController do
subject
expect(assigns(:list)).to eq(list)
end
+
+ it "excludes the current selected list from the list of lists" do
+ subject
+ expect(assigns(:lists)).not_to include(list)
+ end
end
end
From 87ec3093a9e9847dddda0726c8976ddffd42b404 Mon Sep 17 00:00:00 2001
From: Georg Gadinger
Date: Mon, 24 Oct 2022 22:55:48 +0200
Subject: [PATCH 16/16] allow for using SVG logos in the navbar
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
this uses our ✨new and improved✨ logo by default, but can be easily
changed by modifying `/public/logo.svg`. the svg is loaded only once
when the application starts, so any modifications to it after a
deployment are visible immediately.
thanks to the power of CSS and SVG being able to make use of it, custom
colour schemes still work too.
---
app/javascript/styles/overrides/_navbar.scss | 10 +++++++++-
app/views/navigation/_desktop.haml | 7 +++++--
app/views/navigation/_guest.haml | 6 +++++-
config/initializers/svg_logo.rb | 20 ++++++++++++++++++++
config/justask.yml.example | 3 +++
public/logo.svg | 1 +
6 files changed, 43 insertions(+), 4 deletions(-)
create mode 100644 config/initializers/svg_logo.rb
create mode 100644 public/logo.svg
diff --git a/app/javascript/styles/overrides/_navbar.scss b/app/javascript/styles/overrides/_navbar.scss
index f5959ff0..e00e0e81 100644
--- a/app/javascript/styles/overrides/_navbar.scss
+++ b/app/javascript/styles/overrides/_navbar.scss
@@ -6,6 +6,14 @@
&:focus {
color: RGB(var(--primary-text));
}
+
+ /* svg-logo! \o/ */
+ svg {
+ height: $navbar-brand-font-size;
+ path {
+ fill: RGB(var(--primary-text));
+ }
+ }
}
.navbar-nav {
@@ -47,4 +55,4 @@
color: RGB(var(--primary-text));
}
}
-}
\ No newline at end of file
+}
diff --git a/app/views/navigation/_desktop.haml b/app/views/navigation/_desktop.haml
index 9fdb0a0e..4678d684 100644
--- a/app/views/navigation/_desktop.haml
+++ b/app/views/navigation/_desktop.haml
@@ -1,7 +1,10 @@
%nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top.d-lg-block.d-none.d-print-none{ role: :navigation }
.container{ class: ios_web_app? ? 'ios-web-app' : '' }
- %a.navbar-brand{ href: '/' }
- = APP_CONFIG['site_name']
+ %a.navbar-brand{ href: '/', title: APP_CONFIG["site_name"] }
+ - if APP_CONFIG["use_svg_logo"]
+ = render inline: Rails.application.config.justask_svg_logo
+ - else
+ = APP_CONFIG["site_name"]
%ul.nav.navbar-nav.mr-auto
= nav_entry t("navigation.timeline"), root_path, icon: 'home'
= nav_entry t("navigation.inbox"), '/inbox', icon: 'inbox', badge: inbox_count
diff --git a/app/views/navigation/_guest.haml b/app/views/navigation/_guest.haml
index d34f9455..282fbcab 100644
--- a/app/views/navigation/_guest.haml
+++ b/app/views/navigation/_guest.haml
@@ -1,6 +1,10 @@
%nav.navbar.navbar-themed.navbar-expand-lg.bg-primary.fixed-top{ role: :navigation }
.container{ class: ios_web_app? ? 'ios-web-app' : '' }
- %a.navbar-brand{ href: '/' }= APP_CONFIG['site_name']
+ %a.navbar-brand{ href: '/', title: APP_CONFIG["site_name"] }
+ - if APP_CONFIG["use_svg_logo"]
+ = render inline: Rails.application.config.justask_svg_logo
+ - else
+ = APP_CONFIG["site_name"]
%button.navbar-toggler{ data: { target: '#j2-main-navbar-collapse', toggle: :collapse }, type: :button }
%span.sr-only= t("navigation.toggle")
%span.navbar-toggler-icon
diff --git a/config/initializers/svg_logo.rb b/config/initializers/svg_logo.rb
new file mode 100644
index 00000000..166695e5
--- /dev/null
+++ b/config/initializers/svg_logo.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+return unless APP_CONFIG[:use_svg_logo]
+
+begin
+ logo_path = Rails.public_path.join("logo.svg")
+ # we are only interested in the first element which should be the