the browser-facing portion of osu!
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixes

Venix 87dc8400 f7af4bff

+42 -4
+7 -4
app/Libraries/ChatFilters.php
··· 23 23 public function fetch() 24 24 { 25 25 $localCacheVersion = cache()->get('chat_filters_local_cache_version'); 26 - $localStorage = config('cache.local'); 26 + $localCache = cache()->store(config('cache.local')); 27 27 28 28 if ($localCacheVersion === null) { 29 29 $localCacheVersion = hrtime(true); 30 30 cache()->forever('chat_filters_local_cache_version', $localCacheVersion); 31 31 } 32 32 33 - $localCacheKey = "chat_filters:v{$localCacheVersion}"; 34 - $this->chatFilters = cache()->store($localStorage)->get($localCacheKey); 33 + $cachedFilters = $localCache->get('chat_filters'); 34 + 35 + if ($cachedFilters['version'] === $localCacheVersion) { 36 + $this->chatFilters = $cachedFilters['data']; 37 + } 35 38 36 39 if ($this->chatFilters === null) { 37 40 $this->chatFilters = ChatFilter::all(); 38 - cache()->store($localStorage)->forever($localCacheKey, $this->chatFilters); 41 + $localCache->forever('chat_filters', ['version' => $localCacheVersion, 'data' => $this->chatFilters]); 39 42 } 40 43 } 41 44
+35
database/migrations/2021_06_03_115603_create_chat_filters_table.php
··· 1 + <?php 2 + 3 + // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4 + // See the LICENCE file in the repository root for full licence text. 5 + 6 + use Illuminate\Database\Migrations\Migration; 7 + use Illuminate\Database\Schema\Blueprint; 8 + use Illuminate\Support\Facades\Schema; 9 + 10 + class CreateChatFiltersTable extends Migration 11 + { 12 + /** 13 + * Run the migrations. 14 + * 15 + * @return void 16 + */ 17 + public function up() 18 + { 19 + Schema::create('chat_filters', function (Blueprint $table) { 20 + $table->bigIncrements('id'); 21 + $table->string('match')->unique(); 22 + $table->string('replacement'); 23 + }); 24 + } 25 + 26 + /** 27 + * Reverse the migrations. 28 + * 29 + * @return void 30 + */ 31 + public function down() 32 + { 33 + Schema::dropIfExists('chat_filters'); 34 + } 35 + }