lint: yup.

This commit is contained in:
Julian Lam
2025-04-29 15:13:21 -04:00
parent 2827498d76
commit 28b7a20339
6 changed files with 17 additions and 12 deletions

View File

@@ -64,7 +64,7 @@ define('forum/unread', [
// Generate list of default categories based on topic list // Generate list of default categories based on topic list
let defaultCategories = ajaxify.data.topics.reduce((map, topic) => { let defaultCategories = ajaxify.data.topics.reduce((map, topic) => {
const { category }= topic; const { category } = topic;
let { cid } = category; let { cid } = category;
cid = utils.isNumber(cid) ? parseInt(cid, 10) : cid; cid = utils.isNumber(cid) ? parseInt(cid, 10) : cid;
map.set(cid, category); map.set(cid, category);

View File

@@ -97,7 +97,7 @@ define('forum/world', ['topicList', 'search', 'sort', 'hooks', 'alerts', 'api',
hideEl.classList.toggle('hidden', !visibility); hideEl.classList.toggle('hidden', !visibility);
categoriesEl.classList.toggle('hidden', !visibility); categoriesEl.classList.toggle('hidden', !visibility);
localStorage.setItem('world:show-categories', visibility); localStorage.setItem('world:show-categories', visibility);
} };
let visibility = localStorage.getItem('world:show-categories'); let visibility = localStorage.getItem('world:show-categories');
console.log('got value', visibility); console.log('got value', visibility);

View File

@@ -246,7 +246,12 @@ Mocks.category = async (actors) => {
name, summary, followers, inbox, endpoints, tag, name, summary, followers, inbox, endpoints, tag,
} = actor; } = actor;
preferredUsername = slugify(preferredUsername || name); preferredUsername = slugify(preferredUsername || name);
// const { followers: followerCount, following: followingCount } = await activitypub.actors.getLocalFollowCounts(uid); /*
const {
followers: followerCount,
following: followingCount
} = await activitypub.actors.getLocalFollowCounts(uid);
*/
try { try {
({ hostname } = new URL(actor.id)); ({ hostname } = new URL(actor.id));
@@ -257,7 +262,7 @@ Mocks.category = async (actors) => {
// No support for category avatars yet ;( // No support for category avatars yet ;(
// let picture; // let picture;
// if (image) { // if (image) {
// picture = typeof image === 'string' ? image : image.url; // picture = typeof image === 'string' ? image : image.url;
// } // }
const iconBackgrounds = await user.getIconBackgrounds(); const iconBackgrounds = await user.getIconBackgrounds();
let bgColor = Array.prototype.reduce.call(preferredUsername, (cur, next) => cur + next.charCodeAt(), 0); let bgColor = Array.prototype.reduce.call(preferredUsername, (cur, next) => cur + next.charCodeAt(), 0);

View File

@@ -1,7 +1,6 @@
'use strict'; 'use strict';
const nconf = require('nconf'); const nconf = require('nconf');
const _ = require('lodash');
const user = require('../../user'); const user = require('../../user');
const topics = require('../../topics'); const topics = require('../../topics');

View File

@@ -86,7 +86,7 @@ module.exports = function (User) {
// Filter out remote categories // Filter out remote categories
const isCategory = await db.exists(uids.map(uid => `categoryRemote:${uid}`)); const isCategory = await db.exists(uids.map(uid => `categoryRemote:${uid}`));
uids = uids.filter((uid, idx) => !isCategory[idx]) uids = uids.filter((uid, idx) => !isCategory[idx]);
const data = await plugins.hooks.fire(`filter:user.${type}`, { const data = await plugins.hooks.fire(`filter:user.${type}`, {
uids: uids, uids: uids,

View File

@@ -46,7 +46,7 @@ describe('Actor asserton', () => {
publicKeyPem: 'somekey', publicKeyPem: 'somekey',
}, },
}); });
activitypub.helpers._webfingerCache.set('example@example.org', { actorUri }) activitypub.helpers._webfingerCache.set('example@example.org', { actorUri });
}); });
it('should return true if successfully asserted', async () => { it('should return true if successfully asserted', async () => {
@@ -142,6 +142,7 @@ describe('Actor asserton', () => {
await db.sortedSetAdd(`uid:${id}:shares`, Date.now(), tid); await db.sortedSetAdd(`uid:${id}:shares`, Date.now(), tid);
if (!x) { if (!x) {
// eslint-disable-next-line no-await-in-loop
await topics.tools.move(tid, { await topics.tools.move(tid, {
cid, cid,
uid: 'system', uid: 'system',
@@ -172,8 +173,8 @@ describe('Actor asserton', () => {
const states = await categories.getWatchState([id], followerUid); const states = await categories.getWatchState([id], followerUid);
assert.strictEqual(states[0], categories.watchStates.tracking); assert.strictEqual(states[0], categories.watchStates.tracking);
}) });
}) });
}); });
describe('less happy paths', () => { describe('less happy paths', () => {
@@ -214,7 +215,7 @@ describe('Actor asserton', () => {
const response = await activitypub.actors.assert([id]); const response = await activitypub.actors.assert([id]);
assert.deepStrictEqual(response, []); assert.deepStrictEqual(response, []);
}) });
}); });
}); });
@@ -458,7 +459,7 @@ describe('Inbox resolution', () => {
const { id, actor } = helpers.mocks.person({ const { id, actor } = helpers.mocks.person({
endpoints: { endpoints: {
sharedInbox: 'https://example.org/inbox', sharedInbox: 'https://example.org/inbox',
} },
}); });
await activitypub.actors.assert(id); await activitypub.actors.assert(id);
@@ -486,7 +487,7 @@ describe('Inbox resolution', () => {
const { id, actor } = helpers.mocks.group({ const { id, actor } = helpers.mocks.group({
endpoints: { endpoints: {
sharedInbox: 'https://example.org/inbox', sharedInbox: 'https://example.org/inbox',
} },
}); });
await activitypub.actors.assertGroup(id); await activitypub.actors.assertGroup(id);