misskey/packages/backend/src/services
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
..
blocking fix: Promises -> Promise (#8545) 2022-04-25 15:14:13 +09:00
chart refactor: improve code quality (#8751) 2022-05-29 15:15:52 +09:00
drive refactor: temporary files (#8713) 2022-05-25 16:50:22 +09:00
following fix: Promises -> Promise (#8545) 2022-04-25 15:14:13 +09:00
i refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
messages feat: Improve Push Notification (#7667) 2022-04-30 21:52:07 +09:00
note fix: wrong type for isVisibleForMe 2022-05-24 10:12:42 +02:00
user-list refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
add-note-to-antenna.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
create-notification.ts feat: Improve Push Notification (#7667) 2022-04-30 21:52:07 +09:00
create-system-user.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
fetch-instance-metadata.ts enhance: uniform theme color (#8702) 2022-05-19 09:54:45 +02:00
insert-moderation-log.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
instance-actor.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
logger.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
push-notification.ts feat: Improve Push Notification (#7667) 2022-04-30 21:52:07 +09:00
register-or-fetch-instance-doc.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
relay.ts refactor: use structuredClone for deep clone 2022-04-23 12:38:02 +09:00
send-email-notification.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
send-email.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
stream.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
suspend-user.ts .js 2022-03-25 16:35:24 +09:00
unsuspend-user.ts .js 2022-03-25 16:35:24 +09:00
update-hashtag.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
user-cache.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00
validate-email-for-account.ts refactor: migrate to typeorm 3.0 (#8443) 2022-03-26 15:34:00 +09:00