Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop

This commit is contained in:
tamaina 2023-02-12 08:42:42 +00:00
commit d7a2d59f41
4 changed files with 26 additions and 26 deletions

View file

@ -1,14 +0,0 @@
// https://github.com/facebook/jest/issues/12270#issuecomment-1194746382
const nativeModule = require('node:module');
function resolver(module, options) {
const { basedir, defaultResolver } = options;
try {
return defaultResolver(module, options);
} catch (error) {
return nativeModule.createRequire(basedir).resolve(module);
}
}
module.exports = resolver;

View file

@ -83,7 +83,14 @@ module.exports = {
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: { moduleNameMapper: {
"^@/(.*?).js": "<rootDir>/src/$1.ts", // Do not resolve .wasm.js to .wasm by the rule below
'^(.+)\\.wasm\\.js$': '$1.wasm.js',
// SWC converts @/foo/bar.js to `../../src/foo/bar.js`, and then this rule
// converts it again to `../../src/foo/bar` which then can be resolved to
// `.ts` files.
// See https://github.com/swc-project/jest/issues/64#issuecomment-1029753225
// TODO: Use `--allowImportingTsExtensions` on TypeScript 5.0 so that we can
// directly import `.ts` files without this hack.
'^(\\.{1,2}/.*)\\.js$': '$1', '^(\\.{1,2}/.*)\\.js$': '$1',
}, },
@ -112,7 +119,7 @@ module.exports = {
// resetModules: false, // resetModules: false,
// A path to a custom resolver // A path to a custom resolver
resolver: './jest-resolver.cjs', // resolver: './jest-resolver.cjs',
// Automatically restore mock state between every test // Automatically restore mock state between every test
restoreMocks: true, restoreMocks: true,

View file

@ -1,6 +1,5 @@
import * as crypto from 'node:crypto'; import * as crypto from 'node:crypto';
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import jsonld from 'jsonld';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import { CONTEXTS } from './misc/contexts.js'; import { CONTEXTS } from './misc/contexts.js';
@ -85,7 +84,9 @@ class LdSignature {
@bindThis @bindThis
public async normalize(data: any) { public async normalize(data: any) {
const customLoader = this.getLoader(); const customLoader = this.getLoader();
return await jsonld.normalize(data, { // XXX: Importing jsonld dynamically since Jest frequently fails to import it statically
// https://github.com/misskey-dev/misskey/pull/9894#discussion_r1103753595
return (await import('jsonld')).default.normalize(data, {
documentLoader: customLoader, documentLoader: customLoader,
}); });
} }

View file

@ -10,15 +10,21 @@
<MkSpacer :margin-min="20" :margin-max="28"> <MkSpacer :margin-min="20" :margin-max="28">
<div v-if="note" class="_gaps"> <div v-if="note" class="_gaps">
<div :class="$style.tabs"> <div v-if="reactions.length === 0" class="_fullinfo">
<button v-for="reaction in reactions" :key="reaction" :class="[$style.tab, { [$style.tabActive]: tab === reaction }]" class="_button" @click="tab = reaction"> <img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
<MkReactionIcon :reaction="reaction"/> <div>{{ i18n.ts.nothing }}</div>
<span style="margin-left: 4px;">{{ note.reactions[reaction] }}</span>
</button>
</div> </div>
<MkA v-for="user in users" :key="user.id" :to="userPage(user)"> <template v-else>
<MkUserCardMini :user="user" :with-chart="false"/> <div :class="$style.tabs">
</MkA> <button v-for="reaction in reactions" :key="reaction" :class="[$style.tab, { [$style.tabActive]: tab === reaction }]" class="_button" @click="tab = reaction">
<MkReactionIcon :reaction="reaction"/>
<span style="margin-left: 4px;">{{ note.reactions[reaction] }}</span>
</button>
</div>
<MkA v-for="user in users" :key="user.id" :to="userPage(user)">
<MkUserCardMini :user="user" :with-chart="false"/>
</MkA>
</template>
</div> </div>
<div v-else> <div v-else>
<MkLoading/> <MkLoading/>