Commit graph

17 commits

Author SHA1 Message Date
Johann150 32dff28460
fix: add id for activitypub follows (#8689)
* add id for activitypub follows

* fix lint

* fix: follower must be local, followee must be remote

Misskey will only use ActivityPub follow requests for users that are local
and are requesting to follow a remote user. This check is to ensure that
this endpoint can not be used by other services or instances.

* fix: missing import

* render block with id

* fix comment
2022-06-04 13:52:42 +09:00
Johann150 81109b14b5
fix: correctly render empty note text (#8746)
Ensure that the _misskey_content attribute will always exist. Because
the API endpoint does not require the existence of the `text` field,
that field may be `undefined`. By using `?? null` it can be ensured
that the value is at least `null`.

Furthermore, the rendered HTML of a note with empty text will also be
the empty string. From git blame it seems that this behaviour was added
because of a Mastodon bug that might have previously existed. Hoever,
this seems to be no longer the case as I can find mastodon posts that
have empty content.

The code could be made a bit more succinct by using the null coercion
operator.
2022-06-03 23:18:44 +09:00
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
syuilo ce51ef5df5 refactor 2022-04-17 21:01:02 +09:00
syuilo ddd655c0c1 refactor: fix type 2022-04-17 13:14:29 +09:00
syuilo 1c67c26bd8
refactor: migrate to typeorm 3.0 (#8443)
* wip

* wip

* wip

* Update following.ts

* wip

* wip

* wip

* Update resolve-user.ts

* maxQueryExecutionTime

* wip

* wip
2022-03-26 15:34:00 +09:00
MeiMei ba9563b983
Use unique id for Undo (#8434) 2022-03-22 00:39:00 +09:00
syuilo 21de5c4a9c perf(server): reduce db query 2022-03-21 05:42:11 +09:00
syuilo d071d18dd7
refactor: Use ESM (#8358)
* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
2022-02-27 11:07:39 +09:00
syuilo b7bbe090e9 refactor 2022-02-03 21:20:25 +09:00
MeiMei d8905a9588
Unifying Misskey-specific IRIs in JSON-LD @context Resolve #8116 (#8178)
* Unifying Misskey-specific IRIs in JSON-LD `@context` Resolve #8116

* CHANGELOG
2022-01-23 01:52:35 +09:00
syuilo eec7e6500e enhance: convert svg to png of custom emojis 2022-01-21 18:47:02 +09:00
Johann150 cbb7e95d82
enhance: Forward report (#8001)
* implement sending AP Flag object

Optionally allow a user to select to forward a report about a remote
user to the other instance. This is added in a backwards-compatible way.

* add locale string

* forward report only for moderators

* add switch to moderator UI to forward report

* fix report note url

* return forwarded status from API

apparently forgot to carry this over from my testing environment

* object in Flag activity has to be an array

For correct interoperability with Pleroma the "object" property of the Flag
activity has to be an array.

This array will in the future also hold the link to respective notes, so it
makes sense to correct this on our side.

* Update get-note-menu.ts

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2022-01-21 03:06:38 +09:00
syuilo c69b72e199 fix lint 2021-12-09 23:58:30 +09:00
syuilo 8b7f5be878 fix for lint 2021-11-13 19:10:14 +09:00
syuilo b9eaf906e7 fix lint errors 2021-11-12 10:52:10 +09:00
syuilo 0e4a111f81 refactoring
Resolve #7779
2021-11-12 02:02:25 +09:00