Merge pull request #6576 from shleeable/covidremove

Clean up Covid/WHO
pull/6578/head^2
dansup 1 month ago committed by GitHub
commit ec38262338
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,33 +0,0 @@
<?php
namespace App\Services;
use App\Status;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
class StatusLabelService
{
const CACHE_KEY = 'pf:services:status_label:_v0:';
public static function get(Status $status)
{
if (config('instance.label.covid.enabled') == false || ! $status) {
return [
'covid' => false,
];
}
return Cache::remember(self::CACHE_KEY.$status->id, now()->addDays(7), function () use ($status) {
if (! $status->caption) {
return [
'covid' => false,
];
}
return [
'covid' => Str::of(strtolower($status->caption))->contains(['covid', 'corona', 'coronavirus', 'vaccine', 'vaxx', 'vaccination', 'plandemic']),
];
});
}
}

@ -119,7 +119,6 @@ class StatusService
$status['comments_disabled'],
$status['content_text'],
$status['gid'],
$status['label'],
$status['liked_by'],
$status['local'],
$status['parent'],

@ -10,7 +10,6 @@ use App\Services\MediaService;
use App\Services\MediaTagService;
use App\Services\PollService;
use App\Services\StatusHashtagService;
use App\Services\StatusLabelService;
use App\Services\StatusMentionService;
use App\Services\StatusService;
use App\Status;
@ -62,7 +61,6 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
'place' => $status->place,
'local' => (bool) $status->local,
'taggedPeople' => $taggedPeople,
'label' => StatusLabelService::get($status),
'liked_by' => LikeService::likedBy($status),
'media_attachments' => MediaService::get($status->id),
'account' => AccountService::get($status->profile_id, true),

@ -11,7 +11,6 @@ use App\Services\MediaTagService;
use App\Services\PollService;
use App\Services\ProfileService;
use App\Services\StatusHashtagService;
use App\Services\StatusLabelService;
use App\Services\StatusMentionService;
use App\Services\StatusService;
use App\Status;
@ -63,7 +62,6 @@ class StatusTransformer extends Fractal\TransformerAbstract
'place' => $status->place,
'local' => (bool) $status->local,
'taggedPeople' => $taggedPeople,
'label' => StatusLabelService::get($status),
'liked_by' => LikeService::likedBy($status),
'media_attachments' => MediaService::get($status->id),
'account' => ProfileService::get($status->profile_id, true),

@ -92,13 +92,6 @@ class Config
'mastodon' => false,
'pixelfed' => false,
],
'label' => [
'covid' => [
'enabled' => (bool) config('instance.label.covid.enabled'),
'org' => config('instance.label.covid.org'),
'url' => config('instance.label.covid.url'),
],
],
'hls' => $hls,
'groups' => (bool) config('groups.enabled'),
],

@ -80,14 +80,6 @@ return [
],
],
'label' => [
'covid' => [
'enabled' => env('ENABLE_COVID_LABEL', true),
'url' => env('COVID_LABEL_URL', 'https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public'),
'org' => env('COVID_LABEL_ORG', 'visit the WHO website'),
],
],
'enable_cc' => env('ENABLE_CONFIG_CACHE', true),
'has_legal_notice' => env('INSTANCE_LEGAL_NOTICE', false),

@ -225,18 +225,6 @@
</div>
<div v-if="config.features.label.covid.enabled && status.label && status.label.covid == true" class="card-body border-top border-bottom py-2 cursor-pointer pr-2" @click="labelRedirect()">
<p class="font-weight-bold d-flex justify-content-between align-items-center mb-0">
<span>
<i class="fas fa-info-circle mr-2"></i>
For information about COVID-19, {{config.features.label.covid.org}}
</span>
<span>
<i class="fas fa-chevron-right text-lighter"></i>
</span>
</p>
</div>
<div class="card-body">
<div v-if="reactionBar" class="reactions my-1 pb-2">
<h3 v-if="status.favourited" class="fas fa-heart text-danger pr-3 m-0 cursor-pointer" title="Like" v-on:click="likeStatus(status, $event);"></h3>
@ -708,11 +696,6 @@
window.location.href = status.media_attachments[0].url;
},
labelRedirect(type) {
let url = '/i/redirect?url=' + encodeURI(this.config.features.label.covid.url);
window.location.href = url;
},
likeStatus(status, event) {
event.currentTarget.blur();
let count = status.favourites_count;

@ -109,18 +109,6 @@
</div>
<div v-if="config.features.label.covid.enabled && status.label && status.label.covid == true" class="card-body border-top border-bottom py-2 cursor-pointer pr-2" @click="labelRedirect()">
<p class="font-weight-bold d-flex justify-content-between align-items-center mb-0">
<span>
<i class="fas fa-info-circle mr-2"></i>
For information about COVID-19, {{config.features.label.covid.org}}
</span>
<span>
<i class="fas fa-chevron-right text-lighter"></i>
</span>
</p>
</div>
<div class="card-body">
<div v-if="reactionBar" class="reactions my-1 pb-2">
<h3 v-if="status.favourited" class="fas fa-heart text-danger pr-3 m-0 cursor-pointer" title="Like" v-on:click="likeStatus(status, $event);"></h3>
@ -311,11 +299,6 @@
window.location.href = status.media_attachments[0].url;
},
labelRedirect(type) {
let url = '/i/redirect?url=' + encodeURI(this.config.features.label.covid.url);
window.location.href = url;
},
likeStatus(status, event) {
if($('body').hasClass('loggedIn') == false) {
return;

@ -599,21 +599,6 @@
<td><strong>OAUTH_PAT_ID</strong></td>
<td><span>"{{config_cache('instance.oauth.pat.id')}}"</span></td>
</tr>
<tr>
<td><span class="badge badge-primary">INSTANCE</span></td>
<td><strong>ENABLE_COVID_LABEL</strong></td>
<td><span>{{config_cache('instance.label.covid.enabled') ? '✅ true' : '❌ false' }}</span></td>
</tr>
<tr>
<td><span class="badge badge-primary">INSTANCE</span></td>
<td><strong>COVID_LABEL_URL</strong></td>
<td><span>"{{config_cache('instance.label.covid.url')}}"</span></td>
</tr>
<tr>
<td><span class="badge badge-primary">INSTANCE</span></td>
<td><strong>COVID_LABEL_ORG</strong></td>
<td><span>"{{config_cache('instance.label.covid.org')}}"</span></td>
</tr>
<tr>
<td><span class="badge badge-primary">INSTANCE</span></td>
<td><strong>ENABLE_CONFIG_CACHE</strong></td>

Loading…
Cancel
Save