Skip to content

Commit ef0e91b

Browse files
authored
Merge pull request #1327 from neet/support-mastodon-4.4.0
Support mastodon 4.4.0
2 parents 1132abc + c551ecf commit ef0e91b

File tree

11 files changed

+88
-2
lines changed

11 files changed

+88
-2
lines changed

cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
"unassign",
4949
"unbookmark",
5050
"undici",
51+
"unendorse",
5152
"unfavourite",
53+
"unfeature",
5254
"unfetch",
5355
"unfollow",
5456
"unprocessable",

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ services:
2323

2424
mastodon:
2525
restart: always
26-
image: neetshin/mastodon-dev:4.3.0
26+
image: neetshin/mastodon-dev:4.4.0
2727
ports:
2828
- "3000:3000"
2929
- "4000:4000"

src/mastodon/entities/v1/rule.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ export interface Rule {
55
text: string;
66
/** Longer-form description of the rule. */
77
hint: string;
8+
/** Available translations for this rule’s `text` and `hint`, as a Hash where keys are locale codes and values are hashes with `text` and `hint` keys. */
9+
translations: Record<string, { text: string; hint: string }>;
810
}

src/mastodon/entities/v1/tag.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ export interface TagHistory {
1515
* @see https://docs.joinmastodon.org/entities/tag/
1616
*/
1717
export interface Tag {
18+
/** ID of the hashtag in the database. Useful for constructing URLs for the moderation tools & Admin API. */
19+
id: string;
1820
/** The value of the hashtag after the # sign. */
1921
name: string;
2022
/** A link to the hashtag on the instance. */
2123
url: string;
22-
2324
/** Usage statistics for given days. */
2425
history?: TagHistory[] | null;
2526
/** Whether the current token’s authorized user is following this tag. */
2627
following?: boolean | null;
28+
/** Whether the current token’s authorized user is featuring this tag on their profile. */
29+
featuring?: boolean | null;
2730
}

src/mastodon/entities/v2/filter.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type FilterContext = keyof FilterContextRegistry;
1414
export interface FilterActionRegistry {
1515
warn: never;
1616
hide: never;
17+
blur: never;
1718
}
1819

1920
export type FilterAction = keyof FilterActionRegistry;
@@ -37,6 +38,8 @@ export interface Filter {
3738
* `warn` = show a warning that identifies the matching filter by title, and allow the user to expand the filtered status. This is the default (and unknown values should be treated as equivalent to warn).
3839
*
3940
* `hide` = do not show this status if it is received
41+
*
42+
* `blur` = hide/blur media attachments with a warning identifying the matching filter by `title`
4043
*/
4144
filterAction: FilterAction;
4245
/** The keywords grouped under this filter. */

src/mastodon/entities/v2/instance.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ export interface InstanceRegistrations {
108108
approvalRequired: boolean;
109109
/** A custom message to be shown when registrations are closed. */
110110
message?: string | null;
111+
/** A minimum age required to register, if configured. */
112+
minAge?: number | null;
113+
/** Whether registrations require the user to provide a reason for joining. Only applicable when `registrations[approval_required]` is true. */
114+
reasonRequired?: boolean | null;
111115
}
112116

113117
export interface InstanceContact {

src/mastodon/rest/v1/accounts.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export interface CreateAccountParams {
3333
readonly locale: string;
3434
/** Text that will be reviewed by moderators if registrations require manual approval. */
3535
readonly reason?: string;
36+
/** String (Date), required if the server has a minimum age requirement. */
37+
readonly dateOfBirth?: string;
3638
/** https://github.com/mastodon/mastodon/pull/25342 */
3739
readonly timeZone?: string;
3840
}
@@ -199,6 +201,12 @@ export interface Accounts$SelectStatusesResource {
199201
): Paginator<Status[], ListAccountStatusesParams>;
200202
}
201203

204+
export interface Accounts$SelectEndorsementsResource {
205+
list(
206+
params?: DefaultPaginationParams,
207+
): Paginator<Account[], DefaultPaginationParams>;
208+
}
209+
202210
export interface Accounts$SelectResource {
203211
featuredTags: Accounts$SelectFeaturedTagsResource;
204212
note: Accounts$SelectNoteResource;
@@ -207,6 +215,7 @@ export interface Accounts$SelectResource {
207215
followers: Accounts$SelectFollowersResource;
208216
following: Accounts$SelectFollowingResource;
209217
statuses: Accounts$SelectStatusesResource;
218+
endorsements: Accounts$SelectEndorsementsResource;
210219

211220
/**
212221
* View information about a profile.
@@ -288,6 +297,22 @@ export interface Accounts$SelectResource {
288297
* @returns N/A
289298
*/
290299
removeFromFollowers(meta?: HttpMetaParams): Promise<void>;
300+
301+
/**
302+
* Add the given account to the user’s featured profiles.
303+
* @param meta Metadata
304+
* @return Relationship
305+
* @see https://docs.joinmastodon.org/methods/accounts/#endorse
306+
*/
307+
endorse(meta?: HttpMetaParams): Promise<Relationship>;
308+
309+
/**
310+
* Remove the given account from the user’s featured profiles.
311+
* @param meta Metadata
312+
* @returns Relationship
313+
* @see https://docs.joinmastodon.org/methods/accounts/#unendorse
314+
*/
315+
unendorse(meta?: HttpMetaParams): Promise<Relationship>;
291316
}
292317

293318
export interface AccountsRelationshipsResource {

src/mastodon/rest/v1/tags.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ export interface Tags$SelectResource {
1919
* @return Tag
2020
*/
2121
unfollow(meta?: HttpMetaParams): Promise<Tag>;
22+
23+
/**
24+
* Feature the hashtag on your profile.
25+
* @return Tag
26+
* @see https://docs.joinmastodon.org/methods/tags/#feature
27+
*/
28+
feature(meta?: HttpMetaParams): Promise<Tag>;
29+
30+
/**
31+
* Stop featuring the hashtag on your profile.
32+
* @return Tag
33+
* @see https://docs.joinmastodon.org/methods/tags/#unfeature
34+
*/
35+
unfeature(meta?: HttpMetaParams): Promise<Tag>;
2236
}
2337

2438
export interface TagsResource {

tests/rest/v1/accounts.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,25 @@ describe("account", () => {
321321
});
322322
expect(rel.followedBy).toBe(false);
323323
});
324+
325+
it("endorses/unendorses an account", async () => {
326+
await using alice = await sessions.acquire();
327+
await using bob = await sessions.acquire();
328+
329+
try {
330+
await alice.rest.v1.accounts.$select(bob.id).follow();
331+
const relationship = await alice.rest.v1.accounts
332+
.$select(bob.id)
333+
.endorse();
334+
expect(relationship.endorsed).toBe(true);
335+
336+
const endorsements = await alice.rest.v1.accounts
337+
.$select(alice.id)
338+
.endorsements.list();
339+
expect(endorsements).toContainEqual(bob.account);
340+
} finally {
341+
await alice.rest.v1.accounts.$select(bob.id).unendorse();
342+
await alice.rest.v1.accounts.$select(bob.id).unfollow();
343+
}
344+
});
324345
});

tests/rest/v1/emails.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ it("can create a confirmation", async () => {
1212
password: "password",
1313
agreement: true,
1414
locale: "en",
15+
dateOfBirth: new Date("2000-01-01").toISOString(),
1516
});
1617

1718
const client = createRestAPIClient({

0 commit comments

Comments
 (0)