Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔥 remove global dashboard #3129

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
456 changes: 228 additions & 228 deletions lang/de.json

Large diffs are not rendered by default.

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 @@ -572,8 +572,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 @@ -752,7 +752,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 @@ -792,7 +792,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 @@ -766,8 +766,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 @@ -195,9 +195,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 @@ -2218,69 +2218,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
Loading