Skip to content

Commit

Permalink
Rename Object's attributedTo prop to attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Mar 26, 2024
1 parent dd91fc6 commit 109c993
Show file tree
Hide file tree
Showing 8 changed files with 343 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.sortImports": true
"source.sortImports": "always"
}
},
"cSpell.words": [
Expand Down
54 changes: 42 additions & 12 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,61 @@ To be released.
- `Object.clone()` method's `images` option no more accepts `Link`
objects.

- `Object`'s `attributedTo` property now accepts only `Actor` objects.

- `new Object()` constructor's `attributedTo` option now accepts only
`Actor` objects.
- `Object.getAttributedTo()` method now returns only an `Actor` object.
- `Object.getAttributedTos()` method now returns only `Actor` objects.
- `Object.clone()` method's `attributedTo` option now accepts only
`Actor` objects.
- `Object`'s `attributedTo` property was renamed to `attribution`.

- `new Object()` constructor's `attributedTo` option was renamed to
`attribution`.
- `new Object()` constructor's `attributedTos` option was renamed to
`attributions`.
- `Object.getAttributedTo()` method is renamed to
`Object.getAttribution()`.
- `Object.getAttributedTos()` method is renamed to
`Object.getAttributions()`.
- `Object.clone()` method's `attributedTo` option is renamed to
`attribution`.
- `Object.clone()` method's `attributedTos` option is renamed to
`attributions`.

- `Object`'s `attribution` property (was `attributedTo`) now accepts only
`Actor` objects.

- `new Object()` constructor's `attribution` option (was `attributedTo`)
now accepts only an `Actor` object.
- `new Object()` constructor's `attributions` option (was `attributedTos`)
now accepts only `Actor` objects.
- `Object.getAttribution()` method (was `getAttributedTo()`) now returns
only an `Actor` object.
- `Object.getAttributions()` method (was `getAttributedTos()`) now returns
only `Actor` objects.
- `Object.clone()` method's `attribution` option (`attributedTo`) now
accepts only an `Actor` object.
- `Object.clone()` method's `attributions` option (`attributedTos`) now
accepts only `Actor` objects.

- `Activity`'s `object` property no more accepts `Link` objects.

- `new Activity()` constructor's `object` option no more accepts `Link`
- `new Activity()` constructor's `object` option no more accepts a `Link`
object.
- `new Activity()` constructor's `objects` option no more accepts `Link`
objects.
- `Activity.getObject()` method no more returns a `Link` object.
- `Activity.getObjects()` method no more returns `Link` objects.
- `Activity.clone()` method's `object` option no more accepts `Link`
- `Activity.clone()` method's `object` option no more accepts a `Link`
object.
- `Activity.clone()` method's `objects` option no more accepts `Link`
objects.

- `Activity`'s `actor` property now accepts only `Actor` objects.

- `new Activity()` constructor's `actor` option now accepts only `Actor`
- `new Activity()` constructor's `actor` option now accepts only
an `Actor` object.
- `new Activity()` constructor's `actors` option now accepts only `Actor`
objects.
- `Activity.getActor()` method now returns only an `Actor` object.
- `Activity.getActors()` method now returns only `Actor` objects.
- `Activity.clone()` method's `actor` option now accepts only `Actor`
- `Activity.clone()` method's `actor` option now accepts only an `Actor`
object.
- `Activity.clone()` method's `actors` option now accepts only `Actor`
objects.

- Added `sensitive` property to `Object` class.
Expand Down
360 changes: 180 additions & 180 deletions codegen/__snapshots__/class.test.ts.snap

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/blog/federation/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ federation.setInboxListeners("/users/{handle}/inbox", "/inbox")
const object = await create.getObject(ctx);
if (object instanceof Note) {
if (object.id == null || object.content == null) return;
const author = await object.getAttributedTo();
const author = await object.getAttribution();
if (
author == null || author.id == null || author.preferredUsername == null
) return;
Expand Down
2 changes: 1 addition & 1 deletion examples/blog/models/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function toArticle(
const url = new URL(`/posts/${post.uuid}`, context.url);
return new Article({
id: url,
attributedTo: context.getActorUri(blog.handle),
attribution: context.getActorUri(blog.handle),
to: new URL("https://www.w3.org/ns/activitystreams#Public"),
summary: post.title,
content: getContentHtml(post),
Expand Down
Loading

0 comments on commit 109c993

Please sign in to comment.