Skip to content

Commit

Permalink
Merge branch 'master' of github.com:justbetter/magento2-sentry into f…
Browse files Browse the repository at this point in the history
…eature/user-context
  • Loading branch information
indykoning committed Nov 6, 2024
2 parents 43ec41b + 866f561 commit c80d88e
Show file tree
Hide file tree
Showing 23 changed files with 377 additions and 76 deletions.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@
Example: The exact commands you ran and their output,
screenshots / videos if the pull request changes UI.
-->

**Checklist**

- [ ] I've ran `composer run codestyle`
- [ ] I've ran `composer run phpstan`
8 changes: 6 additions & 2 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: PHPStan

on: ['push', 'pull_request']
on:
push:
branches:
- master
pull_request:

jobs:
test:
Expand All @@ -22,4 +26,4 @@ jobs:
run: composer install --no-interaction

- name: Analyse
run: vendor/bin/phpstan analyse
run: composer run analyse
32 changes: 26 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
name: PHPCS
on: [push]
name: Code Style

on:
push:
branches:
- master
pull_request:

jobs:
build:
test:
runs-on: ubuntu-latest
name: PHPCS

steps:
- uses: actions/checkout@master
- name: PHPCS
run: docker run --rm -v $PWD:/code:ro domw/phpcs phpcs --colors --standard=Magento2 --report=full,summary,gitblame --extensions=php,phtml ./
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: composer install --no-interaction

- name: Analyse
run: composer run phpcs
9 changes: 8 additions & 1 deletion Block/Adminhtml/System/Config/DeploymentConfigInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class DeploymentConfigInfo extends Field
* DeploymentConfigInfo constructor.
*
* @param Context $context
* @param array $data
* @param Version $version
* @param array $data
*/
public function __construct(
Context $context,
Expand All @@ -29,6 +29,13 @@ public function __construct(
parent::__construct($context, $data);
}

/**
* Render the field.
*
* @param AbstractElement $element
*
* @return string
*/
public function render(AbstractElement $element)
{
return $this->_toHtml();
Expand Down
33 changes: 32 additions & 1 deletion Block/SentryScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@

class SentryScript extends Template
{
const CURRENT_VERSION = '7.39.0';
public const CURRENT_VERSION = '8.7.0';

/**
* SentryScript constructor.
*
* @param DataHelper $dataHelper
* @param Version $version
* @param Template\Context $context
* @param Json $json
* @param array $data
*/
public function __construct(
Expand Down Expand Up @@ -92,26 +94,41 @@ public function getEnvironment()
return $this->dataHelper->getEnvironment();
}

/**
* Whether to enable session replay.
*/
public function useSessionReplay(): bool
{
return $this->dataHelper->useSessionReplay();
}

/**
* Get the session replay sample rate.
*/
public function getReplaySessionSampleRate(): float
{
return $this->dataHelper->getReplaySessionSampleRate();
}

/**
* Get the session replay error sample rate.
*/
public function getReplayErrorSampleRate(): float
{
return $this->dataHelper->getReplayErrorSampleRate();
}

/**
* Whether to block media during replay.
*/
public function getReplayBlockMedia(): bool
{
return $this->dataHelper->getReplayBlockMedia();
}

/**
* Whether to show mask text.
*/
public function getReplayMaskText(): bool
{
return $this->dataHelper->getReplayMaskText();
Expand Down Expand Up @@ -167,21 +184,35 @@ public function stripStoreCode()
return $this->dataHelper->stripStoreCode();
}

/**
* Get Store code.
*
* @return string
*/
public function getStoreCode()
{
return $this->_storeManager->getStore()->getCode();
}

/**
* Whether tracing is enabled.
*/
public function isTracingEnabled(): bool
{
return $this->dataHelper->isTracingEnabled();
}

/**
* Get sample rate for tracing.
*/
public function getTracingSampleRate(): float
{
return $this->dataHelper->getTracingSampleRate();
}

/**
* Get a list of js errors to ignore.
*/
public function getIgnoreJsErrors(): string
{
return $this->json->serialize($this->dataHelper->getIgnoreJsErrors());
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Changelog
## [3.8.0] - 2024-08-09
### Added
* Added option to exclude default-integrations (https://github.com/justbetter/magento2-sentry/pull/146) thanks to https://github.com/rommelfreddy
### Removed
* Removed promise-polyfill (https://github.com/justbetter/magento2-sentry/pull/142) thanks to https://github.com/rommelfreddy
## [3.7.2] - 2024-07-04
### Fixed
* fix initialisation of replay integration (https://github.com/justbetter/magento2-sentry/pull/143) thanks to https://github.com/rommelfreddy
## [3.7.1] - 2024-06-25
### Fixed
* Fix CSP after Polyfill changes (https://github.com/justbetter/magento2-sentry/pull/141) thanks to https://github.com/sprankhub
## [3.7.0] - 2024-06-25
### Fixed
* Replace polyfill CDN with fastly (https://github.com/justbetter/magento2-sentry/pull/140) thanks to https://github.com/barryvdh
### Added
* Enable INP when tracing is enabled (https://github.com/justbetter/magento2-sentry/pull/137) thanks to https://github.com/amenk
## [3.6.0] - 2024-03-29
This release drops support for php 7.4 as it has been completely EOL for over a year. [https://www.php.net/supported-versions.php](https://www.php.net/supported-versions.php)
### Fixed
Expand Down
9 changes: 6 additions & 3 deletions Controller/Adminhtml/Test/Sentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Sentry extends Action
*
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'JustBetter_Sentry::sentry';
public const ADMIN_RESOURCE = 'JustBetter_Sentry::sentry';

/**
* Sentry constructor.
Expand All @@ -43,7 +43,7 @@ public function __construct(
/**
* Execute view action.
*
* @return \Magento\Framework\Controller\ResultInterface
* @return \Magento\Framework\Controller\ResultInterface|\Magento\Framework\App\ResponseInterface
*/
public function execute()
{
Expand All @@ -68,7 +68,10 @@ public function execute()
$result['content'] = implode(PHP_EOL, $activeWithReason['reasons']);
}

return $this->getResponse()->representJson(
/** @var \Magento\Framework\App\Response\Http $response */
$response = $this->getResponse();

return $response->representJson(
$this->jsonSerializer->serialize($result)
);
}
Expand Down
Loading

0 comments on commit c80d88e

Please sign in to comment.