No magic literal

This commit is contained in:
Chongyi Zheng 2023-08-24 01:09:52 -04:00
parent 36c2378ace
commit 35ab3bb1d2
No known key found for this signature in database
GPG Key ID: E3C2287691E40E35
1 changed files with 4 additions and 2 deletions

View File

@ -11,6 +11,9 @@ const $lfsSettings = $('#lfs_settings');
const $lfsEndpoint = $('#lfs_endpoint');
const $items = $('#migrate_items').find('input[type=checkbox]');
// services that supports migration items with mirroring
const allowedServiceTypes = [2]; // 2 = GitHub service type
export function initRepoMigration() {
checkAuth();
setLFSSettingsVisibility();
@ -45,8 +48,7 @@ function checkItems(tokenAuth) {
enableItems = $user.val() !== '' || $pass.val() !== '';
}
if (enableItems && $service.val() > 1) {
const allowedServices = [2]; // services that supports migration items with mirroring
if ($mirror.is(':checked') && !allowedServices.includes(Number($service.val()))) {
if ($mirror.is(':checked') && !allowedServiceTypes.includes(Number($service.val()))) {
$items.not('[name="wiki"]').attr('disabled', true);
$items.filter('[name="wiki"]').attr('disabled', false);
return;