mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-27 15:33:17 +00:00
Merge pull request #193 from dansup/frontend-ui-refactor
Update comment url structure
This commit is contained in:
commit
93e629ac4a
4 changed files with 10 additions and 4 deletions
|
@ -10,10 +10,10 @@ use App\{Comment, Profile, Status};
|
|||
class CommentController extends Controller
|
||||
{
|
||||
|
||||
public function show(Request $request, $username, int $id)
|
||||
public function show(Request $request, $username, int $id, int $cid)
|
||||
{
|
||||
$user = Profile::whereUsername($username)->firstOrFail();
|
||||
$status = Status::whereProfileId($user->id)->whereNotNull('in_reply_to_id')->findOrFail($id);
|
||||
$status = Status::whereProfileId($user->id)->whereInReplyToId($id)->findOrFail($cid);
|
||||
return view('status.reply', compact('user', 'status'));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class StatusController extends Controller
|
|||
->withCount('likes')
|
||||
->findOrFail($id);
|
||||
if(!$status->media_path && $status->in_reply_to_id) {
|
||||
return view('status.reply', compact('user', 'status'));
|
||||
return redirect($status->url());
|
||||
}
|
||||
return view('status.show', compact('user', 'status'));
|
||||
}
|
||||
|
|
|
@ -32,7 +32,12 @@ class Status extends Model
|
|||
{
|
||||
$id = $this->id;
|
||||
$username = $this->profile->username;
|
||||
return url(config('app.url') . "/p/{$username}/{$id}");
|
||||
$path = config('app.url') . "/p/{$username}/{$id}";
|
||||
if(!is_null($this->in_reply_to_id)) {
|
||||
$pid = $this->in_reply_to_id;
|
||||
$path = config('app.url') . "/p/{$username}/{$pid}/c/{$id}";
|
||||
}
|
||||
return url($path);
|
||||
}
|
||||
|
||||
public function mediaUrl()
|
||||
|
|
|
@ -125,6 +125,7 @@ Route::domain(config('pixelfed.domain.app'))->group(function() {
|
|||
Route::view('libraries', 'site.libraries')->name('site.libraries');
|
||||
});
|
||||
|
||||
Route::get('p/{username}/{id}/c/{cid}', 'CommentController@show');
|
||||
Route::get('p/{username}/{id}', 'StatusController@show');
|
||||
Route::get('{username}/saved', 'ProfileController@savedBookmarks');
|
||||
Route::get('{username}/followers', 'ProfileController@followers');
|
||||
|
|
Loading…
Reference in a new issue