sharkey/packages/backend/src/remote/activitypub
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
..
kernel fix: wrong type for isVisibleForMe 2022-05-24 10:12:42 +02:00
misc fix types 2022-04-03 16:30:22 +09:00
models chore: remove unused imports 2022-05-28 21:17:23 +02:00
renderer refactor: improve code quality (#8751) 2022-05-29 15:15:52 +09:00
ap-request.ts chore: fix lint 2022-04-03 15:33:22 +09:00
audience.ts perf(server): refactor and performance improvements 2022-03-25 16:27:41 +09:00
db-resolver.ts perf(server): use cached user info in getUserFromApId 2022-03-26 19:09:57 +09:00
deliver-manager.ts fix type 2022-04-03 16:40:47 +09:00
logger.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
perform.ts perf(server): refactor and performance improvements 2022-03-25 16:27:41 +09:00
request.ts refactor: Use ESM (#8358) 2022-02-27 11:07:39 +09:00
resolver.ts refactor: fix type 2022-04-17 13:26:31 +09:00
type.ts refactor: fix type 2022-04-17 13:26:31 +09:00