Skip to content

Commit 8c0f52a

Browse files
committed
bump version to 0.1.1
1 parent 255d90b commit 8c0f52a

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "liplum/flarum-sync-profile-core",
33
"description": "The core module of user profile synchronization when authenticated by an external identity provider.",
4-
"version": "0.1",
4+
"version": "0.1.1",
55
"keywords": [
66
"flarum",
77
"flarum-extension",

js/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@liplum/flarum-sync-profile-core",
33
"private": true,
4-
"version": "0.1",
4+
"version": "0.1.1",
55
"devDependencies": {
66
"flarum-tsconfig": "^1.0",
77
"flarum-webpack-config": "^2.0",
@@ -13,4 +13,4 @@
1313
"dev": "webpack --mode development --watch",
1414
"build": "webpack --mode production"
1515
}
16-
}
16+
}

src/Listener/SyncProfileEventListener.php

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,27 @@
2121

2222
class SyncProfileEventListener
2323
{
24-
protected $avatarUploader;
25-
protected $extensions;
26-
protected $settings;
27-
protected $container;
28-
protected $config;
24+
private $avatarUploader;
25+
private $extensions;
26+
private $settings;
27+
private $container;
28+
private $config;
29+
private $log;
2930

3031
public function __construct(
3132
Container $container,
3233
AvatarUploader $avatarUploader,
3334
ExtensionManager $extensions,
3435
SettingsRepositoryInterface $settings,
3536
Config $config,
37+
LoggerInterface $log,
3638
) {
3739
$this->avatarUploader = $avatarUploader;
3840
$this->extensions = $extensions;
3941
$this->settings = $settings;
4042
$this->container = $container;
4143
$this->config = $config;
44+
$this->log = $log;
4245
}
4346

4447
public function subscribe(Dispatcher $events)
@@ -51,12 +54,12 @@ public function syncEvent(SyncProfileEvent $event)
5154
$email = $event->email;
5255
$user = User::query()->where("email", $email)->first();
5356
if (!$user) {
54-
$this->debugLog("Failed sync profile, due to $email not found");
57+
$this->log->debug("Failed sync profile, due to $email not found");
5558
return;
5659
}
5760
$this->sync($user, $event->attributes);
5861
$user->save();
59-
$this->debugLog("Synced $event->email");
62+
$this->log->debug("Synced $event->email");
6063
}
6164

6265
public function sync(User $user, $attributes)
@@ -71,7 +74,7 @@ public function sync(User $user, $attributes)
7174
&& $nickname != $user->$nickname
7275
) {
7376
if (!$this->extensions->isEnabled('flarum-nicknames')) {
74-
$this->debugLog("Sync user profile: 'nickname' failed, because extension 'flarum-nicknames' is not enabled.");
77+
$this->log->debug("Sync user profile: 'nickname' failed, because extension 'flarum-nicknames' is not enabled.");
7578
} else {
7679
$user->nickname = $nickname;
7780
}
@@ -86,7 +89,7 @@ public function sync(User $user, $attributes)
8689
&& $bio != $user->bio
8790
) {
8891
if (!$this->extensions->isEnabled('fof-user-bio')) {
89-
$this->debugLog("Sync user profile: 'nickname' failed, because extension 'fof/user-bio' is not enabled.");
92+
$this->log->debug("Sync user profile: 'nickname' failed, because extension 'fof/user-bio' is not enabled.");
9093
} else {
9194
$user->bio = $bio;
9295
}
@@ -136,7 +139,7 @@ public function sync(User $user, $attributes)
136139
&& $this->settings->get('liplum-sync-profile-core.sync-masquerade', false)
137140
) {
138141
if (!$this->extensions->isEnabled('fof-masquerade')) {
139-
$this->debugLog("Profile sync of of-masquerade failed, because extension 'fof/masquerade' is not enabled.");
142+
$this->log->debug("Profile sync of of-masquerade failed, because extension 'fof/masquerade' is not enabled.");
140143
} else {
141144
$controller = UserConfigureController::class;
142145
if (is_string($controller)) {
@@ -164,15 +167,4 @@ public function sync(User $user, $attributes)
164167
}
165168
}
166169
}
167-
168-
protected function debugLog(string $message)
169-
{
170-
if ($this->config->inDebugMode()) {
171-
/**
172-
* @var LoggerInterface
173-
*/
174-
$logger = resolve(LoggerInterface::class);
175-
$logger->info($message);
176-
}
177-
}
178170
}

0 commit comments

Comments
 (0)