Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments: Add button / icon to open the original post in a new tab #240

Closed
dellagustin opened this issue Mar 4, 2023 · 9 comments
Closed

Comments

@dellagustin
Copy link
Contributor

Currently the only way to comment on the podcasts in the podcast index is to copy the link of the post and use it to find it in the instance where the user has and account.

The only way to get the original post link, currently, is to copy it from the timestamp. Having a link to the post/comment is a comment UX practice, but it is kind of a hidden feature, as it is not that intuitive.

I suggest that we add a more clear indication on how to open the original post or copy the post link.
A common icon for opening a link in another domain is like the one shown in the screenshot below:
image

Related issues

Links and References

@dellagustin
Copy link
Contributor Author

dellagustin commented Mar 6, 2023

@ericpp
Copy link
Contributor

ericpp commented Mar 6, 2023

This looks great! Should also check if this works well on mobile. Popup dialogs like this tend to be difficult to use on mobile devices.

@dellagustin
Copy link
Contributor Author

I was looking into the code today.
Since dialog requires the javascript method showModal is used to show the dialog, I'm assuming it does not work well with React. The fact that there are react components for modal stuff is likely an indication that this is complicated.
I'm tempted to use a simple prompt instead.
Also, I'll have to include an option to remove/update the saved home instance, otherwise it would be a "write once" scenario.
Aside from that, I think I understood the stuff.

@nathangathright
Copy link
Contributor

The dialog element and showModal method are newer elements, but they’re available in all major browsers. I’m unclear why you think this will be an issue with React.

I actually did make a version with prompt first, but it had a major drawback: it was blocked by the browser’s popup blocker. Since I couldn’t set an EventListener on the submit button of the prompt, trying to open a new window after a prompt didn't appear to be in response to a user event, and it was blocked.

I think a way to clear the localStorage would be nice, but was unclear where we’d like to expose controls for that. Maybe we could just store it as a cookie with a short expiration date. Otherwise, asking the user to clear it manually isn’t that complicated:
CleanShot 2023-03-10 at 07 34 32

@dellagustin
Copy link
Contributor Author

Hi @nathangathright ,

I think a way to clear the localStorage would be nice, but was unclear where we’d like to expose controls for that. Maybe we could just store it as a cookie with a short expiration date. Otherwise, asking the user to clear it manually isn’t that complicated:

I thought about adding an extra item in the menu, like "forget my account home instance" or something like that.
Contextually it is not an action that belongs to any individual post, but in the other hand, it would easily educate the user on how to do it, so I think it is an ok approximation.

I’m unclear why you think this will be an issue with React.

Take into account I'm writing as someone that learns React on demand (i.e. the minimum I need to contribute).
React is state based and more descriptive and reactive (as per its name 😄) then imperative.

You typically don't give commands like showModal or show, but you change the state to with a property like isShowing and adapt your rendering method to deal with that. So I'll need to research a bit what is the best way do this in react.

Thanks for clearing out the drawback on using prompt.

@dellagustin
Copy link
Contributor Author

dellagustin commented Mar 11, 2023

Regarding the remote interact (i.e. follow, reply, etc...), the patterns https://${instance.hostname}/authorize_interaction?acct=${username}
and https://${instance.hostname}/authorize_interaction?uri=${url} are not a standard, they work for Mastodon and may work for some other instance "types". I consider it an ok first implementation, but moving forward it would be good to have something based on standard protocols.
To my best knowledge, the state of the art is to use WebFinger to find out the OStatus subscribe URL for the Actor (I'm not sure which one, the interactor or the "interactee"). My understanding is that this is intended only for subscriptions (i.e follow), but that many instance "types" (tested with Mastodon and Pleroma) also can use it for redirecting to a post, as represented in their instance, for further interaction (e.g. boosting, favoriting, bookmarking, liking, replying, etc...).

Here are some references:

@nathangathright , if you have any good references for this, please share.

dellagustin added a commit to podStation/podcastindex-web-ui that referenced this issue Apr 19, 2023
…y and other actions

This commit implements Podcastindex-org#240 and initial support for Podcastindex-org#233.

A menu is added to comments that support initiating the following
actions:
- Reply to post - currently just navigates to the post in it is
  original system
- Copy link to post
- Open in original site - opens the post in its original system at
  another tab
- Follow author of the post - currently just navigates to the
  profile of the author on its original system

This commit is based on
nathangathright/comment-thread-mockup@6b2f716

Related issues:

- Podcastindex-org#240
- Podcastindex-org#233

Co-authored-by: Nathan Gathright <[email protected]>
@dellagustin
Copy link
Contributor Author

dellagustin commented Apr 25, 2023

I did some more tests with the WebFinger protocol to get the remote interact URL pattern.
To do the WebFinger request I need to pass the account of an existing user in the instance where the interaction will happen.

As far as I can tell, the remote interact URL pattern does not change from user to user, yet we will need to pass a user to get it.

We'll have to prompt for the account of the user initiating the interaction then, not only the instance host.

Example

I want to
interact (e.g. comment) with the post https://podcastindex.social/@dave/110237990624503755 from my account, [email protected].

I need to send the request https://fosstodon.org/.well-known/webfinger?resource=acct:[email protected], it will return:

{
    "subject": "acct:[email protected]",
    "aliases": [
        "https://fosstodon.org/@dellagustin",
        "https://fosstodon.org/users/dellagustin"
    ],
    "links": [
        {
            "rel": "http://webfinger.net/rel/profile-page",
            "type": "text/html",
            "href": "https://fosstodon.org/@dellagustin"
        },
        {
            "rel": "self",
            "type": "application/activity+json",
            "href": "https://fosstodon.org/users/dellagustin"
        },
        {
            "rel": "http://ostatus.org/schema/1.0/subscribe",
            "template": "https://fosstodon.org/authorize_interaction?uri={uri}"
        }
    ]
}

I'll get the template from the link with rel equal to http://ostatus.org/schema/1.0/subscribe, then replace {uri} with https://podcastindex.social/@dave/110237990624503755, and open the resulting url on the browser. This should open the post in my instance so that I can interact with it there. A login flow takes place if I am not logged in yet.

@dellagustin
Copy link
Contributor Author

dellagustin commented Apr 30, 2023

Some more test results of the URLs resulting of the approach above:

The common denominator so far for interacting with users (e.g. follow) is to replace {uri} with the user account in the format user@host.

dellagustin added a commit to podStation/podcastindex-web-ui that referenced this issue Apr 30, 2023
This commit implements one next step to automate the remote
interactions with comments and commenters.

This uses the WebFinger protocol and API and also the
OStatus Subscribe mechanism.

There are very little guardrails, so some might need to
be implemented later (e.g. verifying the input for the
interactor account).

Known issues:
When the user is first prompted to enter their account,
the opening of a new tab for interaction will be blocked
as a pop-up.

Related issues:
- Podcastindex-org#233
- Podcastindex-org#240

Related links:
-
https://socialhub.activitypub.rocks/t/represent-endpoint-for-remote-interaction/480
daveajones added a commit that referenced this issue May 11, 2023
…ments

Enhancements #240, #233 Comments reply and other actions
@dellagustin
Copy link
Contributor Author

Implemented with #253.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants