Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/app/components/site/a-user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const userColor = computed(() => {

const neededGap = computed(() => {
if (props.avatar) {
return props.avatarSize == 'xs' ? 1 : 2;
return props.avatarSize === 'xs' ? 1 : 2;
}
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/site/category-tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const queryDelayed = refDebounced(queryVm, 250);
const lowSearch = computed(() => queryDelayed.value.toLocaleLowerCase());

const currentCategoryId = props.setQuery ? useRouteQuery('category') : useVModel(props);
const selected = computed(() => props.category?.id == parseInt(currentCategoryId.value));
const selected = computed(() => props.category?.id === parseInt(currentCategoryId.value));
const classes = computed(() => ({ 'cursor-pointer': true, 'tree-button': true, 'selected': selected.value }));

const open = ref(!props.category);
Expand Down Expand Up @@ -115,7 +115,7 @@ function hasDescendantSelected(category: Category, current: Category[] | null =
}

function onClickCategory(category: Category) {
if (parseInt(currentCategoryId.value) == category.id) {
if (parseInt(currentCategoryId.value) === category.id) {
currentCategoryId.value = null;
open.value = false;
} else {
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/components/site/list-comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const replies = computed(() => props.fetchReplies ? fetchedReplies.value : new P

const isAnswer = computed(() => {
return props.commentable && Object.hasOwn(props.commentable, 'answer_comment_id')
&& (props.commentable as Thread)?.answer_comment_id == props.comment.id;
&& (props.commentable as Thread)?.answer_comment_id === props.comment.id;
});

watch(replies, val => {
Expand All @@ -159,7 +159,7 @@ watch(replies, val => {

if (props.comment.mentions) {
content.value = content.value.replace(/<@([0-9]+)>/g, (match, id) => {
const user = props.comment.mentions.find(user => user.id == id);
const user = props.comment.mentions.find(user => user.id === id);

if (user) {
return `@${user.unique_name}`;
Expand Down Expand Up @@ -191,7 +191,7 @@ const canDelete = computed(() => {
const canReply = computed(() => props.canComment && !props.comment.user?.blocked_me);

const classes = computed(() => {
const focus = focusComment.value == props.comment.id || (props.currentFocus && props.currentFocus.id == props.comment.id);
const focus = (focusComment.value && parseInt(focusComment.value) === props.comment.id) || (props.currentFocus && props.currentFocus.id === props.comment.id);
return {
comment: true,
reply: props.isReply,
Expand All @@ -211,7 +211,7 @@ const commentPage = computed(() => {
});

onMounted(() => {
if ((focusComment.value == props.comment?.id) || params.comment) {
if ((focusComment.value && focusComment.value === props.comment.id) || params.comment) {
const element: HTMLDivElement = contentBlockRef.value.element;

if (element) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/site/list-notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const to = computed(() => {
} else {
let obj, objType;

if (defintion.value.link_object == 'context') {
if (defintion.value.link_object === 'context') {
obj = context.value;
objType = notif.value.context_type;
} else {
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/site/md-content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mdText = computed(() => {
return '';
}

if (parserVersion == 1) {
if (parserVersion === 1) {
return oldParseMarkdown(text, allowAnchors);
} else {
return parseMarkdown(text, allowAnchors, removeTags);
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/site/md-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function clickTool(tool: Tool) {
inserted = '';
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (i != 0) {
if (i !== 0) {
inserted += '\n';
}

Expand All @@ -103,7 +103,7 @@ function clickTool(tool: Tool) {
}

function onKeyDown(e: KeyboardEvent) {
if (e.key == 'Tab') {
if (e.key === 'Tab') {
e.preventDefault();
clickTool({
insert: '\t$',
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/site/mod/grid-mod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const { mod, game, static: isStatic, noGame, sort } = defineProps<{
const i18n = useI18n();
const locale = computed(() => i18n.locale.value);
const showGame = computed(() => !noGame && mod.game);
const date = computed(() => sort == 'published_at' ? mod.published_at : mod.bumped_at);
const date = computed(() => sort === 'published_at' ? mod.published_at : mod.bumped_at);
const likes = computed(() => shortStat(mod.likes));
const downloads = computed(() => shortStat(mod.downloads));
const views = computed(() => shortStat(mod.views));
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/site/mod/list-mod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const { mod, noGame, displayMode = 1, sort } = defineProps<{
}>();

const showGame = computed(() => !noGame && mod.game);
const date = computed(() => sort == 'published_at' ? mod.published_at : mod.bumped_at);
const date = computed(() => sort === 'published_at' ? mod.published_at : mod.bumped_at);
const gameUrl = computed(() => `/g/${store.currentGame?.short_name || mod.game?.short_name || mod.game?.id}`);
const locale = computed(() => useI18n().locale.value);
const tags = computed(() => {
Expand Down
7 changes: 5 additions & 2 deletions frontend/app/components/site/mod/mod-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const selectedCategory = useRouteQuery('category');

const sortByQuery = useRouteQuery('sort');
const sortBy = computed(() => sortByQuery.value ?? props.defaultSortBy ?? user?.extra?.default_mods_sort ?? 'bumped_at');
const sortByPopularity = computed(() => sortBy.value == 'daily_score' || sortBy.value == 'weekly_score' || sortBy.value == 'score');
const sortByPopularity = computed(() => sortBy.value === 'daily_score' || sortBy.value === 'weekly_score' || sortBy.value === 'score');
const sortByOtherOptions = { best_match: true, random: true, likes: true, downloads: true, views: true, name: true };
const sortByOther = computed(() => sortByOtherOptions[sortBy.value] === true);

Expand Down Expand Up @@ -221,6 +221,9 @@ const currentDisplayCats = computed(() => {
const cats: Category[] = [];

for (const cat of currCategories.value) {
// TODO: fix this equality check
// null (cat.parent_id) == undefined (selectedCategory.value) is true, so it may break if simply replacing with ===
// eslint-disable-next-line eqeqeq
if (cat.parent_id == selectedCategory.value) {
cats.push(cat);
}
Expand Down Expand Up @@ -257,7 +260,7 @@ watch(loadMorePageOverride, newVal => {
savedMods.value = currentMods.value;
fetchedMods.value = undefined;

loading.value = savedMods.value.length == 0;
loading.value = savedMods.value.length === 0;
planLoad();
}
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/site/mod/mod-row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const props = withDefaults(defineProps<{
}>(), { displayMode: 1, lite: false });

const showGame = computed(() => !props.noGame && props.mod.game);
const date = computed(() => props.sort == 'published_at' ? props.mod.published_at : props.mod.bumped_at);
const date = computed(() => props.sort === 'published_at' ? props.mod.published_at : props.mod.bumped_at);
const likes = computed(() => props.mod.likes);
const downloads = computed(() => props.mod.downloads);
const views = computed(() => props.mod.views);
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/components/site/mod/mod-status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const status = computed<[Component, string, string?] | null>(() => {
return [MdiCloseThick, 'mod_rejected', 'text-danger'];
} else if (!mod.has_download) {
return [MdiDownloadOff, 'no_downloads', 'text-warning'];
} else if (mod.visibility == 'public' && !mod.published_at) {
} else if (mod.visibility === 'public' && !mod.published_at) {
return [MdiNewspaperRemove, 'not_published', 'text-warning'];
} else if (mod.visibility == 'unlisted') {
} else if (mod.visibility === 'unlisted') {
return [MdiEyeOff, 'unlisted'];
} else if (mod.visibility == 'private') {
} else if (mod.visibility === 'private') {
return [MdiLock, 'private'];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const name = computed(() => {
return null;
}

if (typeof props.object == 'string') {
if (typeof props.object === 'string') {
return props.object;
}

Expand All @@ -35,7 +35,7 @@ const name = computed(() => {
const typeHint = computed(() => {
const n = name.value;

if (typeof props.object == 'string') {
if (typeof props.object === 'string') {
return null;
}

Expand All @@ -45,5 +45,5 @@ const typeHint = computed(() => {
}
});

const link = computed(() => typeof props.object == 'object' ? getObjectLink(props.type, props.object) : null);
const link = computed(() => typeof props.object === 'object' ? getObjectLink(props.type, props.object) : null);
</script>
8 changes: 4 additions & 4 deletions frontend/app/components/site/pages/admin/admin-audit-log.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ useI18n({
});

const custom = computed(() => {
if (log.type == 'ban') {
if (log.type === 'ban') {
return log.data.with.expire_date ? `until ${log.data.with.expire_date}` : 'permanently';
} else if (log.type == 'mod_approve_status') {
} else if (log.type === 'mod_approve_status') {
return log.data.status ? 'approved' : 'rejected';
} else if (log.type == 'mod_suspend_status') {
} else if (log.type === 'mod_suspend_status') {
return log.data.status ? 'suspended' : 'unsuspended';
}
});

const customDetails = computed(() => {
if (log.type == 'mod_approve_status' || log.type == 'mod_suspend_status') {
if (log.type === 'mod_approve_status' || log.type === 'mod_suspend_status') {
return 'Reason: ' + log.data.reason;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const { data: modManagers } = await useFetchMany<ModManager>(mmUrl, {
}
});

const globalModManagers = computed(() => modManagers.value?.data.filter(mm => mm.game_id == null));
const globalModManagers = computed(() => modManagers.value?.data.filter(mm => mm.game_id === undefined));

const mergeParams = reactive({
thumbnail_file: thumbnailBlob,
Expand Down
8 changes: 4 additions & 4 deletions frontend/app/components/site/pages/admin/admin-report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const store = useStore();
const { t } = useI18n();
const casesUrl = computed(() => getGameResourceUrl('cases', game));
const contentTitle = computed(() => {
if (report.reportable_type == 'mod' || report.reportable_type == 'user') {
if (report.reportable_type === 'mod' || report.reportable_type === 'user') {
return t('name');
} else {
return t('content');
Expand All @@ -51,15 +51,15 @@ const currentContent = computed(() => {
if (!report.reportable) {
return;
}
if (report.reportable_type == 'mod' || report.reportable_type == 'user') {
if (report.reportable_type === 'mod' || report.reportable_type === 'user') {
return (report.reportable as Mod | User).name;
} else {
return (report.reportable as Comment).content;
}
});

const content = computed(() => {
if (report.reportable_type == 'mod' || report.reportable_type == 'user') {
if (report.reportable_type === 'mod' || report.reportable_type === 'user') {
return report.name;
} else {
return report.data.content;
Expand All @@ -71,7 +71,7 @@ const reportedUser = computed(() => {
return;
}

if (report.reportable_type == 'user') {
if (report.reportable_type === 'user') {
return report.reportable as User;
} else {
return (report.reportable as { id: number; user: User }).user;
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/site/pages/edit-mod-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const store = useStore();

const initialMod = defineModel<Mod>('mod', { required: true });

if (initialMod.value.id == 0) {
if (initialMod.value.id === 0) {
initialMod.value.user_id = store.user!.id;
initialMod.value.user = store.user!;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function addDependency(onError) {
dep.mod = selectedMod.value;
}
try {
if (dep.id == -1) {
if (dep.id === -1) {
if (props.paused) {
currentDep.value!.id = 0;
dependencies.value.push(currentDep.value!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const { t } = useI18n();

const superUpdate = inject<boolean>('canSuperUpdate');

const member = computed(() => user ? mod.value.members.find(member => member.id == user.id) : null);
const member = computed(() => user ? mod.value.members.find(member => member.id === user.id) : null);
const canDelete = computed(() => superUpdate || member.value?.level === 'maintainer');

watch(() => mod.value.game_id, () => mod.value.category_id = undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function fileDeleted(file: MWSFile) {
mod.value.used_storage -= file.size;
}

if (files.value.length == 0) {
if (files.value.length === 0) {
filesPage.value = 1;
refreshFiles();
}
Expand All @@ -373,7 +373,7 @@ async function deleteLink(link: Link) {
remove(links.value, link);
updateHasDownload();

if (links.value.length == 0) {
if (links.value.length === 0) {
linksPage.value = 1;
refreshLinks();
}
Expand All @@ -397,7 +397,7 @@ async function saveEditLink(error) {

try {
if (link) {
if (link.id == -1) {
if (link.id === -1) {
if (mod.value.id) {
const newLink = await postRequest<Link>(`mods/${mod.value.id}/links`, link);
links.value.push(newLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ async function setImageOrder(img: Image, order: number) {
await patchRequest(`images/${img.id}`, { display_order: img.display_order + order });
img.display_order = img.display_order + order;

// TODO: fix this equality check
// I don't know this filter is working correctly...
// eslint-disable-next-line eqeqeq
images.value = images.value.filter(v => v != img);
images.value.splice(img.display_order, 0, img);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const levelOptions = computed(() => {
levels.push({ name: t('member_level_maintainer'), id: 'maintainer' });
}

if (superUpdate || member.value?.level == 'maintainer') {
if (superUpdate || member.value?.level === 'maintainer') {
levels.push({ name: t('member_level_collaborator'), id: 'collaborator' });
}

Expand All @@ -116,7 +116,7 @@ const addingNew = ref(false);
const showTransferOwner = ref(false);
const members = ref<ModMember[]>(clone(mod.value.members));
const transferOwner = ref({ owner_id: null, keep_owner_level: null });
const member = computed(() => user ? mod.value.members.find(member => member.id == user.id) : null);
const member = computed(() => user ? mod.value.members.find(member => member.id === user.id) : null);

const selectedUser = ref<User>();
const selectedLevel = ref<'collaborator' | 'maintainer' | 'contributor' | 'viewer'>('collaborator');
Expand Down Expand Up @@ -210,7 +210,7 @@ async function cancelTransferRequest() {
}

function canEditMember(member: ModMember) {
return (user && member.id == user.id) || (memberPerms.value ? memberPerms.value.includes(member.level) : false);
return (user && member.id === user.id) || (memberPerms.value ? memberPerms.value.includes(member.level) : false);
}
</script>

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/site/pages/mod-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if (mod.value.game) {
if (mod.value.id && import.meta.client) {
postRequest(`mods/${mod.value.id}/register-view`, null, {
onResponse(response: any) {
if (response.status == 201) {
if (response.status === 201) {
mod.value.views++;
}
}
Expand All @@ -72,7 +72,7 @@ const breadcrumb = computed(() => {
breadcrumb.push(...mod.value.breadcrumb);
}

if (route.name == 'mod-mod-edit') {
if (route.name === 'mod-mod-edit') {
breadcrumb.push({ name: t('edit') });
}

Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/site/pages/mod/mod-alerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const memberWaitingRole = computed(() => {
return t(`member_level_${member.level}`);
}
});
const showPublish = computed(() => canEdit.value && !props.mod.published_at && props.mod.visibility == 'public' && props.mod.has_download);
const showPublish = computed(() => canEdit.value && !props.mod.published_at && props.mod.visibility === 'public' && props.mod.has_download);

const hasAlerts = computed(() => {
const mod = props.mod;
Expand All @@ -79,7 +79,7 @@ const hasAlerts = computed(() => {
return false;
}

const transfer = mod.transfer_request && mod.transfer_request.user_id == user?.id;
const transfer = mod.transfer_request && mod.transfer_request.user_id === user?.id;

return !mod.has_download || !mod.approved || mod.suspended || memberWaiting.value || transfer || showPublish.value;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ const primaryModManager = computed(() => {
const chosen = chosenModManager.value;
const defaultManager = props.mod.game?.default_mod_manager_id;

return managers.value?.find(manager => manager.id == chosen)
?? managers.value?.find(manager => manager.id == defaultManager)
return managers.value?.find(manager => manager.id === chosen)
?? managers.value?.find(manager => manager.id === defaultManager)
?? managers.value[0];
});

Expand Down
Loading