Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #31 from herpaderpaldent/killmails
Browse files Browse the repository at this point in the history
# Version 1.1.0 Killmail Notifications
  • Loading branch information
herpaderpaldent authored Feb 3, 2019
2 parents 637836b + cc54b80 commit ab7af20
Show file tree
Hide file tree
Showing 63 changed files with 1,533 additions and 339 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Version 1.1.0

```
Don't forget to run migrations
```

## Description
This is the first item on the changelog. This version introduces kill mail notifications. Although this seems anything but a small addition the underlying capabilities of this package was completely reworked. Instead of having every other package handling their own subscribers and logic, the `BaseNotificationController.php` class was majorly extended abstracted and refactored to a degree, where it supports any other notification controller to get rid of their own recipient handling and database logic.

* Added Killmail Notifications
* Added ability to subscribe to multiple corporations as source of notification.
* Improved RateLimiting handling for discord: respect per channel rate-limit.
* Improved tags to monitor
* Fixed some permission issues

If you happen to find bugs please don't hesitate to ping me on [seat-slack](https://eveseat-slack.herokuapp.com/). I tested the plugin in my own corporation and concluded it to be working, however bugs happens and your feedback is a very valued source to improve.

---

For any developers that would like to take use of these capabilities please do not hesitate to reach out to me and take a look at [KillMailController.php](https://github.com/herpaderpaldent/seat-notifications/blob/master/src/Http/Controllers/Notifications/KillMailController.php) for an example with affiliations.

* Attention: only corporations are currently supported although whenever needed character affiliations could be added with ease: [SeatNotification.php](https://github.com/herpaderpaldent/seat-notifications/blob/master/src/Models/SeatNotification.php#L36)

For a simpler implementation please review [RefreshTokenController.php](https://github.com/herpaderpaldent/seat-notifications/blob/master/src/Http/Controllers/Notifications/RefreshTokenController.php)

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,25 @@ public function getNotification()
```

the functions should return a string containing the name of your view that should be rendered per column.

### Use BaseNotificationController

You are absolutely free to handle your own database and recipient logic. However seat-notifications offer you a convinient and easy way to handle your subscribors in [BaseNotificationController.php](https://github.com/herpaderpaldent/seat-notifications/blob/master/src/Http/Controllers/BaseNotificationController.php)

f.e:

````php
public function subscribeToChannel($channel_id, $via, $notification, $is_channel = false, $affiliation = null) : bool
{
try {
SeatNotificationRecipient::firstOrCreate(
['channel_id' => $channel_id], ['notification_channel' => $via, 'is_channel' => $is_channel]
)
->notifications()
->create(['name' => $notification, 'affiliation' => $affiliation]);
return true;
} catch (Exception $e) {
return false;
}
}
````
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "herpaderpaldent/seat-notifications",
"description": "A proof of concept for new notification settings",
"description": "With this SeAT Package you can setup and manage notifications. It is build to be expendend from within the package or from another package",
"autoload": {
"psr-4": {
"Herpaderpaldent\\Seat\\SeatNotifications\\": "src/"
Expand All @@ -18,7 +18,7 @@
"jolicode/slack-php-api": "^1.0"
},

"license": "GPL-2.0-only",
"license": "MIT",
"authors": [
{
"name": "Felix Huber",
Expand Down
25 changes: 21 additions & 4 deletions src/Caches/RedisRateLimitProvider.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* User: Herpaderp Aldent
* Date: 25.12.2018
* Time: 16:11.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Caches;
Expand Down
28 changes: 22 additions & 6 deletions src/Channels/Discord/DiscordChannel.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* User: felix
* Date: 25.12.2018
* Time: 20:56.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Discord;
Expand All @@ -21,7 +38,6 @@ class DiscordChannel

public function send($notifiable, Notification $notification)
{
var_dump('test');

if (! $channel = $notifiable->channel_id) {
return;
Expand All @@ -37,7 +53,7 @@ public function send($notifiable, Notification $notification)
'embed' => $payload['embeds'][0],
];

$job = new SendDiscordNotification($parameters);
$job = new SendDiscordNotification((int) $channel, $parameters);

dispatch($job)->onQueue('high');
}
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Discord/DiscordEmbed.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 07.07.2018
* Time: 22:53.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Discord;
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Discord/DiscordEmbedField.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 07.07.2018
* Time: 22:54.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Discord;
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Discord/DiscordMessage.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 07.07.2018
* Time: 10:21.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Discord;
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Slack/SlackAttachment.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 27.07.2018
* Time: 21:12.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Slack;
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Slack/SlackAttachmentField.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 27.07.2018
* Time: 21:13.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Slack;
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Slack/SlackChannel.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 26.07.2018
* Time: 12:07.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Slack;
Expand Down
25 changes: 21 additions & 4 deletions src/Channels/Slack/SlackMessage.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 27.07.2018
* Time: 21:09.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Channels\Slack;
Expand Down
25 changes: 21 additions & 4 deletions src/Commands/SeatNotificationsTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<?php
/**
* Created by PhpStorm.
* * User: Herpaderp Aldent
* Date: 07.07.2018
* Time: 18:26.
* MIT License.
*
* Copyright (c) 2019. Felix Huber
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace Herpaderpaldent\Seat\SeatNotifications\Commands;
Expand Down
Loading

0 comments on commit ab7af20

Please sign in to comment.