Skip to content

Commit

Permalink
Hashtag class
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed May 7, 2024
1 parent a0f2bec commit c64cc70
Show file tree
Hide file tree
Showing 10 changed files with 1,320 additions and 1,031 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ Version 0.9.0

To be released.

- Added `Hashtag` class to Activity Vocabulary API. [[#48]]

- Added more log messages using the [LogTape] library. Currently the below
logger categories are used:

- `["fedify", "federation", "actor"]`
- `["fedify", "federation", "http"]`

[#48]: https://github.com/dahlia/fedify/issues/48


Version 0.8.0
-------------
Expand Down
2,219 changes: 1,197 additions & 1,022 deletions codegen/__snapshots__/class.test.ts.snap

Large diffs are not rendered by default.

32 changes: 28 additions & 4 deletions federation/handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,13 @@ Deno.test("handleObject()", async () => {
"application/activity+json",
);
assertEquals(await response.json(), {
"@context": "https://www.w3.org/ns/activitystreams",
"@context": [
"https://www.w3.org/ns/activitystreams",
{
Hashtag: "as:Hashtag",
sensitive: "as:sensitive",
},
],
id: "https://example.com/users/someone/notes/123",
summary: "Hello, world!",
type: "Note",
Expand Down Expand Up @@ -480,7 +486,13 @@ Deno.test("handleObject()", async () => {
"application/activity+json",
);
assertEquals(await response.json(), {
"@context": "https://www.w3.org/ns/activitystreams",
"@context": [
"https://www.w3.org/ns/activitystreams",
{
Hashtag: "as:Hashtag",
sensitive: "as:sensitive",
},
],
id: "https://example.com/users/someone/notes/123",
summary: "Hello, world!",
type: "Note",
Expand Down Expand Up @@ -850,7 +862,13 @@ Deno.test("respondWithObject()", async () => {
"application/activity+json",
);
assertEquals(await response.json(), {
"@context": "https://www.w3.org/ns/activitystreams",
"@context": [
"https://www.w3.org/ns/activitystreams",
{
Hashtag: "as:Hashtag",
sensitive: "as:sensitive",
},
],
id: "https://example.com/notes/1",
type: "Note",
content: "Hello, world!",
Expand All @@ -876,7 +894,13 @@ Deno.test("respondWithObjectIfAcceptable", async () => {
"application/activity+json",
);
assertEquals(await response.json(), {
"@context": "https://www.w3.org/ns/activitystreams",
"@context": [
"https://www.w3.org/ns/activitystreams",
{
Hashtag: "as:Hashtag",
sensitive: "as:sensitive",
},
],
id: "https://example.com/notes/1",
type: "Note",
content: "Hello, world!",
Expand Down
58 changes: 58 additions & 0 deletions vocab/__snapshots__/vocab.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,64 @@ snapshot[`Deno.inspect(Group) [auto] 3`] = `
}'
`;

snapshot[`Deno.inspect(Hashtag) [auto] 1`] = `
'Hashtag {
id: URL "https://example.com/",
href: URL "https://example.com/",
rel: "hello",
mediaType: "hello",
names: [ "hello", <en> "hello" ],
language: LanguageTag {
core: [ "en", undefined, undefined, undefined ],
_extensions: {},
_privateUse: "",
_extlangs: [],
_compact: "en"
},
height: 123,
width: 123,
previews: [ Link {}, Object {} ]
}'
`;

snapshot[`Deno.inspect(Hashtag) [auto] 2`] = `
'Hashtag {
href: URL "https://example.com/",
rel: "hello",
mediaType: "hello",
names: [ "hello", <en> "hello" ],
language: LanguageTag {
core: [ "en", undefined, undefined, undefined ],
_extensions: {},
_privateUse: "",
_extlangs: [],
_compact: "en"
},
height: 123,
width: 123,
previews: [ URL "https://example.com/" ]
}'
`;

snapshot[`Deno.inspect(Hashtag) [auto] 3`] = `
'Hashtag {
href: URL "https://example.com/",
rels: [ "hello", "hello" ],
mediaType: "hello",
names: [ "hello", "hello" ],
language: LanguageTag {
core: [ "en", undefined, undefined, undefined ],
_extensions: {},
_privateUse: "",
_extlangs: [],
_compact: "en"
},
height: 123,
width: 123,
previews: [ Link {}, Link {} ]
}'
`;

snapshot[`Deno.inspect(Ignore) [auto] 1`] = `
'Ignore {
id: URL "https://example.com/",
Expand Down
5 changes: 4 additions & 1 deletion vocab/announce.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ description: |
Indicates that the `actor` is calling the `target`'s attention the `object`.
The `origin` typically has no defined meaning.
defaultContext: "https://www.w3.org/ns/activitystreams"
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- sensitive: "as:sensitive"
Hashtag: "as:Hashtag"
properties: []
5 changes: 4 additions & 1 deletion vocab/article.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ uri: "https://www.w3.org/ns/activitystreams#Article"
extends: "https://www.w3.org/ns/activitystreams#Object"
entity: true
description: Represents any kind of multi-paragraph written work.
defaultContext: "https://www.w3.org/ns/activitystreams"
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- sensitive: "as:sensitive"
Hashtag: "as:Hashtag"
properties: []
5 changes: 4 additions & 1 deletion vocab/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ uri: "https://www.w3.org/ns/activitystreams#Create"
extends: "https://www.w3.org/ns/activitystreams#Activity"
entity: true
description: Indicates that the `actor` has created the `object`.
defaultContext: "https://www.w3.org/ns/activitystreams"
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- sensitive: "as:sensitive"
Hashtag: "as:Hashtag"
properties: []
13 changes: 13 additions & 0 deletions vocab/hashtag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$schema: ../codegen/schema.yaml
name: Hashtag
uri: "https://www.w3.org/ns/activitystreams#Hashtag"
extends: "https://www.w3.org/ns/activitystreams#Link"
entity: false
description: |
A specialized {@link Link} that represents an #hashtag.
See also <https://swicg.github.io/miscellany/#Hashtag>.
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- Hashtag: "as:Hashtag"
properties: []
5 changes: 4 additions & 1 deletion vocab/note.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ entity: true
description: |
Represents a short written work typically less than a single paragraph in
length.
defaultContext: "https://www.w3.org/ns/activitystreams"
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- sensitive: "as:sensitive"
Hashtag: "as:Hashtag"
properties: []
5 changes: 4 additions & 1 deletion vocab/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ description: |
set of modifications made to `object`.
The `target` and `origin` typically have no defined meaning.
defaultContext: "https://www.w3.org/ns/activitystreams"
defaultContext:
- "https://www.w3.org/ns/activitystreams"
- sensitive: "as:sensitive"
Hashtag: "as:Hashtag"
properties: []

0 comments on commit c64cc70

Please sign in to comment.