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

Commit

Permalink
Release/1.7.1 (#106)
Browse files Browse the repository at this point in the history
* Feature/seat notifications/2.0.0 (#93)

* Introduce SeatGroupSyncNotification for SeatNotification 2.0

* Remove unneeded blade resources

* create abstract class

* add group class

* remove php storm creation comment

* Missing Refresh Token for seat-notification 2.0

* SeAT Group Application Notification for SeAT-Notifications 2.0

* SeAT Group Error Notification

* Added permissions to permission check

* remove unneeded routes

* Changelog and version bump

* Apply fixes from StyleCI

* Stopping the propagation of an event in case no one subscribed for event

reference: https://laravel.com/docs/5.5/events#defining-listeners

* Do not send the same MissingRefreshTokenNotification twice between 4hrs

* use qu1ckkk feedback and use sha1 instead of md5

* Apply fixes from StyleCI (#94) (#95)

* Release/1.7.0 (#96)

* Apply fixes from StyleCI (#94)

* correctly assert recipients group instead of the applicant ones.

* Implement `dontSend()` for Sync, Error

* Apply fixes from StyleCI (#97)

* prevent seat-group spamming and resolves: #91

* Add fix changelog note

* use get method to

* Refreshtoken test

* wip

* attempt to fix travis

* use fullpath

* with app?

* Refactor class Name

* attempt to rename model

* try with redis services

* local redis working

* attempt for localhost redis

* spaces

* travis + code_climate

* travis+code_climate

* try with coverage tag

* follow code instructions

* include services

* add alliance and corporation_infos table

* logging for code.clover

* try to build the coverage-clover

* add whitelist

* Testing added for change in CatchMissingRefreshToken

* Tweaking CatchMissingRefreshToken a little more.

* Write changelog

* Update Readme

* Apply fixes from StyleCI (#105)
  • Loading branch information
herpaderpaldent authored Apr 10, 2019
1 parent 8b16527 commit 311e3a8
Show file tree
Hide file tree
Showing 55 changed files with 1,734 additions and 216 deletions.
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
env:
global:
- CC_TEST_REPORTER_ID=5eb31309405cc7b8e6fd74b40e52f2bc072a25dd66900e96ed6bca168c0a720d

language: php

php:
- 7.2.1

services:
- redis-server

addons:
hosts:
- redis

before_script:
- composer self-update
- composer install --no-interaction
- composer dump-autoload
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build

script:
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Version 1.7.1
This new version has two main purposes:
1. introduce testing
2. temporally disable group memberships

Firstly i have introduced testing to strengthen my confidence in seat-groups. Doing so, i am able to work on seat-groups with the confidence i need and assure not breaking anything.
Secondly, users now will lose a role gained through SeAT Group role temporally if the user group is missing a refresh token. As soon as its been regained the user group will regain the roles from its SeAT Groups he is member of and is qualified (meaning has valid affiliation) for.

# Version 1.7.0
This version allows the usage of seat-notifications 2.0. Be aware your subscriptions have been reset and you must resubscribe.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ which correlate to SeAT-Roles.
[![Latest Stable Version](https://poser.pugx.org/herpaderpaldent/seat-groups/v/stable)](https://packagist.org/packages/herpaderpaldent/seat-groups)
[![StyleCI](https://github.styleci.io/repos/120507448/shield?branch=master)](https://github.styleci.io/repos/120507448)
[![Maintainability](https://api.codeclimate.com/v1/badges/ec32c88b40e1407ede38/maintainability)](https://codeclimate.com/github/herpaderpaldent/seat-groups/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/ec32c88b40e1407ede38/test_coverage)](https://codeclimate.com/github/herpaderpaldent/seat-groups/test_coverage)
[![Build Status](https://travis-ci.org/herpaderpaldent/seat-groups.svg?branch=master)](https://travis-ci.org/herpaderpaldent/seat-groups)
[![License](https://poser.pugx.org/herpaderpaldent/seat-groups/license)](https://packagist.org/packages/herpaderpaldent/seat-groups)
[![Total Downloads](https://poser.pugx.org/herpaderpaldent/seat-groups/downloads)](https://packagist.org/packages/herpaderpaldent/seat-groups)

Expand Down
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
"require": {
"php": ">=7.1",
"laravel/framework": "5.5.*",
"eveseat/web": "~3.0.14"
"eveseat/web": "~3.0.15"
},
"require-dev": {
"orchestra/testbench": "3.5.*",
"orchestra/testbench": "~3.5",
"orchestra/database" : "~3.5",
"phpunit/phpunit": "~6.0"
"phpunit/phpunit": "~6.0",
"spatie/phpunit-watcher": "^1.8",
"codeclimate/php-test-reporter": "^0.4.4"
},
"conflict": {
"herpaderpaldent/seat-notifications": "<2.0.0"
Expand All @@ -26,7 +28,7 @@
"prefer-stable": true,
"autoload": {
"psr-4": {
"Herpaderpaldent\\Seat\\SeatGroups\\": "src/"
"Herpaderpaldent\\Seat\\SeatGroups\\": "src"
}
},
"autoload-dev": {
Expand All @@ -35,7 +37,8 @@
}
},
"scripts":{
"test": "vendor/bin/phpunit"
"test": "vendor/bin/phpunit",
"watch": "vendor/bin/phpunit-watcher watch"
},
"extra": {
"laravel": {
Expand Down
11 changes: 11 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="REDIS_HOST" value="redis"/>
<env name="REDIS_PASSWORD" value="null"/>
<env name="REDIS_PORT" value="6379"/>
</php>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
4 changes: 2 additions & 2 deletions src/Actions/Alliances/AddAllianceAffiliation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Alliances;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class AddAllianceAffiliation
{
Expand All @@ -17,7 +17,7 @@ public function execute(array $data)
$seat_group_id = $data['seatgroup_id'];
$alliance_ids = $data['alliance_ids'];

$seat_group = Seatgroup::find($seat_group_id);
$seat_group = SeatGroup::find($seat_group_id);

$seat_group->alliance()->attach($alliance_ids);

Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Alliances/RemoveAllianceAffiliation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Alliances;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class RemoveAllianceAffiliation
{
Expand All @@ -17,7 +17,7 @@ public function execute(array $data)
$seat_group_id = $data['seatgroup_id'];
$alliance_ids = $data['alliance_ids'];

$seat_group = Seatgroup::find($seat_group_id);
$seat_group = SeatGroup::find($seat_group_id);

$seat_group->alliance()->detach($alliance_ids);

Expand Down
35 changes: 22 additions & 13 deletions src/Actions/Corporations/AddCorporationAffiliationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Exception;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;
use Seat\Services\Repositories\Corporation\Corporation;

class AddCorporationAffiliationAction
Expand All @@ -20,22 +21,30 @@ public function execute(array $data)
$seat_group_id = $data['seatgroup_id'];
$corporations = $data['corporation_ids'];

$seat_group = Seatgroup::find($seat_group_id);
try {
$seat_group = SeatGroup::findOrFail($seat_group_id);

if(in_array('-1', $corporations)){
// First set SeAT Group to $all_corporation = true
$seat_group->all_corporations = true;
$seat_group->save();
if(in_array('-1', $corporations)){
// First set SeAT Group to $all_corporation = true
$seat_group->all_corporations = true;
$seat_group->save();

// Secondly remove the -1 value from the array
$corporations = array_filter($corporations, function ($value) {
return $value !== '-1';
});
}
// Secondly remove the -1 value from the array
$corporations = array_filter($corporations, function ($value) {
return $value !== '-1';
});
}

$seat_group->corporation()->attach($corporations);

return true;

$seat_group->corporation()->attach($corporations);
} catch (Exception $e) {

return true;
report($e);

return false;
}

}
}
4 changes: 2 additions & 2 deletions src/Actions/Corporations/GetCorporationListAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;
use Seat\Eveapi\Models\Corporation\CorporationInfo;

class GetCorporationListAction //TODO: Refactor this Class and rename
{
public function execute(array $data)
{

$seatgroup = Seatgroup::find($data['seatgroup_id']);
$seatgroup = SeatGroup::find($data['seatgroup_id']);

$existing_affiliations = collect();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class RemoveAllCorporationAffiliationAction
{
public function execute(array $data)
{
try {
$seatgroup_id = $data['seatgroup_id'];
$seatgroup = Seatgroup::find($seatgroup_id);
$seatgroup = SeatGroup::find($seatgroup_id);

$seatgroup->all_corporations = false;
$seatgroup->save();
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Corporations/RemoveCorpAffiliationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;
use Seat\Services\Repositories\Corporation\Corporation;

class RemoveCorpAffiliationAction
Expand All @@ -20,7 +20,7 @@ public function execute(array $data)
$group_id = $data['seatgroup_id'];
$corporation_id = $data['corporation_id'];

$seat_group = Seatgroup::find($group_id);
$seat_group = SeatGroup::find($group_id);

$seat_group->corporation()->detach($corporation_id);

Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Corporations/Titles/GetCorporationTitleAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Corporations\Titles;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;
use Seat\Eveapi\Models\Corporation\CorporationTitle;

class GetCorporationTitleAction
Expand All @@ -18,7 +18,7 @@ public function execute(array $data)
$corporationId = $data['corporation_id'];
$seatgroup_id = $data['seatgroup_id'];

$existing_affiliations = Seatgroup::find($seatgroup_id)
$existing_affiliations = SeatGroup::find($seatgroup_id)
->corporationTitles
->where('corporation_id', $corporationId)
->pluck('title_id');
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Managers/AddManagerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Managers;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class AddManagerAction
{
public function execute(array $data)
{
$seatgroup = Seatgroup::find($data['seatgroup_id']);
$seatgroup = SeatGroup::find($data['seatgroup_id']);

if(isset($data['groups'])){
$groups = $data['groups'];
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/Managers/RemoveManagerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Managers;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class RemoveManagerAction
{
public function execute(array $data)
{
$seatgroup = Seatgroup::find($data['seatgroup_id']);
$seatgroup = SeatGroup::find($data['seatgroup_id']);
$group_id = $data['group_id'];
$children_id = $data['children_id'];

Expand Down
27 changes: 27 additions & 0 deletions src/Actions/Seat/GetMainCharacterAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Herpaderpaldent\Seat\SeatGroups\Actions\Seat;

use Herpaderpaldent\Seat\SeatGroups\Exceptions\MissingMainCharacterException;
use Seat\Web\Models\Group;

class GetMainCharacterAction
{
public function execute(Group $group)
{
$main_character = $group->main_character;

if (is_null($main_character)) {
logger()->warning('Group has no main character set. Attempt to make assignation based on first attached character.', [
'group_id' => $group->id,
]);
$main_character = optional($group->users()->has('character')->first())->character;
}

if (is_null($main_character))
throw new MissingMainCharacterException($group);

return $main_character;

}
}
6 changes: 3 additions & 3 deletions src/Actions/SeatGroups/CreateSeatGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\SeatGroups;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class CreateSeatGroup
{
public function execute(array $data) : Seatgroup
public function execute(array $data) : SeatGroup
{
//dd($data);
$seat_group = new Seatgroup;
$seat_group = new SeatGroup;
$seat_group->name = $data['name'];
$seat_group->description = $data['description'];
$seat_group->type = $data['type'];
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/SeatGroups/DeleteSeatGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\SeatGroups;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;

class DeleteSeatGroup
{
public function execute(array $data)
{
$group_id = $data['seatgroup_id'];

$seatgroup = Seatgroup::find($group_id);
$seatgroup = SeatGroup::find($group_id);
$seatgroup->delete();

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/Actions/SeatGroups/GetCurrentAffiliationAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

namespace Herpaderpaldent\Seat\SeatGroups\Actions\SeatGroups;

use Herpaderpaldent\Seat\SeatGroups\Models\Seatgroup;
use Herpaderpaldent\Seat\SeatGroups\Models\SeatGroup;
use Seat\Eveapi\Models\Corporation\CorporationInfo;
use Seat\Eveapi\Models\Corporation\CorporationTitle;

class GetCurrentAffiliationAction
{
public function execute(array $data)
{
$seatgroup = Seatgroup::find($data['seatgroup_id']);
$seatgroup = SeatGroup::find($data['seatgroup_id']);

$affiliations = collect();

Expand Down
Loading

0 comments on commit 311e3a8

Please sign in to comment.