Set Last-Modified header for atom feeds, fixes #2988

pull/3623/head
Daniel Supernault 3 years ago
parent c3e8a0e439
commit c18dcde38f
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -118,8 +118,7 @@ class ProfileController extends Controller
'list' => $settings->show_profile_followers 'list' => $settings->show_profile_followers
] ]
]; ];
$ui = $request->has('ui') && $request->input('ui') == 'memory' ? 'profile.memory' : 'profile.show'; return view('profile.show', compact('profile', 'settings'));
return view($ui, compact('profile', 'settings'));
} }
} }
@ -210,7 +209,7 @@ class ProfileController extends Controller
->whereProfileId($pid) ->whereProfileId($pid)
->whereVisibility('public') ->whereVisibility('public')
->whereType('photo') ->whereType('photo')
->latest() ->orderByDesc('id')
->take(10) ->take(10)
->get() ->get()
->map(function($status) { ->map(function($status) {
@ -224,10 +223,14 @@ class ProfileController extends Controller
}) })
->values(); ->values();
$permalink = config('app.url') . "/users/{$profile['username']}.atom"; $permalink = config('app.url') . "/users/{$profile['username']}.atom";
$headers = ['Content-Type' => 'application/atom+xml'];
if($items && $items->count()) {
$headers['Last-Modified'] = now()->parse($items->first()['created_at'])->toRfc7231String();
}
return response() return response()
->view('atom.user', compact('profile', 'items', 'permalink')) ->view('atom.user', compact('profile', 'items', 'permalink'))
->header('Content-Type', 'application/atom+xml'); ->withHeaders($headers);
} }
public function meRedirect() public function meRedirect()

Loading…
Cancel
Save