Explorar o código

Update ProfileController, redirect profile view for authed users to Metro 2.0 UI

Daniel Supernault %!s(int64=3) %!d(string=hai) anos
pai
achega
7f8129a75c
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      app/Http/Controllers/ProfileController.php

+ 11 - 0
app/Http/Controllers/ProfileController.php

@@ -26,6 +26,17 @@ class ProfileController extends Controller
 {
 	public function show(Request $request, $username)
 	{
+		// redirect authed users to Metro 2.0
+		if($request->user()) {
+			// unless they force static view
+			if(!$request->has('fs') || $request->input('fs') != '1') {
+				$pid = AccountService::usernameToId($username);
+				if($pid) {
+					return redirect('/i/web/profile/' . $pid);
+				}
+			}
+		}
+
 		$user = Profile::whereNull('domain')
 			->whereNull('status')
 			->whereUsername($username)