fix project license getting set to custom

This commit is contained in:
Jake Potrebic 2021-12-20 00:29:39 -08:00
parent 841f90d417
commit b5fa43b093
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
6 changed files with 11 additions and 7 deletions

View File

@ -19,6 +19,7 @@
<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator';
import { Announcement as AnnouncementObject } from 'hangar-api';
import Header from '~/components/layouts/Header.vue';
import Footer from '~/components/layouts/Footer.vue';
import Announcement from '~/components/layouts/Announcement.vue';
@ -36,10 +37,10 @@ import DonationResult from '~/components/donation/DonationResult.vue';
})
export default class DefaultLayout extends Vue {
title = 'Hangar';
announcements: Announcement[] = [];
announcements: AnnouncementObject[] = [];
async fetch() {
this.announcements = await this.$api.requestInternal<Announcement[]>('data/announcements', false).catch<any>(this.$util.handlePageRequestError);
this.announcements = await this.$api.requestInternal<AnnouncementObject[]>('data/announcements', false).catch<any>(this.$util.handlePageRequestError);
}
}
</script>

View File

@ -67,7 +67,7 @@ import { ProjectChannel } from 'hangar-internal';
import { Context } from '@nuxt/types';
import { HangarProjectMixin } from '~/components/mixins';
import Tag from '~/components/Tag.vue';
import ChannelModal from '~/components/modals/ChannelModal.vue';
import ChannelModal from '~/components/modals/projects/ChannelModal.vue';
import { ProjectPermission } from '~/utils/perms';
import { NamedPermission } from '~/types/enums';

View File

@ -304,7 +304,7 @@
</v-col>
</v-row>
</div>
<v-divider />
<v-divider v-if="$perms.canHardDeleteProject" />
<div v-if="$perms.canHardDeleteProject" class="error darken-4">
<!-- TODO striped background to separate from normal delete-->
<h2>{{ $t('project.settings.hardDelete') }}</h2>
@ -378,7 +378,6 @@
prepend-inner-icon="mdi-file-word-box"
/>
</div>
<v-divider />
</v-form>
</v-tab-item>
</v-tabs>
@ -660,5 +659,6 @@ h2 {
.v-window-item {
padding-left: 10px;
padding-right: 10px;
}
</style>

View File

@ -189,7 +189,7 @@ import { HangarProjectMixin } from '~/components/mixins';
import { ProjectPermission } from '~/utils/perms';
import { NamedPermission, Platform } from '~/types/enums';
import { MarkdownEditor } from '~/components/markdown';
import ChannelModal from '~/components/modals/ChannelModal.vue';
import ChannelModal from '~/components/modals/projects/ChannelModal.vue';
import { RootState } from '~/store';
import DependencyTable from '~/components/modals/versions/DependencyTable.vue';

View File

@ -19,7 +19,10 @@ public class ProjectLicense {
@JdbiConstructor
public ProjectLicense(@Nullable String name, @Nullable String url) {
int index = config.getLicenses().indexOf(name);
if (name != null && index > -1 && index < config.getLicenses().size() - 1) {
if (name == null) {
this.type = null;
this.name = null;
} else if (index > -1 && index < config.getLicenses().size() - 1) {
this.name = null;
this.type = name;
} else {