Remove COVID label feature flag and related code

Remove ENABLE_COVID_LABEL, COVID_LABEL_URL, and COVID_LABEL_ORG env
vars and all associated backend/frontend code:

- config/instance.php: remove label.covid config block
- StatusLabelService: remove keyword matching, return static false
- Site/Config.php: remove label.covid from API response
- StatusCard.vue: remove COVID banner and labelRedirect method
- GroupStatus.vue: remove COVID banner and labelRedirect method
- diagnostics blade: remove COVID diagnostic rows
pull/6576/head
Your Name 5 months ago
parent 0a41c9e387
commit 41089fcccd

@ -3,31 +3,13 @@
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']),
];
});
return [
'covid' => false,
];
}
}

@ -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'),
],

@ -83,14 +83,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;

@ -604,21 +604,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