Skip to content

Commit

Permalink
🔥 remove global dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Jan 11, 2025
1 parent 1d88a1a commit efd15c2
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test --parallel --coverage --min=45 #Increase this value regularly while writing tests. Target: 80%
run: php artisan test --parallel --coverage --min=40 #Increase this value regularly while writing tests. Target: 80%
34 changes: 1 addition & 33 deletions app/Http/Controllers/API/v1/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,39 +72,7 @@ public static function getDashboard(): AnonymousResourceCollection {
}

/**
* @OA\Get(
* path="/dashboard/global",
* operationId="getGlobalDashboard",
* tags={"Dashboard"},
* summary="Get paginated statuses of global dashboard",
* description="Returns paginated statuses of global dashboard",
* @OA\Parameter (
* name="page",
* description="Page of pagination",
* required=false,
* in="query",
* @OA\Schema(type="integer")
* ),
* @OA\Response(
* response=200,
* description="successful operation",
* @OA\JsonContent(
* @OA\Property(property="data", type="array",
* @OA\Items(
* ref="#/components/schemas/StatusResource"
* )
* ),
* @OA\Property(property="links", ref="#/components/schemas/Links"),
* @OA\Property(property="meta", ref="#/components/schemas/PaginationMeta"),
* )
* ),
* @OA\Response(response=400, description="Bad request"),
* @OA\Response(response=401, description="Not logged in"),
* security={
* {"passport": {"read-statuses"}}, {"token": {}}
* }
* )
*
* @deprecated
*/
public static function getGlobalDashboard(): AnonymousResourceCollection {
return StatusResource::collection(DashboardController::getGlobalDashboard(Auth::user()));
Expand Down
9 changes: 0 additions & 9 deletions app/Http/Controllers/FrontendStatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ public function getDashboard(): Renderable|RedirectResponse {
]);
}

public function getGlobalDashboard(): Renderable {
return view('dashboard', [
'statuses' => DashboardController::getGlobalDashboard(Auth::user()),
'latest' => StationController::getLatestArrivals(Auth::user()),
'future' => StatusBackend::getFutureCheckins(),
'showGlobalButton' => false
]);
}

public function getActiveStatuses(): View {
return view('activejourneys', [
'currentUser' => Auth::user(),
Expand Down
5 changes: 2 additions & 3 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,10 @@
"user.already-unmuted": "Der Benutzer :username ist nicht stummgeschaltet.",
"user.unmute-tooltip": "Benutzer nicht mehr stummschalten",
"dashboard.future": "Deine Check-ins in der Zukunft",
"dashboard.empty": "Dein dashboard wirkt noch etwas leer.",
"dashboard.empty": "Dein Dashboard wirkt noch etwas leer.",
"dashboard.empty.teaser": "Wenn du möchtest, kannst du anderen Träwellern folgen, um ihre Check-ins zu sehen!",
"dashboard.empty.discover1": "Neue Leute kannst du unter",
"dashboard.empty.discover2": "oder",
"dashboard.empty.discover3": "(achtung, lange Wartezeit) entdecken",
"dashboard.empty.discover3": "entdecken",
"description.profile": ":username ist bereits :kmAmount Kilometer in :hourAmount Stunden in öffentlichen Verkehrsmitteln unterwegs gewesen.",
"description.status": "Die Reise von :username von :origin nach :destination am :date in :lineName.",
"description.leaderboard.main": "Die Top Träweller der letzten 7 Tage.",
Expand Down
3 changes: 1 addition & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@
"dashboard.empty": "Your dashboard seems a bit empty.",
"dashboard.empty.teaser": "If you want to, you can follow some people to see their check-ins here.",
"dashboard.empty.discover1": "You can discover new people in the section",
"dashboard.empty.discover2": "or",
"dashboard.empty.discover3": "(careful, slow load times)",
"dashboard.empty.discover3": "",
"user.block-tooltip": "Block user",
"user.blocked": "You have blocked the user :username.",
"user.already-blocked": "The user :username is already blocked.",
Expand Down
3 changes: 1 addition & 2 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,7 @@
"messages.exception.general-values": "Ha ocurrido un error desconocido. Vuelve a probar con otros valores.",
"messages.exception.reference": "Referencia del error: :reference",
"generic.error": "Error",
"dashboard.empty.discover2": "o",
"dashboard.empty.discover3": "(cuidado, tiempos largos de carga)",
"dashboard.empty.discover3": "",
"user.unmute-tooltip": "Quitar silencio al usuario",
"dashboard.empty": "Tu escritorio parece vacío.",
"dashboard.empty.teaser": "Si quieres, puedes seguir a otras personas para ver sus check-ins aqui.",
Expand Down
3 changes: 1 addition & 2 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@
"user.login.mastodon": "S'identifier avec Mastodon",
"user.login.or": "ou",
"user.no-account": "Vous n'avez pas encore de compte ?",
"dashboard.empty.discover3": "(attention, temps de chargement lents)",
"dashboard.empty.discover3": "",
"checkin.success.body": "Vous avez réussi avec succés votre enregistrement !",
"checkin.success.body2": "Vous allez faire :distance km dans la ligne :lineName de :origin à :destination.",
"settings.friend_checkin.friends": "Amis",
Expand Down Expand Up @@ -797,7 +797,6 @@
"welcome.stats.million": "Million",
"welcome.stats.distance": "kilomètres parcourus",
"welcome.hero.stats.description": "Vous pouvez recueillir des statistiques sur les opérateurs de transport les plus utilisés, les modes de transport et bien plus encore !",
"dashboard.empty.discover2": "ou",
"notifications.eventSuggestionProcessed.missing-information": "Nous ne pouvons pas approuver cet événement en raison d'informations manquantes. Veuillez nous fournir une source ou un site web spécifique sur cet événement.",
"notifications.youHaveBeenCheckedIn.lead": "Vous avez été enregistré par <b>@:username</b>",
"welcome.header.open-source": "Open source & gratuit, aujourd'hui et pour toujours.",
Expand Down
3 changes: 1 addition & 2 deletions lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,7 @@
"dashboard.empty": "Je overzicht lijkt erg leeg.",
"dashboard.empty.teaser": "Als je wilt, kun je mensen volgen en hier zien waar ze zijn ingecheckt.",
"dashboard.empty.discover1": "Zoek personen om te volgen in de sectie",
"dashboard.empty.discover2": "of",
"dashboard.empty.discover3": "(let op: lange laadtijden)",
"dashboard.empty.discover3": "",
"trip_creation.limitations.6.rules": "Regels",
"trip_creation.limitations.6.link": "https://help.traewelling.de/en/features/manual-trips/#info",
"user.points-enabled": "Punten en klassement tonen",
Expand Down
8 changes: 4 additions & 4 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ class="accordion-collapse collapse"
</h4>
<p>{{ __('dashboard.empty.teaser') }}</p>
<p>{{ __('dashboard.empty.discover1') }}
<a href="{{route('statuses.active')}}">{{ __('menu.active') }}</a>
{{ __('dashboard.empty.discover2') }}
<a href="{{route('globaldashboard') }}">{{ __('menu.globaldashboard') }}</a>
{{ __('dashboard.empty.discover3') }}
<a href="{{route('statuses.active')}}">
{{ __('menu.active') }}
</a>
{{ __('dashboard.empty.discover3') }}.
</p>
</div>
@endif
Expand Down
5 changes: 0 additions & 5 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ class="border border-white rounded-left form-control my-0 py-1"
<div class="row">
<div class="col-6 col-md-2 mb-3">
<ul class="nav flex-column">
<li class="nav-item mb-2">
<a href="{{ route('globaldashboard') }}" class="nav-link p-0 text-body-secondary">
{{ __('menu.globaldashboard') }}
</a>
</li>
<li class="nav-item mb-2">
<a href="{{ route('events') }}" class="nav-link p-0 text-body-secondary">
{{ __('events') }}
Expand Down
3 changes: 0 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@
Route::get('/dashboard', [FrontendStatusController::class, 'getDashboard'])
->name('dashboard');

Route::get('/dashboard/global', [FrontendStatusController::class, 'getGlobalDashboard'])
->name('globaldashboard');

Route::post('/status/update', [StatusController::class, 'updateStatus'])
->name('status.update'); //TODO: Replace with API Endpoint

Expand Down
63 changes: 0 additions & 63 deletions storage/api-docs/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2167,69 +2167,6 @@
]
}
},
"/dashboard/global": {
"get": {
"tags": [
"Dashboard"
],
"summary": "Get paginated statuses of global dashboard",
"description": "Returns paginated statuses of global dashboard",
"operationId": "getGlobalDashboard",
"parameters": [
{
"name": "page",
"in": "query",
"description": "Page of pagination",
"required": false,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/StatusResource"
}
},
"links": {
"$ref": "#/components/schemas/Links"
},
"meta": {
"$ref": "#/components/schemas/PaginationMeta"
}
},
"type": "object"
}
}
}
},
"400": {
"description": "Bad request"
},
"401": {
"description": "Not logged in"
}
},
"security": [
{
"passport": [
"read-statuses"
]
},
{
"token": []
}
]
}
},
"/dashboard/future": {
"get": {
"tags": [
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Frontend/LanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testRequestHasValidLanguageCodeWithLoggedInUser(): void {
$user = User::factory()->create();
$this->assertDatabaseMissing('users', ['username' => $user->username, 'language' => 'de']);
$response = $this->actingAs($user)
->get(route('globaldashboard', ['language' => 'de']));
->get(route('dashboard', ['language' => 'de']));
$response->assertOk();
$response->assertViewIs('dashboard');
$this->assertDatabaseHas('users', ['username' => $user->username, 'language' => 'de']);
Expand Down
34 changes: 0 additions & 34 deletions tests/Feature/UserBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,6 @@ public function testStatusesAreBlocked(): void {
->assertForbidden();
}

public function testAlicesStatusIsHiddenFromBobsGlobalDashboard(): void {
$this->actingAs($this->bob)
->get(route('globaldashboard'))
->assertSee($this->alice->username);

$this->aliceBlocksBob();

$this->actingAs($this->bob)
->get(route('globaldashboard'))
->assertOk()
->assertDontSee($this->alice->username);
}

public function testBobsStatusIsHiddenFromAlicesGlobalDashboard(): void {
Checkin::factory(['user_id' => $this->bob->id])->create();

$this->actingAs($this->alice)
->get(route('globaldashboard'))
->assertOk()
->assertSee(ProfilePictureController::getUrl($this->bob))
->assertSee(ProfilePictureController::getUrl($this->alice));

$this->aliceBlocksBob();

$this->actingAs($this->alice)
->get(route('globaldashboard'))
->assertOk()
// Bob's name is present in the session bag due the "you successfully blocked bob' message. Instead, we
// check that Bob's profile picture is not there, while Alice's picture is still there (from the checkin
// in self::setUp).
->assertDontSee(ProfilePictureController::getUrl($this->bob))
->assertSee(ProfilePictureController::getUrl($this->alice));
}

public function testAlicesStatusIsHiddenFromBobsActiveJourneys(): void {
$this->actingAs($this->bob)
->get(route('statuses.active'))
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/UserRedirectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function gdpr_interception() {

// If the user opens the app again, they get intercepted again.
$response = $this->actingAs($user)
->get('/dashboard/global');
->get('/dashboard');
$response->assertStatus(302);
$response->assertRedirect('/gdpr-intercept');
$this->followRedirects($response)
Expand Down

0 comments on commit efd15c2

Please sign in to comment.