|
15 | 15 | // along with this program. If not, see <https://www.gnu.org/licenses/>.
|
16 | 16 | /** @jsx react-jsx */
|
17 | 17 | /** @jsxImportSource @hono/hono/jsx */
|
18 |
| -import type { Context } from "@fedify/fedify/federation"; |
19 | 18 | import { LanguageString } from "@fedify/fedify/runtime";
|
20 | 19 | import { getActorHandle, Link } from "@fedify/fedify/vocab";
|
21 | 20 | import type { MessageClass } from "../message.ts";
|
| 21 | +import type { Session } from "../session.ts"; |
22 | 22 |
|
23 | 23 | export interface MessageProps {
|
24 | 24 | readonly message: MessageClass;
|
25 |
| - readonly context: Context<unknown>; |
| 25 | + readonly session: Session<unknown>; |
26 | 26 | }
|
27 | 27 |
|
28 |
| -export async function Message({ context, message }: MessageProps) { |
29 |
| - const author = await message.getAttribution({ |
30 |
| - documentLoader: context.documentLoader, |
31 |
| - contextLoader: context.contextLoader, |
32 |
| - suppressError: true, |
33 |
| - }); |
| 28 | +export async function Message({ session, message }: MessageProps) { |
| 29 | + const { context } = session; |
| 30 | + const author = message.attributionId?.href === session.actorId?.href |
| 31 | + ? await session.getActor() |
| 32 | + : await message.getAttribution({ |
| 33 | + documentLoader: context.documentLoader, |
| 34 | + contextLoader: context.contextLoader, |
| 35 | + suppressError: true, |
| 36 | + }); |
34 | 37 | const authorIcon = await author?.getIcon({
|
35 | 38 | documentLoader: context.documentLoader,
|
36 | 39 | contextLoader: context.contextLoader,
|
|
0 commit comments