Skip to content

Commit

Permalink
fixed bug - join conversation link was not working.
Browse files Browse the repository at this point in the history
  • Loading branch information
pubmania committed Dec 9, 2024
1 parent 51cd143 commit 1fe27c3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/assets/js/src/BlueskyComments.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,18 @@ export class BlueskyComments extends HTMLElement {
if (!blueskyUrl) {
blueskyUrl = this.getAttribute("url");
}
this.shadowRoot.querySelector(".comments").innerHTML =
`<p class="conversation"><a href="${blueskyUrl}" target="_blank">Join the conversation on Bluesky.... </a></p>`;

if (blueskyUrl) {
try {
const atUri = await this.#resolvePostUrl(blueskyUrl);
if (!atUri) {
throw new Error("Failed to resolve AT URI");
}
const urlParts = (atUri).split("/");
const postId = urlParts[4];
console.log(postId)
this.shadowRoot.querySelector(".comments").innerHTML =
`<p class="conversation"><a href="https://bsky.app/profile/ankit.dumatics.com/post/${postId}" target="_blank">Join the conversation on Bluesky.... </a></p>`;
const replies = await this.#fetchReplies(atUri);
this.#displayReplies(replies);
} catch (e) {
Expand Down

0 comments on commit 1fe27c3

Please sign in to comment.