misskey/packages/backend/src
Johann150 804fa33535
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.
2022-05-29 15:15:52 +09:00
..
@types use http-signature module that supports hs2019 (#8635) 2022-05-26 09:12:17 +09:00
boot enhance: Perform port diagnosis at startup only when Listen fails (#8698) 2022-05-19 11:49:07 +09:00
config preload app css (#8752) 2022-05-29 10:57:06 +09:00
daemons refactor: fix type 2022-04-17 14:42:13 +09:00
db refactor 2022-05-21 22:07:11 +09:00
mfm refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
misc refactor: temporary files (#8713) 2022-05-25 16:50:22 +09:00
models refactor: improve code quality (#8751) 2022-05-29 15:15:52 +09:00
prelude refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
queue use http-signature module that supports hs2019 (#8635) 2022-05-26 09:12:17 +09:00
remote refactor: improve code quality (#8751) 2022-05-29 15:15:52 +09:00
server fix(client): Vite related boot mechanism revision (#8753) 2022-05-29 10:58:54 +09:00
services refactor: improve code quality (#8751) 2022-05-29 15:15:52 +09:00
const.ts remove max note text length setting 2022-02-20 16:07:43 +09:00
env.ts refactoring 2021-11-12 02:02:25 +09:00
global.d.ts refactoring 2021-11-12 02:02:25 +09:00
index.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
types.ts feat: アンケート終了通知 2022-03-06 16:06:27 +09:00