Merge tag '2024.3.1-io.4c' into host
This commit is contained in:
commit
e22d6a15e8
6 changed files with 20 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "misskey",
|
||||
"version": "2024.3.1-host.4b",
|
||||
"version": "2024.3.1-host.4c",
|
||||
"codename": "nasubi",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -126,13 +126,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
)
|
||||
).map(u => [u.id, u]));
|
||||
|
||||
const now = new Date();
|
||||
return birthdayUsers
|
||||
.map(item => {
|
||||
const birthday = new Date();
|
||||
birthday.setMonth(Math.floor(item.birthday_date / 100) - 1);
|
||||
birthday.setDate(item.birthday_date % 100);
|
||||
birthday.setHours(0, 0, 0, 0);
|
||||
if (birthday.getTime() < Date.now()) birthday.setFullYear(new Date().getFullYear() + 1);
|
||||
const birthday = new Date(
|
||||
now.getFullYear(),
|
||||
Math.floor(item.birthday_date / 100) - 1,
|
||||
item.birthday_date % 100,
|
||||
0, 0, 0, 0,
|
||||
);
|
||||
if (birthday.getTime() < now.getTime()) birthday.setFullYear(now.getFullYear() + 1);
|
||||
return { birthday: birthday.toISOString(), user: users.get(item.user_id) };
|
||||
})
|
||||
.filter(item => item.user !== undefined)
|
||||
|
|
|
@ -281,13 +281,7 @@ function exec() {
|
|||
|
||||
emojis.value = searchEmoji(props.q, emojiDb.value);
|
||||
} else if (props.type === 'emojiComplete') {
|
||||
if (!props.q || props.q === '') {
|
||||
// 最近使った絵文字をサジェスト
|
||||
emojis.value = defaultStore.state.recentlyUsedEmojis.map(emoji => unicodeEmojiDB.value.find(dbEmoji => dbEmoji.emoji === emoji)).filter(x => x) as EmojiDef[];
|
||||
return;
|
||||
}
|
||||
|
||||
emojis.value = searchEmoji(props.q, unicodeEmojiDB.value);
|
||||
emojis.value = searchEmoji(props.q, unicodeEmojiDB.value, true);
|
||||
} else if (props.type === 'mfmTag') {
|
||||
if (!props.q || props.q === '') {
|
||||
mfmTags.value = MFM_TAGS;
|
||||
|
|
|
@ -326,7 +326,7 @@ async function fetchSkebStatus() {
|
|||
function buildSkebStatus(): string {
|
||||
if (!userSkebStatus.value) return '';
|
||||
|
||||
if (userSkebStatus.value.isCreator) {
|
||||
if (userSkebStatus.value.isAcceptable || userSkebStatus.value.isCreator) {
|
||||
let status = '';
|
||||
|
||||
if (userSkebStatus.value.isAcceptable) {
|
||||
|
|
|
@ -16,7 +16,7 @@ export type EmojiDef = {
|
|||
};
|
||||
type EmojiScore = { emoji: EmojiDef, score: number };
|
||||
|
||||
export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30): EmojiDef[] {
|
||||
export function searchEmoji(query: string | null, emojiDb: EmojiDef[], exact = false, max = 30): EmojiDef[] {
|
||||
if (!query) {
|
||||
return [];
|
||||
}
|
||||
|
@ -40,6 +40,13 @@ export function searchEmoji(query: string | null, emojiDb: EmojiDef[], max = 30)
|
|||
});
|
||||
}
|
||||
|
||||
if (exact) {
|
||||
return [...matched.values()]
|
||||
.sort((x, y) => y.score - x.score)
|
||||
.slice(0, max)
|
||||
.map(it => it.emoji);
|
||||
}
|
||||
|
||||
// 前方一致(エイリアスなし)
|
||||
if (matched.size < max) {
|
||||
emojiDb.some(x => {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"type": "module",
|
||||
"name": "misskey-js",
|
||||
"version": "2024.3.1-host.4b",
|
||||
"version": "2024.3.1-host.4c",
|
||||
"description": "Misskey SDK for JavaScript",
|
||||
"types": "./built/dts/index.d.ts",
|
||||
"exports": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue