mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 16:23:16 +00:00
Merge pull request #1292 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
dbfbed5cea
5 changed files with 8 additions and 13 deletions
|
@ -43,8 +43,8 @@ class CommentController extends Controller
|
||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'item' => 'required|integer',
|
'item' => 'required|integer|min:1',
|
||||||
'comment' => 'required|string|max:500',
|
'comment' => 'required|string|max:'.(int) config('pixelfed.max_caption_length'),
|
||||||
]);
|
]);
|
||||||
$comment = $request->input('comment');
|
$comment = $request->input('comment');
|
||||||
$statusId = $request->item;
|
$statusId = $request->item;
|
||||||
|
@ -57,8 +57,6 @@ class CommentController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::forget('transform:status:'.$status->url());
|
|
||||||
|
|
||||||
$reply = DB::transaction(function() use($comment, $status, $profile) {
|
$reply = DB::transaction(function() use($comment, $status, $profile) {
|
||||||
$autolink = Autolink::create()->autolink($comment);
|
$autolink = Autolink::create()->autolink($comment);
|
||||||
$reply = new Status();
|
$reply = new Status();
|
||||||
|
|
|
@ -20,14 +20,12 @@ class LikeController extends Controller
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'item' => 'required|integer',
|
'item' => 'required|integer|min:1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
$status = Status::withCount('likes')->findOrFail($request->input('item'));
|
$status = Status::withCount('likes')->findOrFail($request->input('item'));
|
||||||
|
|
||||||
Cache::forget('transform:status:'.$status->url());
|
|
||||||
|
|
||||||
$count = $status->likes_count;
|
$count = $status->likes_count;
|
||||||
|
|
||||||
if ($status->likes()->whereProfileId($profile->id)->count() !== 0) {
|
if ($status->likes()->whereProfileId($profile->id)->count() !== 0) {
|
||||||
|
@ -48,8 +46,6 @@ class LikeController extends Controller
|
||||||
->take(1000)
|
->take(1000)
|
||||||
->pluck('status_id');
|
->pluck('status_id');
|
||||||
|
|
||||||
Cache::put('api:like-ids:user:'.$profile->id, $likes, now()->addMinutes(1440));
|
|
||||||
|
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,8 +53,10 @@ trait LabsSettings {
|
||||||
if($profile->is_suggestable == false) {
|
if($profile->is_suggestable == false) {
|
||||||
$profile->is_suggestable = true;
|
$profile->is_suggestable = true;
|
||||||
$changes = true;
|
$changes = true;
|
||||||
|
if($profile->statuses->count() > 0) {
|
||||||
SuggestionService::set($profile->id);
|
SuggestionService::set($profile->id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$profile->is_suggestable = false;
|
$profile->is_suggestable = false;
|
||||||
$changes = true;
|
$changes = true;
|
||||||
|
|
|
@ -229,14 +229,12 @@ class StatusController extends Controller
|
||||||
$this->authCheck();
|
$this->authCheck();
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'item' => 'required|integer',
|
'item' => 'required|integer|min:1',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$profile = Auth::user()->profile;
|
$profile = Auth::user()->profile;
|
||||||
$status = Status::withCount('shares')->findOrFail($request->input('item'));
|
$status = Status::withCount('shares')->findOrFail($request->input('item'));
|
||||||
|
|
||||||
Cache::forget('transform:status:'.$status->url());
|
|
||||||
|
|
||||||
$count = $status->shares_count;
|
$count = $status->shares_count;
|
||||||
|
|
||||||
$exists = Status::whereProfileId(Auth::user()->profile->id)
|
$exists = Status::whereProfileId(Auth::user()->profile->id)
|
||||||
|
|
|
@ -45,6 +45,7 @@ class SuggestionService {
|
||||||
$ids = Profile::whereNull('domain')
|
$ids = Profile::whereNull('domain')
|
||||||
->whereIsSuggestable(true)
|
->whereIsSuggestable(true)
|
||||||
->whereIsPrivate(false)
|
->whereIsPrivate(false)
|
||||||
|
->whereHas('statuses')
|
||||||
->pluck('id');
|
->pluck('id');
|
||||||
foreach($ids as $id) {
|
foreach($ids as $id) {
|
||||||
self::set($id);
|
self::set($id);
|
||||||
|
|
Loading…
Reference in a new issue