From 0993839d0e70e54c34c355bd4ed036e23a1877a5 Mon Sep 17 00:00:00 2001 From: Marion Newlevant Date: Fri, 13 Dec 2019 16:04:49 -0800 Subject: [PATCH] 3.0.1 Issue with calling `$user->getIsGuest()` from plugin `init` (before app is fully bootstrapped) --- CHANGELOG.md | 4 ++++ composer.json | 2 +- src/Snitch.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dd27d0..7abadad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 3.0.1 - 2019.12.13 +### Fixed +- Issue with calling `$user->getIsGuest()` from plugin `init` (before app is fully bootstrapped) + ## 3.0.0 - 2019.06.02 ### Added - Config `messageTemplate` for the warning message. This is parsed as twig. Default value `'May also be edited by: {{user.username}}.'` diff --git a/composer.json b/composer.json index 6eae245..9280f6c 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "marionnewlevant/snitch", "description": "Report when two people might be editing the same element (eg entry, category, or global) or field", "type": "craft-plugin", - "version": "3.0.0", + "version": "3.0.1", "keywords": [ "craft", "cms", diff --git a/src/Snitch.php b/src/Snitch.php index 0ab1e32..4519767 100644 --- a/src/Snitch.php +++ b/src/Snitch.php @@ -85,7 +85,7 @@ public function init() 'collision' => Collision::class, ]); - if (Craft::$app->getRequest()->getIsCpRequest() && !Craft::$app->getUser()->getIsGuest() && !Craft::$app->getRequest()->getIsAjax()) { + if (Craft::$app->getRequest()->getIsCpRequest() && !Craft::$app->getRequest()->getIsAjax()) { // Register our asset bundle Craft::$app->getView()->registerAssetBundle(SnitchAsset::class); // on save, remove any collision for this element.