diff --git a/CHANGELOG.md b/CHANGELOG.md index e016487..71af519 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ CHANGELOG ========================== +## 1.0.2 (`1000270`) + +- **Change:** Minor code improvement and clean up (#7) + ## 1.0.1 (`1000170`) - **Fix:** Errors from avatar service are not correctly returned (#4) diff --git a/Setup.php b/Setup.php deleted file mode 100644 index c5a9cab..0000000 --- a/Setup.php +++ /dev/null @@ -1,20 +0,0 @@ -user_id) { diff --git a/XF/Pub/Controller/Account.php b/XF/Pub/Controller/Account.php index 07464e0..a031afd 100644 --- a/XF/Pub/Controller/Account.php +++ b/XF/Pub/Controller/Account.php @@ -3,22 +3,13 @@ namespace TickTackk\UploadAvatarFromUrl\XF\Pub\Controller; use TickTackk\UploadAvatarFromUrl\XF\Entity\User as ExtendedUserEntity; -use XF\Mvc\Reply\AbstractReply; use XF\Mvc\Reply\View as ViewReply; use XF\Mvc\Reply\Redirect as RedirectReply; -use XF\Mvc\Reply\Reroute as RerouteReply; -use XF\Mvc\Reply\Message as MessageReply; use XF\Mvc\Reply\Exception as ExceptionReply; use XF\Mvc\Reply\Error as ErrorReply; use XF\Util\File as FileUtil; +use XF\Service\User\Avatar as UserAvatarChangerSvc; -/** - * Class Account - * - * Extends \XF\Pub\Controller\Account - * - * @package TickTackk\UploadAvatarFromUrl\XF\Pub\Controller - */ class Account extends XFCP_Account { /** @@ -47,7 +38,7 @@ public function actionAvatar() throw $this->exception($this->noPermission($error)); } - /** @var \XF\Service\User\Avatar $avatarService */ + /** @var UserAvatarChangerSvc $avatarService */ $avatarService = $this->service('XF:User\Avatar', $visitor); if (\strlen($input['url'])) @@ -79,29 +70,8 @@ public function actionAvatar() { return $this->view('XF:Account\AvatarUpdate', ''); } - else - { - return $this->redirect($this->buildLink('account/avatar')); - } - } - else if ($visitor->avatar_date) - { - // recrop existing avatar - $cropX = $this->filter('avatar_crop_x', 'uint'); - $cropY = $this->filter('avatar_crop_y', 'uint'); - if ($cropX != $visitor->Profile->avatar_crop_x || $cropY != $visitor->Profile->avatar_crop_y) - { - $avatarService->setImageFromExisting(); - $avatarService->setCrop($cropX, $cropY); - if (!$avatarService->updateAvatar()) - { - return $this->error(\XF::phrase('new_avatar_could_not_be_processed')); - } - } - else - { - $avatarService->removeGravatar(); - } + + return $this->redirect($this->buildLink('account/avatar')); } } } diff --git a/addon.json b/addon.json index 941d88d..23e6c2e 100644 --- a/addon.json +++ b/addon.json @@ -2,8 +2,8 @@ "legacy_addon_id": "", "title": "Upload Avatar From URL", "description": "This add-on allows users with permission to upload avatar from URL.", - "version_id": 1000170, - "version_string": "1.0.1", + "version_id": 1000270, + "version_string": "1.0.2", "dev": "TickTackk", "dev_url": "https://xenforo.com/community/members/ticktackk.90375/", "faq_url": "",