Skip to content

Commit

Permalink
Fix consent error in plugin. Update to track user identity.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiasco committed Nov 20, 2023
1 parent b10ed16 commit ece7e21
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/EventsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Drutiny\Attribute\Plugin;
use Drutiny\Attribute\PluginField;
use Drutiny\Console\Application;
use Drutiny\Console\Helper\User;
use Drutiny\Plugin as DrutinyPlugin;
use Drutiny\Plugin\FieldType;
use Drutiny\Plugin\Question;
Expand All @@ -21,7 +22,8 @@
name: 'consent',
description: "Enable anonymous sharing of usage and performance data with Acquia",
type: FieldType::CONFIG,
ask: Question::CONFIRMATION
ask: Question::CONFIRMATION,
validation: 'is_bool'
)]
class EventsSubscriber implements EventSubscriberInterface {

Expand All @@ -31,7 +33,8 @@ public function __construct(
protected CloudApi $api,
protected DrutinyPlugin $plugin,
protected Analytics $analytics,
protected Application $application
protected Application $application,
protected User $user
) {
$this->requestTime = new DateTimeImmutable(timezone: new DateTimeZone('UTC'));
}
Expand Down Expand Up @@ -71,7 +74,7 @@ public function trackReport(Report $report):void {
return;

}
$agent = sprintf('%s %s', $this->application->getName(), $this->application->getVersion());
$agent = sprintf('%s %s (%s)', $this->application->getName(), $this->application->getVersion(), $this->user->getIdentity());

$this->analytics->queueEvent('report.build', [
'timestamp' => $this->requestTime->format('U'),
Expand Down

0 comments on commit ece7e21

Please sign in to comment.