From e0c5401241a5cc3dcd3692a257a0da733c399927 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Tue, 19 Apr 2022 22:03:15 +0200 Subject: make emoji stand out more on reaction button a slight shadow makes them easier to see --- packages/client/src/components/reactions-viewer.reaction.vue | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/client/src/components') diff --git a/packages/client/src/components/reactions-viewer.reaction.vue b/packages/client/src/components/reactions-viewer.reaction.vue index 7dc079fde6..0688887f17 100644 --- a/packages/client/src/components/reactions-viewer.reaction.vue +++ b/packages/client/src/components/reactions-viewer.reaction.vue @@ -144,6 +144,10 @@ export default defineComponent({ > span { color: var(--fgOnAccent); } + + > .mk-emoji { + filter: drop-shadow(0 0 3px var(--bg)); + } } > span { -- cgit v1.2.3-freya From f02508c25962dfa9190ffdf659b4b769bb528ca6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 20 Apr 2022 09:30:29 +0900 Subject: Revert "make emoji stand out more on reaction button" This reverts commit e0c5401241a5cc3dcd3692a257a0da733c399927. --- packages/client/src/components/reactions-viewer.reaction.vue | 4 ---- 1 file changed, 4 deletions(-) (limited to 'packages/client/src/components') diff --git a/packages/client/src/components/reactions-viewer.reaction.vue b/packages/client/src/components/reactions-viewer.reaction.vue index 0688887f17..7dc079fde6 100644 --- a/packages/client/src/components/reactions-viewer.reaction.vue +++ b/packages/client/src/components/reactions-viewer.reaction.vue @@ -144,10 +144,6 @@ export default defineComponent({ > span { color: var(--fgOnAccent); } - - > .mk-emoji { - filter: drop-shadow(0 0 3px var(--bg)); - } } > span { -- cgit v1.2.3-freya From eac71ae1d7f7d1ee4c06c4060979b7b292c0e57e Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 23 Apr 2022 19:17:15 +0900 Subject: fix: Fix settings page (#8508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix settings page * nanka iroiro * clean up * clean up * インデックスに戻ってもタイトルが残ってしまうのを修正 --- packages/client/src/components/global/a.vue | 25 ++----- packages/client/src/pages/settings/index.vue | 103 +++++++++++++++++---------- packages/client/src/scripts/navigate.ts | 34 +++++++++ 3 files changed, 104 insertions(+), 58 deletions(-) create mode 100644 packages/client/src/scripts/navigate.ts (limited to 'packages/client/src/components') diff --git a/packages/client/src/components/global/a.vue b/packages/client/src/components/global/a.vue index 52fef50f9b..5287d59b3e 100644 --- a/packages/client/src/components/global/a.vue +++ b/packages/client/src/components/global/a.vue @@ -5,14 +5,13 @@ diff --git a/packages/client/src/pages/settings/index.vue b/packages/client/src/pages/settings/index.vue index 44c3be62fe..e6670ea930 100644 --- a/packages/client/src/pages/settings/index.vue +++ b/packages/client/src/pages/settings/index.vue @@ -2,19 +2,22 @@
-
{{ $ts.settings }}
+
+ {{ $ts.settings }} + +
{{ childInfo.title }}
- - -- cgit v1.2.3-freya From 804fa33535baa9e5cdf49070a50a555cf2c3b1ea Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 29 May 2022 08:15:52 +0200 Subject: refactor: improve code quality (#8751) * remove unnecessary if `Array.prototype.some` already returns a boolean so an if to return true or false is completely unnecessary in this case. * perf: use count instead of find When using `count` instead of `findOneBy`, the data is not unnecessarily loaded. * remove duplicate null check The variable is checked for null in the lines above and the function returns if so. Therefore, it can not be null at this point. * simplify `getJsonSchema` Because the assigned value is `null` and the used keys are only shallow, use of `nestedProperty.set` seems inappropriate. Because the value is not read, the initial for loop can be replaced by a `for..in` loop. Since all keys will be assigned `null`, the condition of the ternary expression in the nested function will always be true. Therefore the recursion case will never happen. With this the nested function can be eliminated. * remove duplicate condition The code above already checks `dragging` and returns if it is truthy. Checking it again later is therefore unnecessary. To make this more obvious the `return` is removed in favour of using an if...else construct. * remove impossible "unknown" time The `ago` variable will always be a number and all non-negative numbers are already covered by other cases, the negative case is handled with `future` so there is no case when `unkown` could be achieved. --- locales/ja-JP.yml | 1 - packages/backend/src/models/repositories/note.ts | 19 ++--- packages/backend/src/models/repositories/user.ts | 91 ++++++++++++---------- .../src/remote/activitypub/renderer/index.ts | 2 +- packages/backend/src/services/chart/core.ts | 29 +++---- packages/client/src/components/global/time.vue | 3 +- packages/client/src/ui/deck/column.vue | 11 ++- 7 files changed, 77 insertions(+), 79 deletions(-) (limited to 'packages/client/src/components') diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 6354fcfda1..9cd1d1eedb 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1111,7 +1111,6 @@ _sfx: channel: "チャンネル通知" _ago: - unknown: "謎" future: "未来" justNow: "たった今" secondsAgo: "{n}秒前" diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 638d78f626..c0abbb4f93 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -144,13 +144,7 @@ export const NoteRepository = db.getRepository(Note).extend({ return true; } else { // 指定されているかどうか - const specified = note.visibleUserIds.some((id: any) => meId === id); - - if (specified) { - return true; - } else { - return false; - } + return note.visibleUserIds.some((id: any) => meId === id); } } @@ -169,9 +163,12 @@ export const NoteRepository = db.getRepository(Note).extend({ } else { // フォロワーかどうか const [following, user] = await Promise.all([ - Followings.findOneBy({ - followeeId: note.userId, - followerId: meId, + Followings.count({ + where: { + followeeId: note.userId, + followerId: meId, + }, + take: 1, }), Users.findOneByOrFail({ id: meId }), ]); @@ -183,7 +180,7 @@ export const NoteRepository = db.getRepository(Note).extend({ in which case we can never know the following. Instead we have to assume that the users are following each other. */ - return following != null || (note.userHost != null && user.host != null); + return following > 0 || (note.userHost != null && user.host != null); } } diff --git a/packages/backend/src/models/repositories/user.ts b/packages/backend/src/models/repositories/user.ts index 541fbaf003..8a4e48efdd 100644 --- a/packages/backend/src/models/repositories/user.ts +++ b/packages/backend/src/models/repositories/user.ts @@ -61,47 +61,58 @@ export const UserRepository = db.getRepository(User).extend({ //#endregion async getRelation(me: User['id'], target: User['id']) { - const [following1, following2, followReq1, followReq2, toBlocking, fromBlocked, mute] = await Promise.all([ - Followings.findOneBy({ - followerId: me, - followeeId: target, - }), - Followings.findOneBy({ - followerId: target, - followeeId: me, - }), - FollowRequests.findOneBy({ - followerId: me, - followeeId: target, - }), - FollowRequests.findOneBy({ - followerId: target, - followeeId: me, - }), - Blockings.findOneBy({ - blockerId: me, - blockeeId: target, - }), - Blockings.findOneBy({ - blockerId: target, - blockeeId: me, - }), - Mutings.findOneBy({ - muterId: me, - muteeId: target, - }), - ]); - - return { + return awaitAll({ id: target, - isFollowing: following1 != null, - hasPendingFollowRequestFromYou: followReq1 != null, - hasPendingFollowRequestToYou: followReq2 != null, - isFollowed: following2 != null, - isBlocking: toBlocking != null, - isBlocked: fromBlocked != null, - isMuted: mute != null, - }; + isFollowing: Followings.count({ + where: { + followerId: me, + followeeId: target, + }, + take: 1, + }).then(n => n > 0), + isFollowed: Followings.count({ + where: { + followerId: target, + followeeId: me, + }, + take: 1, + }).then(n => n > 0), + hasPendingFollowRequestFromYou: FollowRequests.count({ + where: { + followerId: me, + followeeId: target, + }, + take: 1, + }).then(n => n > 0), + hasPendingFollowRequestToYou: FollowRequests.count({ + where: { + followerId: target, + followeeId: me, + }, + take: 1, + }).then(n => n > 0), + isBlocking: Blockings.count({ + where: { + blockerId: me, + blockeeId: target, + }, + take: 1, + }).then(n => n > 0), + isBlocked: Blockings.count({ + where: { + blockerId: target, + blockeeId: me, + }, + take: 1, + }).then(n => n > 0), + isMuted: Mutings.count({ + where: { + muterId: me, + muteeId: target, + }, + take: 1, + }).then(n => n > 0), + }); }, async getHasUnreadMessagingMessage(userId: User['id']): Promise { diff --git a/packages/backend/src/remote/activitypub/renderer/index.ts b/packages/backend/src/remote/activitypub/renderer/index.ts index 5f69332266..f100b77ce5 100644 --- a/packages/backend/src/remote/activitypub/renderer/index.ts +++ b/packages/backend/src/remote/activitypub/renderer/index.ts @@ -8,7 +8,7 @@ import { User } from '@/models/entities/user.js'; export const renderActivity = (x: any): IActivity | null => { if (x == null) return null; - if (x !== null && typeof x === 'object' && x.id == null) { + if (typeof x === 'object' && x.id == null) { x.id = `${config.url}/${uuid()}`; } diff --git a/packages/backend/src/services/chart/core.ts b/packages/backend/src/services/chart/core.ts index cf69e2194d..2960bac8f7 100644 --- a/packages/backend/src/services/chart/core.ts +++ b/packages/backend/src/services/chart/core.ts @@ -91,27 +91,20 @@ type ToJsonSchema = { }; export function getJsonSchema(schema: S): ToJsonSchema>> { - const object = {}; - for (const [k, v] of Object.entries(schema)) { - nestedProperty.set(object, k, null); - } - - function f(obj: Record>) { - const jsonSchema = { - type: 'object', - properties: {} as Record, - required: [], + const jsonSchema = { + type: 'object', + properties: {} as Record, + required: [], + }; + + for (const k in schema) { + jsonSchema.properties[k] = { + type: 'array', + items: { type: 'number' }, }; - for (const [k, v] of Object.entries(obj)) { - jsonSchema.properties[k] = v === null ? { - type: 'array', - items: { type: 'number' }, - } : f(v as Record>); - } - return jsonSchema; } - return f(object) as ToJsonSchema>>; + return jsonSchema as ToJsonSchema>>; } /** diff --git a/packages/client/src/components/global/time.vue b/packages/client/src/components/global/time.vue index 02351deb5f..a7f142f961 100644 --- a/packages/client/src/components/global/time.vue +++ b/packages/client/src/components/global/time.vue @@ -32,8 +32,7 @@ const relative = $computed(() => { ago >= 60 ? i18n.t('_ago.minutesAgo', { n: (~~(ago / 60)).toString() }) : ago >= 10 ? i18n.t('_ago.secondsAgo', { n: (~~(ago % 60)).toString() }) : ago >= -1 ? i18n.ts._ago.justNow : - ago < -1 ? i18n.ts._ago.future : - i18n.ts._ago.unknown); + i18n.ts._ago.future); }); function tick() { diff --git a/packages/client/src/ui/deck/column.vue b/packages/client/src/ui/deck/column.vue index fbaea64f56..31063a753d 100644 --- a/packages/client/src/ui/deck/column.vue +++ b/packages/client/src/ui/deck/column.vue @@ -213,14 +213,13 @@ function onDragover(ev) { if (dragging) { // 自分自身にはドロップさせない ev.dataTransfer.dropEffect = 'none'; - return; - } - - const isDeckColumn = ev.dataTransfer.types[0] === _DATA_TRANSFER_DECK_COLUMN_; + } else { + const isDeckColumn = ev.dataTransfer.types[0] === _DATA_TRANSFER_DECK_COLUMN_; - ev.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none'; + ev.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none'; - if (!dragging && isDeckColumn) draghover = true; + if (isDeckColumn) draghover = true; + } } function onDragleave() { -- cgit v1.2.3-freya From e675ffcf38b07f5c70d00b49c171c7ab3460e810 Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Sat, 4 Jun 2022 06:57:09 +0200 Subject: feat: option to collapse long notes (#8561) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: option to collapse long notes Closes #8559 * do not collapse if cw exists * use '閉じる' to close / show less. * make it sticky * Change style of the Show less button --- locales/ja-JP.yml | 1 + packages/client/src/components/note.vue | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'packages/client/src/components') diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 9cd1d1eedb..57be9bfcbb 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -52,6 +52,7 @@ searchUser: "ユーザーを検索" reply: "返信" loadMore: "もっと見る" showMore: "もっと見る" +showLess: "閉じる" youGotNewFollower: "フォローされました" receiveFollowRequest: "フォローリクエストされました" followRequestAccepted: "フォローが承認されました" diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue index bc8a0dd19d..4840b0dc2a 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -46,7 +46,7 @@

-
+
({{ i18n.ts.private }}) @@ -66,9 +66,12 @@
- +
{{ appearNote.channel.name }}
@@ -166,7 +169,8 @@ const reactButton = ref(); let appearNote = $computed(() => isRenote ? note.renote as misskey.entities.Note : note); const isMyRenote = $i && ($i.id === note.userId); const showContent = ref(false); -const collapsed = ref(appearNote.cw == null && appearNote.text != null && ( +const collapsed = ref(appearNote.cw == null); +const isLong = ref(appearNote.cw == null && appearNote.text != null && ( (appearNote.text.split('\n').length > 9) || (appearNote.text.length > 500) )); @@ -452,6 +456,23 @@ function readPromo() { } > .content { + &.isLong { + > .showLess { + width: 100%; + margin-top: 1em; + position: sticky; + bottom: 1em; + + > span { + display: inline-block; + background: var(--panel); + padding: 6px 10px; + font-size: 0.8em; + border-radius: 999px; + box-shadow: 0 0 7px 7px var(--bg); + } + } + } &.collapsed { position: relative; max-height: 9em; -- cgit v1.2.3-freya From 71150f21cd91df7bdd78a8f708db092418e85baa Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 4 Jun 2022 15:23:53 +0900 Subject: Revert "feat: option to collapse long notes (#8561)" This reverts commit e675ffcf38b07f5c70d00b49c171c7ab3460e810. --- locales/ja-JP.yml | 1 - packages/client/src/components/note.vue | 27 +++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) (limited to 'packages/client/src/components') diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 57be9bfcbb..9cd1d1eedb 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -52,7 +52,6 @@ searchUser: "ユーザーを検索" reply: "返信" loadMore: "もっと見る" showMore: "もっと見る" -showLess: "閉じる" youGotNewFollower: "フォローされました" receiveFollowRequest: "フォローリクエストされました" followRequestAccepted: "フォローが承認されました" diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue index 4840b0dc2a..bc8a0dd19d 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -46,7 +46,7 @@

-
+
({{ i18n.ts.private }}) @@ -66,12 +66,9 @@
- -
{{ appearNote.channel.name }}
@@ -169,8 +166,7 @@ const reactButton = ref(); let appearNote = $computed(() => isRenote ? note.renote as misskey.entities.Note : note); const isMyRenote = $i && ($i.id === note.userId); const showContent = ref(false); -const collapsed = ref(appearNote.cw == null); -const isLong = ref(appearNote.cw == null && appearNote.text != null && ( +const collapsed = ref(appearNote.cw == null && appearNote.text != null && ( (appearNote.text.split('\n').length > 9) || (appearNote.text.length > 500) )); @@ -456,23 +452,6 @@ function readPromo() { } > .content { - &.isLong { - > .showLess { - width: 100%; - margin-top: 1em; - position: sticky; - bottom: 1em; - - > span { - display: inline-block; - background: var(--panel); - padding: 6px 10px; - font-size: 0.8em; - border-radius: 999px; - box-shadow: 0 0 7px 7px var(--bg); - } - } - } &.collapsed { position: relative; max-height: 9em; -- cgit v1.2.3-freya From adf3190859191775d7056f000a3508aac9712dfa Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 Jun 2022 12:23:57 +0900 Subject: chore(client): fix menu item style --- packages/client/src/components/ui/menu.vue | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'packages/client/src/components') diff --git a/packages/client/src/components/ui/menu.vue b/packages/client/src/components/ui/menu.vue index ca56048262..dad5dfa8b0 100644 --- a/packages/client/src/components/ui/menu.vue +++ b/packages/client/src/components/ui/menu.vue @@ -1,5 +1,6 @@