Things, set versions to public on upload

This commit is contained in:
Nassim Jahnke 2022-05-25 17:05:08 +02:00
parent aaa89da4f3
commit 4486bc6026
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
5 changed files with 7 additions and 9 deletions

View File

@ -26,7 +26,6 @@ const ccColor = computed(() => {
let background = cColor.value?.background;
let colors: number[] = [];
if (background?.startsWith("rgb")) {
console.log("background", background);
colors = background
?.replace("rgb(", "")
.replace(")", "")
@ -68,7 +67,7 @@ const ccColor = computed(() => {
>
{{ shortForm && cData ? cData : cName }}
</span>
<span v-if="cData && !shortForm" class="tag flex bg-gray-100 rounded px-2 py-1">{{ cData }}</span>
<span v-if="cData && !shortForm" class="tag flex bg-gray-100 rounded px-2 py-1 text-black">{{ cData }}</span>
</div>
</template>

View File

@ -178,7 +178,7 @@ async function restoreVersion() {
<div v-if="projectVersion" class="flex flex-wrap md:flex-nowrap gap-4">
<section class="basis-full md:basis-8/12 flex-grow">
<Alert v-if="requiresConfirmation" class="mb-8" type="danger">{{ i18n.t("version.page.unsafeWarning") }}</Alert>
<Alert v-if="requiresConfirmation" class="mb-8" type="info">{{ i18n.t("version.page.unsafeWarning") }}</Alert>
<Card>
<MarkdownEditor
v-if="hasPerms(NamedPermission.EDIT_VERSION)"

View File

@ -119,10 +119,8 @@ export const useSettingsStore = defineStore("settings", () => {
addEventListener("resize", () => {
if (innerWidth <= mobileBreakPoint && !mobile.value) {
enableMobile();
console.log(`Mobile: ${mobile.value}`);
} else if (innerWidth > mobileBreakPoint && mobile) {
disableMobile();
console.log(`Mobile: ${mobile.value}`);
}
});
}

View File

@ -23,8 +23,8 @@ public interface ProjectVersionsDAO {
@Timestamped
@GetGeneratedKeys
@SqlUpdate("INSERT INTO project_versions " +
"(created_at, version_string, description, project_id, channel_id, file_size, hash, file_name, external_url, author_id, create_forum_post) VALUES " +
"(:now, :versionString, :description, :projectId, :channelId, :fileSize, :hash, :fileName, :externalUrl, :authorId, :createForumPost)")
"(created_at, version_string, description, project_id, channel_id, file_size, hash, file_name, external_url, author_id, visibility, create_forum_post) VALUES " +
"(:now, :versionString, :description, :projectId, :channelId, :fileSize, :hash, :fileName, :externalUrl, :authorId, :visibility, :createForumPost)")
ProjectVersionTable insert(@BindBean ProjectVersionTable projectVersionTable);
@GetGeneratedKeys

View File

@ -219,6 +219,7 @@ public class VersionFactory extends HangarComponent {
fileHash = pendingVersion.getFileInfo().getMd5Hash();
fileName = pendingVersion.getFileInfo().getName();
}
//TODO automatic checks for malicious code or files => set visibility to NEEDSAPPROVAL
projectVersionTable = projectVersionsDAO.insert(new ProjectVersionTable(
pendingVersion.getVersionString(),
pendingVersion.getDescription(),
@ -234,7 +235,7 @@ public class VersionFactory extends HangarComponent {
List<ProjectVersionTagTable> projectVersionTagTables = new ArrayList<>();
List<ProjectVersionPlatformDependencyTable> platformDependencyTables = new ArrayList<>();
for (var entry : pendingVersion.getPlatformDependencies().entrySet()) {
for (Map.Entry<Platform, SortedSet<String>> entry : pendingVersion.getPlatformDependencies().entrySet()) {
projectVersionTagTables.add(new ProjectVersionTagTable(projectVersionTable.getId(), entry.getKey(), entry.getValue()));
for (String version : entry.getValue()) {
PlatformVersionTable platformVersionTable = platformVersionDAO.getByPlatformAndVersion(entry.getKey(), version);
@ -245,7 +246,7 @@ public class VersionFactory extends HangarComponent {
projectVersionPlatformDependenciesDAO.insertAll(platformDependencyTables);
List<ProjectVersionDependencyTable> pluginDependencyTables = new ArrayList<>();
for (var platformListEntry : pendingVersion.getPluginDependencies().entrySet()) {
for (Map.Entry<Platform, Set<PluginDependency>> platformListEntry : pendingVersion.getPluginDependencies().entrySet()) {
for (PluginDependency pluginDependency : platformListEntry.getValue()) {
Long depProjectId = null;
if (pluginDependency.getNamespace() != null) {