mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 08:44:49 +00:00
commit
c316e488fa
7 changed files with 95 additions and 16 deletions
|
@ -6,9 +6,13 @@
|
|||
- Add php 8.2 support. Bump laravel version, v9 => v10 ([fb4ac4eb](https://github.com/pixelfed/pixelfed/commit/fb4ac4eb))
|
||||
- New media:fix-nonlocal-driver command. Fixes s3 media created with invalid FILESYSTEM_DRIVER=s3 configuration ([672cccd4](https://github.com/pixelfed/pixelfed/commit/672cccd4))
|
||||
- New landing page design ([09c0032b](https://github.com/pixelfed/pixelfed/commit/09c0032b))
|
||||
- Add cloud ip bans to BouncerService ([50ab2e20](https://github.com/pixelfed/pixelfed/commit/50ab2e20))
|
||||
- Add cloud ip bans to BouncerService (disabled by default) ([50ab2e20](https://github.com/pixelfed/pixelfed/commit/50ab2e20))
|
||||
- Redesigned Admin Dashboard Reports/Moderation ([c6cc6327](https://github.com/pixelfed/pixelfed/commit/c6cc6327))
|
||||
|
||||
### Fixes
|
||||
- Fixed `violates check constraint "statuses_visibility_check"` bug affecting postgres instances + various api endpoints ([79b6a17e](https://github.com/pixelfed/pixelfed/commit/79b6a17e))
|
||||
- Fixed duplicate hashtags on postgres ([64059cb4](https://github.com/pixelfed/pixelfed/commit/64059cb4))
|
||||
|
||||
### Updates
|
||||
- Update ApiV1Controller, fix blocking remote accounts. Closes #4256 ([8e71e0c0](https://github.com/pixelfed/pixelfed/commit/8e71e0c0))
|
||||
- Update ComposeController, fix postgres location search. Closes #4242 and #4239 ([64a4a006](https://github.com/pixelfed/pixelfed/commit/64a4a006))
|
||||
|
@ -37,6 +41,9 @@
|
|||
- Update ForgotPasswordController, add captcha support, improve security and a new redesigned view ([f6e7ff64](https://github.com/pixelfed/pixelfed/commit/f6e7ff64))
|
||||
- Update ResetPasswordController, add captcha support, improve security and a new redesigned view ([0ab5b96a](https://github.com/pixelfed/pixelfed/commit/0ab5b96a))
|
||||
- Update Inbox, remove handleCreateActivity logic that rejected posts from accounts without followers ([a93a3efd](https://github.com/pixelfed/pixelfed/commit/a93a3efd))
|
||||
- Update ApiV1Controller and DiscoverController, fix postgres hashtag search ([055aa6b3](https://github.com/pixelfed/pixelfed/commit/055aa6b3))
|
||||
- Update StatusTagsPipeline, deduplicate hashtags on postgres ([867cbc75](https://github.com/pixelfed/pixelfed/commit/867cbc75))
|
||||
- Update SearchApiV2Service, fix postgres hashtag search and prepend wildcard operator to improve results ([6e20d0a6](https://github.com/pixelfed/pixelfed/commit/6e20d0a6))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.5 (2023-03-25)](https://github.com/pixelfed/pixelfed/compare/v0.11.4...v0.11.5)
|
||||
|
|
|
@ -3245,9 +3245,15 @@ class ApiV1Controller extends Controller
|
|||
'limit' => 'nullable|integer|max:100'
|
||||
]);
|
||||
|
||||
$tag = Hashtag::whereName($hashtag)
|
||||
->orWhere('slug', $hashtag)
|
||||
->first();
|
||||
if(config('database.default') === 'pgsql') {
|
||||
$tag = Hashtag::where('name', 'ilike', $hashtag)
|
||||
->orWhere('slug', 'ilike', $hashtag)
|
||||
->first();
|
||||
} else {
|
||||
$tag = Hashtag::whereName($hashtag)
|
||||
->orWhere('slug', $hashtag)
|
||||
->first();
|
||||
}
|
||||
|
||||
if(!$tag) {
|
||||
return response()->json([]);
|
||||
|
|
|
@ -61,7 +61,12 @@ class DiscoverController extends Controller
|
|||
$end = $page > 1 ? $page * 9 : 0;
|
||||
$tag = $request->input('hashtag');
|
||||
|
||||
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
||||
if(config('database.default') === 'pgsql') {
|
||||
$hashtag = Hashtag::where('name', 'ilike', $tag)->firstOrFail();
|
||||
} else {
|
||||
$hashtag = Hashtag::whereName($tag)->firstOrFail();
|
||||
}
|
||||
|
||||
if($hashtag->is_banned == true) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -71,11 +71,24 @@ class StatusTagsPipeline implements ShouldQueue
|
|||
}
|
||||
}
|
||||
|
||||
$hashtag = Hashtag::firstOrCreate([
|
||||
'slug' => str_slug($name)
|
||||
], [
|
||||
'name' => $name
|
||||
]);
|
||||
if(config('database.default') === 'pgsql') {
|
||||
$hashtag = Hashtag::where('name', 'ilike', $name)
|
||||
->orWhere('slug', 'ilike', str_slug($name))
|
||||
->first();
|
||||
|
||||
if(!$hashtag) {
|
||||
$hashtag = new Hashtag;
|
||||
$hashtag->name = $name;
|
||||
$hashtag->slug = str_slug($name);
|
||||
$hashtag->save();
|
||||
}
|
||||
} else {
|
||||
$hashtag = Hashtag::firstOrCreate([
|
||||
'slug' => str_slug($name)
|
||||
], [
|
||||
'name' => $name
|
||||
]);
|
||||
}
|
||||
|
||||
StatusHashtag::firstOrCreate([
|
||||
'status_id' => $status->id,
|
||||
|
|
|
@ -125,8 +125,10 @@ class SearchApiV2Service
|
|||
$q = $this->query->input('q');
|
||||
$limit = $this->query->input('limit') ?? 20;
|
||||
$offset = $this->query->input('offset') ?? 0;
|
||||
$query = Str::startsWith($q, '#') ? substr($q, 1) . '%' : $q . '%';
|
||||
return Hashtag::where('name', 'like', $query)
|
||||
$query = Str::startsWith($q, '#') ? '%' . substr($q, 1) . '%' : '%' . $q . '%';
|
||||
$operator = config('database.default') === 'pgsql' ? 'ilike' : 'like';
|
||||
return Hashtag::where('name', $operator, $query)
|
||||
->orWhere('slug', $operator, $query)
|
||||
->where(function($q) {
|
||||
return $q->where('can_search', true)
|
||||
->orWhereNull('can_search');
|
||||
|
|
|
@ -261,10 +261,10 @@ return [
|
|||
'enabled' => env('PF_BOUNCER_ENABLED', false),
|
||||
|
||||
'cloud_ips' => [
|
||||
'ban_logins' => env('PF_BOUNCER_BAN_CLOUD_LOGINS', true),
|
||||
'ban_signups' => env('PF_BOUNCER_BAN_CLOUD_SIGNUPS', true),
|
||||
'ban_api' => env('PF_BOUNCER_BAN_CLOUD_API', true),
|
||||
'ban_api_strict_mode' => env('PF_BOUNCER_BAN_CLOUD_API_STRICT_MODE', true),
|
||||
'ban_logins' => env('PF_BOUNCER_BAN_CLOUD_LOGINS', false),
|
||||
'ban_signups' => env('PF_BOUNCER_BAN_CLOUD_SIGNUPS', false),
|
||||
'ban_api' => env('PF_BOUNCER_BAN_CLOUD_API', false),
|
||||
'ban_api_strict_mode' => env('PF_BOUNCER_BAN_CLOUD_API_STRICT_MODE', false),
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use App\Hashtag;
|
||||
use App\StatusHashtag;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$type = config('database.default');
|
||||
|
||||
if($type !== 'pgsql') {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(Hashtag::lazyById(50, 'id') as $tag) {
|
||||
$dups = Hashtag::where('name', 'ilike', $tag->name)->orderBy('id')->get();
|
||||
if($dups->count() === 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$first = $dups->shift();
|
||||
$dups->each(function($dup) use($first) {
|
||||
StatusHashtag::whereHashtagId($dup->id)->update(['hashtag_id' => $first->id]);
|
||||
$dup->delete();
|
||||
});
|
||||
}
|
||||
|
||||
Cache::clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue