From b9da56eb0900fa6b5f9da42606bef197a4ad559d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Slej=C5=A1ka?= <3021-AntoninSlejska@users.noreply.drupalcode.org> Date: Wed, 12 Feb 2025 17:42:48 +0000 Subject: [PATCH 1/5] Solves cspell errors. --- .gitlab-ci.yml | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6cd69a..730971b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,7 @@ include: # Uncomment the lines below if you want to override any of the variables. The following is just an example. ################ # variables: + _CSPELL_WORDS: 'antonín, slejška, ipinfo, keycdn, iplocation' # SKIP_ESLINT: '1' # OPT_IN_TEST_NEXT_MAJOR: '1' # _CURL_TEMPLATES_REF: 'main' diff --git a/README.md b/README.md index 7d37a8f..6c79fd0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## INTRODUCTION -The IP Info module summarizes informations for IPs: +The IP Info module summarises information for IPs: - Log messages with the IP - Is the IP banned? -- GitLab From e34db2e78a50e8c9a5c9af4d3a2eb4620c273935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Slej=C5=A1ka?= <3021-AntoninSlejska@users.noreply.drupalcode.org> Date: Wed, 12 Feb 2025 17:44:54 +0000 Subject: [PATCH 2/5] Solves an issue in the .gitlab-ci.yml. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 730971b..aa26b4c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,7 +23,7 @@ include: # https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml # Uncomment the lines below if you want to override any of the variables. The following is just an example. ################ -# variables: +variables: _CSPELL_WORDS: 'antonín, slejška, ipinfo, keycdn, iplocation' # SKIP_ESLINT: '1' # OPT_IN_TEST_NEXT_MAJOR: '1' -- GitLab From 81118dfe0cf18df3a005525ee0e4d49b40c6dc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Slej=C5=A1ka?= <3021-AntoninSlejska@users.noreply.drupalcode.org> Date: Wed, 12 Feb 2025 17:55:52 +0000 Subject: [PATCH 3/5] Solves cspell error. --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c79fd0..c850408 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## INTRODUCTION -The IP Info module summarises information for IPs: +The IP Info module summarizes information for IPs: - Log messages with the IP - Is the IP banned? @@ -32,4 +32,3 @@ directly in the Drupal administration. Current maintainers: - Antonín Slejška - https://www.drupal.org/u/anton%C3%ADn-slej%C5%A1ka - -- GitLab From 7844f91c7fbdd83351026eb846e71e2c4da7888d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Slej=C5=A1ka?= <antonin@slejska.eu> Date: Thu, 13 Feb 2025 14:14:15 +0100 Subject: [PATCH 4/5] Solves PHPCS errors. --- src/Controller/IpController.php | 18 ++++++++++++++---- src/Routing/RouteSubscriber.php | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Controller/IpController.php b/src/Controller/IpController.php index 33fdd81..4b7ceb6 100644 --- a/src/Controller/IpController.php +++ b/src/Controller/IpController.php @@ -29,6 +29,14 @@ class IpController extends DbLogController { /** * Constructs a new IpController object. * + * @param \Drupal\Core\Database\Connection $database + * The database connection. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler. + * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter + * The date formatter. + * @param \Drupal\Core\Form\FormBuilderInterface $form_builder + * The form builder. * @param \Drupal\ban\BanIpManagerInterface $ip_manager * The ban IP manager. */ @@ -56,10 +64,12 @@ class IpController extends DbLogController { // Add unban link. if (isset($ban_id)) { $build['dblog_filter_form']['#prefix'] .= Link::fromTextAndUrl($this->t('Unban this IP address'), Url::fromRoute('ban.delete', ['ban_id' => $ban_id]))->toString() . '.</p>'; - } else { + } + else { $build['dblog_filter_form']['#prefix'] .= '</p>'; } - } else { + } + else { $build['dblog_filter_form']['#prefix'] = '<p>' . $this->t('The IP address is not banned.') . ' '; // Add ban link. $build['dblog_filter_form']['#prefix'] .= Link::fromTextAndUrl($this->t('Ban this IP address'), Url::fromRoute('ban.admin_page', ['default_ip' => $ip_address]))->toString() . '.</p>'; @@ -78,7 +88,7 @@ class IpController extends DbLogController { } // Remove the last comma. $lookup_services_links = rtrim($lookup_services_links, ', '); - $build['dblog_filter_form']['#prefix'] .= '<p>' . $this->t('Lookup the IP: ') . $lookup_services_links . '</p>'; + $build['dblog_filter_form']['#prefix'] .= '<p>' . $this->t('Lookup the IP:') . ' ' . $lookup_services_links . '</p>'; // Get IP data from IPinfo.io API. if ( @@ -203,7 +213,7 @@ class IpController extends DbLogController { 'data' => [ // Cells. ['class' => ['icon']], - $this->t($dblog->type), + $dblog->type, $this->dateFormatter->format($dblog->timestamp, 'short'), $message, ['data' => $username], diff --git a/src/Routing/RouteSubscriber.php b/src/Routing/RouteSubscriber.php index 49f5948..c55fd84 100644 --- a/src/Routing/RouteSubscriber.php +++ b/src/Routing/RouteSubscriber.php @@ -5,6 +5,9 @@ namespace Drupal\ip_info\Routing; use Drupal\Core\Routing\RouteSubscriberBase; use Symfony\Component\Routing\RouteCollection; +/** + * Subscriber for IP info routes. + */ class RouteSubscriber extends RouteSubscriberBase { /** -- GitLab From 41964e40ac5d8d9115ddfaf60a9cb57908413319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=C3=ADn=20Slej=C5=A1ka?= <antonin@slejska.eu> Date: Thu, 13 Feb 2025 14:20:09 +0100 Subject: [PATCH 5/5] Solves PHPCS errors. --- src/Controller/IpController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controller/IpController.php b/src/Controller/IpController.php index 4b7ceb6..fb5479f 100644 --- a/src/Controller/IpController.php +++ b/src/Controller/IpController.php @@ -22,6 +22,8 @@ use Drupal\Component\Utility\Unicode; class IpController extends DbLogController { /** + * The ban IP manager. + * * @var \Drupal\ban\BanIpManagerInterface */ protected $ipManager; @@ -88,7 +90,7 @@ class IpController extends DbLogController { } // Remove the last comma. $lookup_services_links = rtrim($lookup_services_links, ', '); - $build['dblog_filter_form']['#prefix'] .= '<p>' . $this->t('Lookup the IP:') . ' ' . $lookup_services_links . '</p>'; + $build['dblog_filter_form']['#prefix'] .= '<p>' . $this->t('Lookup the IP:') . ' ' . $lookup_services_links . '</p>'; // Get IP data from IPinfo.io API. if ( -- GitLab