mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update StatusController, restrict edits to 24 hours
This commit is contained in:
parent
3545937ec7
commit
ae24433b8c
1 changed files with 4 additions and 3 deletions
|
@ -229,8 +229,8 @@ class StatusController extends Controller
|
||||||
$user = Auth::user()->profile;
|
$user = Auth::user()->profile;
|
||||||
$status = Status::whereProfileId($user->id)
|
$status = Status::whereProfileId($user->id)
|
||||||
->with(['media'])
|
->with(['media'])
|
||||||
|
->where('created_at', '>', now()->subHours(24))
|
||||||
->findOrFail($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
return view('status.edit', compact('user', 'status'));
|
return view('status.edit', compact('user', 'status'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,6 +240,7 @@ class StatusController extends Controller
|
||||||
$user = Auth::user()->profile;
|
$user = Auth::user()->profile;
|
||||||
$status = Status::whereProfileId($user->id)
|
$status = Status::whereProfileId($user->id)
|
||||||
->with(['media'])
|
->with(['media'])
|
||||||
|
->where('created_at', '>', now()->subHours(24))
|
||||||
->findOrFail($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
|
@ -254,7 +255,7 @@ class StatusController extends Controller
|
||||||
|
|
||||||
$media = Media::whereProfileId($user->id)
|
$media = Media::whereProfileId($user->id)
|
||||||
->whereStatusId($status->id)
|
->whereStatusId($status->id)
|
||||||
->find($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
$changed = false;
|
$changed = false;
|
||||||
|
|
||||||
|
@ -263,7 +264,7 @@ class StatusController extends Controller
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($media->filter_class != $filter) {
|
if ($media->filter_class != $filter && in_array($filter, Filter::classes())) {
|
||||||
$media->filter_class = $filter;
|
$media->filter_class = $filter;
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue