mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
commit
620b7b944c
3 changed files with 40 additions and 6 deletions
|
@ -115,6 +115,9 @@
|
||||||
- Updated DeleteAccountPipeline, fix perf issues. ([a9edd93f](https://github.com/pixelfed/pixelfed/commit/a9edd93f))
|
- Updated DeleteAccountPipeline, fix perf issues. ([a9edd93f](https://github.com/pixelfed/pixelfed/commit/a9edd93f))
|
||||||
- Updated DeleteAccountPipeline, improve coverage. ([4870cc3b](https://github.com/pixelfed/pixelfed/commit/4870cc3b))
|
- Updated DeleteAccountPipeline, improve coverage. ([4870cc3b](https://github.com/pixelfed/pixelfed/commit/4870cc3b))
|
||||||
- Updated media model, use original photo url for non-existent thumbnails. ([9b04b9d8](https://github.com/pixelfed/pixelfed/commit/9b04b9d8))
|
- Updated media model, use original photo url for non-existent thumbnails. ([9b04b9d8](https://github.com/pixelfed/pixelfed/commit/9b04b9d8))
|
||||||
|
- Updated PlaceController, require authentication. ([e7783af6](https://github.com/pixelfed/pixelfed/commit/e7783af6))
|
||||||
|
- Updated PublicApiController, disable legacy public access to local timeline. ([6ba7d433](https://github.com/pixelfed/pixelfed/commit/6ba7d433))
|
||||||
|
- Updated DiscoverController, cache public tag feed and only include local posts for unauthenticated users. ([0541aed5](https://github.com/pixelfed/pixelfed/commit/0541aed5))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)
|
## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2)
|
||||||
|
|
|
@ -63,12 +63,12 @@ class DiscoverController extends Controller
|
||||||
|
|
||||||
public function getHashtags(Request $request)
|
public function getHashtags(Request $request)
|
||||||
{
|
{
|
||||||
$auth = Auth::check();
|
$user = $request->user();
|
||||||
abort_if(!config('instance.discover.tags.is_public') && !$auth, 403);
|
abort_if(!config('instance.discover.tags.is_public') && !$user, 403);
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'hashtag' => 'required|string|min:1|max:124',
|
'hashtag' => 'required|string|min:1|max:124',
|
||||||
'page' => 'nullable|integer|min:1|max:' . ($auth ? 29 : 10)
|
'page' => 'nullable|integer|min:1|max:' . ($user ? 29 : 10)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$page = $request->input('page') ?? '1';
|
$page = $request->input('page') ?? '1';
|
||||||
|
@ -76,8 +76,8 @@ class DiscoverController extends Controller
|
||||||
$tag = $request->input('hashtag');
|
$tag = $request->input('hashtag');
|
||||||
|
|
||||||
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
||||||
if($page == 1) {
|
if($user && $page == 1) {
|
||||||
$res['follows'] = HashtagFollow::whereUserId(Auth::id())
|
$res['follows'] = HashtagFollow::whereUserId($user->id)
|
||||||
->whereHashtagId($hashtag->id)
|
->whereHashtagId($hashtag->id)
|
||||||
->exists();
|
->exists();
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,37 @@ class DiscoverController extends Controller
|
||||||
'name' => $hashtag->name,
|
'name' => $hashtag->name,
|
||||||
'url' => $hashtag->url()
|
'url' => $hashtag->url()
|
||||||
];
|
];
|
||||||
$res['tags'] = StatusHashtagService::get($hashtag->id, $page, $end);
|
if($user) {
|
||||||
|
$tags = StatusHashtagService::get($hashtag->id, $page, $end);
|
||||||
|
$res['tags'] = collect($tags)
|
||||||
|
->filter(function($tag) {
|
||||||
|
if(!StatusService::get($tag['status']['id'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
} else {
|
||||||
|
$key = 'discover:tags:public_feed:' . $hashtag->id . ':page:' . $page;
|
||||||
|
$tags = Cache::remember($key, 900, function() use($hashtag, $page, $end) {
|
||||||
|
return collect(StatusHashtagService::get($hashtag->id, $page, $end))
|
||||||
|
->filter(function($tag) {
|
||||||
|
if(!$tag['status']['local']) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
});
|
||||||
|
$res['tags'] = collect($tags)
|
||||||
|
->filter(function($tag) {
|
||||||
|
if(!StatusService::get($tag['status']['id'])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use App\Util\Media\License;
|
use App\Util\Media\License;
|
||||||
use Storage;
|
use Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Media extends Model
|
class Media extends Model
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue