Skip to content

Commit 9182c4f

Browse files
committed
Committing for UUID for Users and including watchables
1 parent 83e3184 commit 9182c4f

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

Diff for: .vscode/settings.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"php.executablePath": "c:\\xampp\\php\\php.exe",
3+
"php.debug.executablePath": "c:\\xampp\\php\\php.exe",
4+
"php.validate.executablePath": "c:\\xampp\\php\\php.exe",
5+
"editor.detectIndentation": false,
6+
"phpcs.standard": "PSR12",
7+
"php-cs-fixer.executablePath": "C:\\xampp\\php\\php-cs-fixer.phar",
8+
"php-cs-fixer.lastDownload": 1659542285557,
9+
"php-cs-fixer.executablePathWindows": "C:\\xampp\\php\\php-cs-fixer.phar",
10+
"php-cs-fixer.rules": "@PSR12",
11+
"files.eol": "\n",
12+
"php-cs-fixer.autoFixBySemicolon": true,
13+
"php-cs-fixer.exclude": [
14+
15+
],
16+
"remote.SSH.remotePlatform": {
17+
"192.168.1.100": "linux"
18+
},
19+
"sonarlint.pathToNodeExecutable": "C:\\program files\\nodejs\\node.exe",
20+
"phpcs.executablePath": "c:\\xampp\\php\\phpcs"
21+
}

Diff for: database/migrations/2019_07_15_152649_create_notification_settings_table.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function up()
1515
{
1616
Schema::create('notification_settings', function (Blueprint $table) {
1717
$table->bigIncrements('id');
18-
$table->unsignedBigInteger('user_id');
18+
$table->uuid('user_id');
1919
$table->string('user_type');
2020
$table->unsignedBigInteger('notification_type_id');
2121
$table->boolean('status')->default(true);

Diff for: src/ChannelManager.php

+27-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,21 @@ public function send($notifiables, $notification)
2323
return;
2424
}
2525

26+
$watchers = $notifiables['watchers'];
27+
$notifiables = $notifiables['notifiableUsers'];
28+
2629
$notifiables = $this->notifiables($notifiables, $notificationType);
30+
$notifiables = $notifiables->concat($watchers);
31+
$notifiables = $notifiables->unique(function ($item) {
32+
return $item['email'];
33+
});
2734

2835
(new NotificationSender(
29-
$this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale)
36+
$this,
37+
$this->container->make(Bus::class),
38+
$this->container->make(Dispatcher::class),
39+
$this->locale
40+
)
3041
)->send($notifiables, $notification);
3142
}
3243

@@ -45,11 +56,22 @@ public function sendNow($notifiables, $notification, array $channels = null)
4556
if (! NotificationType::isEnabled($notificationType)) {
4657
return;
4758
}
59+
$watchers = $notifiables['watchers'];
60+
$notifiables = $notifiables['notifiableUsers'];
4861

4962
$notifiables = $this->notifiables($notifiables, $notificationType);
5063

64+
$notifiables = $notifiables->concat($watchers);
65+
$notifiables = $notifiables->unique(function ($item) {
66+
return $item['email'];
67+
});
68+
5169
(new NotificationSender(
52-
$this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale)
70+
$this,
71+
$this->container->make(Bus::class),
72+
$this->container->make(Dispatcher::class),
73+
$this->locale
74+
)
5375
)->sendNow($notifiables, $notification, $channels);
5476
}
5577

@@ -65,6 +87,9 @@ public static function notifiables($notifiables, $notificationType)
6587
$notifiables->load('notificationSettings');
6688

6789
return $notifiables->filter(function ($notifiable) use ($notificationType) {
90+
if ($notificationType == 'App\Notifications\InstanceInvite') {
91+
return true;
92+
}
6893
return $notifiable->canReceive($notificationType);
6994
});
7095
}

0 commit comments

Comments
 (0)