UX: Show on IP lookup if MaxMind key is missing (#18993)

as discussed in https://meta.discourse.org/t/maxminddb-not-found-error/148512/7.
 
shows a warning to the admin if no license for maxmind is found
This commit is contained in:
MichaIng
2023-11-23 22:02:05 +01:00
committed by GitHub
parent c0216f85a8
commit c58a41cb3e
6 changed files with 24 additions and 3 deletions

View File

@ -1680,6 +1680,8 @@ RSpec.describe Admin::UsersController do
shared_examples "IP info retrieval possible" do
it "retrieves IP info" do
ip = "81.2.69.142"
# Assign a dummy MaxMind license key, which is now checked in open_db
global_setting "maxmind_license_key", "dummy"
DiscourseIpInfo.open_db(File.join(Rails.root, "spec", "fixtures", "mmdb"))
Resolv::DNS.any_instance.stubs(:getname).with(ip).returns("ip-81-2-69-142.example.com")
@ -1717,6 +1719,8 @@ RSpec.describe Admin::UsersController do
it "prevents retrieval of IP info with a 404 response" do
ip = "81.2.69.142"
# Assign a dummy MaxMind license key, which is now checked in open_db
global_setting "maxmind_license_key", "dummy"
DiscourseIpInfo.open_db(File.join(Rails.root, "spec", "fixtures", "mmdb"))
Resolv::DNS.any_instance.stubs(:getname).with(ip).returns("ip-81-2-69-142.example.com")