This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from herpaderpaldent/development
Version 1.6.5 - Notification granularity This update takes advantage on the most recent seat-notification update (>1.1.0). Notifications may now be selected individually: * SeatGroup Sync Event: Dispatched whenever a user group is attached or detached from a role * SeATGroup Error Event: Dispatched whenever an error happens and laravel log should be investigated * Missing Refresh Token Event: Dispatched every time SeAT Group finds a refresh token to be missing. Please note you can stop SeAT to notify you about a certain user that might have left your corporation or sold his character by deactivating the user (link is provided inside the notification to do so). Furthermore: * Fixed smaller typos * Assure `eveseat/web ~3.0.14` is present * Changed licence to MIT
- Loading branch information
Showing
33 changed files
with
1,098 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
src/Http/Controllers/Notifications/MissingRefreshTokenController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
/** | ||
* 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\SeatGroups\Http\Controllers\Notifications; | ||
|
||
use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController; | ||
|
||
class MissingRefreshTokenController extends BaseNotificationController | ||
{ | ||
public function getNotification() : string | ||
{ | ||
return 'seatgroups::notification.missing_refreshtoken.notification'; | ||
} | ||
|
||
public function getPrivateView() : string | ||
{ | ||
return 'seatgroups::notification.missing_refreshtoken.private'; | ||
} | ||
|
||
public function getChannelView() : string | ||
{ | ||
|
||
return 'seatgroups::notification.missing_refreshtoken.channel'; | ||
} | ||
|
||
public function subscribeDm($via) | ||
{ | ||
$channel_id = $this->getPrivateChannel($via); | ||
|
||
if(is_null($channel_id)) | ||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
|
||
if($this->subscribeToChannel($channel_id, $via, 'missing_refreshtoken')) | ||
return redirect()->back()->with('success', 'You are going to be notified about missing refresh_tokens every time SeAT Group Sync runs.'); | ||
|
||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
} | ||
|
||
public function unsubscribeDm($via) | ||
{ | ||
$channel_id = $this->getPrivateChannel($via); | ||
|
||
if(is_null($channel_id)) | ||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
|
||
if($this->unsubscribeFromChannel($channel_id, 'missing_refreshtoken')) | ||
return redirect()->back()->with('success', 'You are no longer going to be notified about missing_refreshtoken events.'); | ||
|
||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
} | ||
|
||
public function subscribeChannel() | ||
{ | ||
|
||
$via = (string) request('via'); | ||
$channel_id = (string) request('channel_id'); | ||
|
||
if(is_null($channel_id) || is_null($channel_id)) | ||
return abort(500); | ||
|
||
if($this->subscribeToChannel($channel_id, $via, 'missing_refreshtoken', true)) | ||
return redirect()->back()->with('success', 'This channel is going to be notified about missing refresh_tokens every time SeAT Group Sync runs.'); | ||
|
||
return abort(500); | ||
} | ||
|
||
public function unsubscribeChannel($channel) | ||
{ | ||
$channel_id = $this->getChannelChannelId($channel, 'missing_refreshtoken'); | ||
|
||
if(is_null($channel_id)) | ||
return abort(500); | ||
|
||
if($this->unsubscribeFromChannel($channel_id, 'missing_refreshtoken')) | ||
return redirect()->back()->with('success', 'Channel will no longer receive missing_refreshtoken notifications.'); | ||
|
||
return abort(500); | ||
} | ||
|
||
public function isSubscribed($view, $channel) | ||
{ | ||
return $this->getSubscribtionStatus($channel, $view, 'missing_refreshtoken'); | ||
} | ||
|
||
public function isDisabledButton($view, $channel) : bool | ||
{ | ||
return $this->isDisabled($channel, $view, 'seatgroups.create'); | ||
} | ||
|
||
public function isAvailable() : bool | ||
{ | ||
return $this->hasPermission('seatgroups.create'); | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
src/Http/Controllers/Notifications/SeatGroupErrorController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
/** | ||
* 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\SeatGroups\Http\Controllers\Notifications; | ||
|
||
use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController; | ||
|
||
class SeatGroupErrorController extends BaseNotificationController | ||
{ | ||
public function getNotification() : string | ||
{ | ||
return 'seatgroups::notification.seatgroup_error.notification'; | ||
} | ||
|
||
public function getPrivateView() : string | ||
{ | ||
return 'seatgroups::notification.seatgroup_error.private'; | ||
} | ||
|
||
public function getChannelView() : string | ||
{ | ||
|
||
return 'seatgroups::notification.seatgroup_error.channel'; | ||
} | ||
|
||
public function subscribeDm($via) | ||
{ | ||
$channel_id = $this->getPrivateChannel($via); | ||
|
||
if(is_null($channel_id)) | ||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
|
||
if($this->subscribeToChannel($channel_id, $via, 'seatgroup_error')) | ||
return redirect()->back()->with('success', 'You are going to be notified about sync error events from SeAT Groups.'); | ||
|
||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
} | ||
|
||
public function unsubscribeDm($via) | ||
{ | ||
$channel_id = $this->getPrivateChannel($via); | ||
|
||
if(is_null($channel_id)) | ||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
|
||
if($this->unsubscribeFromChannel($channel_id, 'seatgroup_error')) | ||
return redirect()->back()->with('success', 'You are no longer going to be notified about seatgroup_error events.'); | ||
|
||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
} | ||
|
||
public function subscribeChannel() | ||
{ | ||
|
||
$via = (string) request('via'); | ||
$channel_id = (string) request('channel_id'); | ||
|
||
if(is_null($channel_id) || is_null($channel_id)) | ||
return abort(500); | ||
|
||
if($this->subscribeToChannel($channel_id, $via, 'seatgroup_error', true)) | ||
return redirect()->back()->with('success', 'Channel will receive seatgroup_error notifications from now on.'); | ||
|
||
return abort(500); | ||
} | ||
|
||
public function unsubscribeChannel($channel) | ||
{ | ||
$channel_id = $this->getChannelChannelId($channel, 'seatgroup_error'); | ||
|
||
if(is_null($channel_id)) | ||
return abort(500); | ||
|
||
if($this->unsubscribeFromChannel($channel_id, 'seatgroup_error')) | ||
return redirect()->back()->with('success', 'Channel will no longer receive seatgroup_error notifications.'); | ||
|
||
return abort(500); | ||
} | ||
|
||
public function isSubscribed($view, $channel) | ||
{ | ||
return $this->getSubscribtionStatus($channel, $view, 'seatgroup_error'); | ||
} | ||
|
||
public function isDisabledButton($view, $channel) : bool | ||
{ | ||
return $this->isDisabled($channel, $view, 'seatgroups.create'); | ||
} | ||
|
||
public function isAvailable() : bool | ||
{ | ||
return $this->hasPermission('seatgroups.create'); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
src/Http/Controllers/Notifications/SeatGroupSyncController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
namespace Herpaderpaldent\Seat\SeatGroups\Http\Controllers\Notifications; | ||
|
||
use Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\BaseNotificationController; | ||
|
||
class SeatGroupSyncController extends BaseNotificationController | ||
{ | ||
public function getNotification() : string | ||
{ | ||
return 'seatgroups::notification.seatgroup_sync.notification'; | ||
} | ||
|
||
public function getPrivateView() : string | ||
{ | ||
return 'seatgroups::notification.seatgroup_sync.private'; | ||
} | ||
|
||
public function getChannelView() : string | ||
{ | ||
|
||
return 'seatgroups::notification.seatgroup_sync.channel'; | ||
} | ||
|
||
public function subscribeDm($via) | ||
{ | ||
$channel_id = $this->getPrivateChannel($via); | ||
|
||
if(is_null($channel_id)) | ||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
|
||
if($this->subscribeToChannel($channel_id, $via, 'seatgroup_sync')) | ||
return redirect()->back()->with('success', 'You are going to be notified about sync events from SeAT Groups.'); | ||
|
||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
} | ||
|
||
public function unsubscribeDm($via) | ||
{ | ||
$channel_id = $this->getPrivateChannel($via); | ||
|
||
if(is_null($channel_id)) | ||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
|
||
if($this->unsubscribeFromChannel($channel_id, 'seatgroup_sync')) | ||
return redirect()->back()->with('success', 'You are no longer going to be notified about deleted seatgroup_sync events.'); | ||
|
||
return redirect()->back()->with('error', 'Something went wrong, please assure you have setup your personal delivery channel correctly.'); | ||
} | ||
|
||
public function subscribeChannel() | ||
{ | ||
|
||
$via = (string) request('via'); | ||
$channel_id = (string) request('channel_id'); | ||
|
||
if(is_null($channel_id) || is_null($channel_id)) | ||
return abort(500); | ||
|
||
if($this->subscribeToChannel($channel_id, $via, 'seatgroup_sync', true)) | ||
return redirect()->back()->with('success', 'Channel will receive seatgroup_sync notifications from now on.'); | ||
|
||
return abort(500); | ||
} | ||
|
||
public function unsubscribeChannel($channel) | ||
{ | ||
$channel_id = $this->getChannelChannelId($channel, 'seatgroup_sync'); | ||
|
||
if(is_null($channel_id)) | ||
return abort(500); | ||
|
||
if($this->unsubscribeFromChannel($channel_id, 'seatgroup_sync')) | ||
return redirect()->back()->with('success', 'Channel will no longer receive seatgroup_sync notifications.'); | ||
|
||
return abort(500); | ||
} | ||
|
||
public function isSubscribed($view, $channel) | ||
{ | ||
return $this->getSubscribtionStatus($channel, $view, 'seatgroup_sync'); | ||
} | ||
|
||
public function isDisabledButton($view, $channel) : bool | ||
{ | ||
return $this->isDisabled($channel, $view, 'seatgroups.create'); | ||
} | ||
|
||
public function isAvailable() : bool | ||
{ | ||
return $this->hasPermission('seatgroups.create'); | ||
} | ||
} |
Oops, something went wrong.