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

Enhancements #240, #233 Comments reply and other actions #253

Conversation

dellagustin
Copy link
Contributor

@dellagustin dellagustin commented Apr 19, 2023

This commit implements #240 and initial support for #233.

A menu is added to comments that support initiating the following actions:

  • Reply to post
  • Copy link to post
  • Open in original site - opens the post in its original system at another tab
  • Follow author of the post
  • Forget interactor account

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

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.
  • When using the dark mode, the text in the menu does not appear (it is the same color as the background) - fixed with a0bd277 and Fix dark mode and other issues #251
  • When you click outside of the menu, it does not disappear, it only disappear when you click a menu item or the menu button - fixed with 851afe1
  • There are very little guardrails, so some might need to be implemented later (e.g. verifying the input for the interactor account).

Open Questions

Which fediverse software (e.g. Mastodon, Pleroma) supports the remote interaction flow we are using here? At least Mastodon and Pleroma (actually Akkoma) were tested.

Related issues

Related links and references

Implementation Details

The remote interaction is implemented using the WebFinger protocol/API and also the OStatus Subscribe mechanism.

In summary, it gets to remote interact URL template using WebFinger with a call to https://<follower instance host>/.well-known/webfinger?resource=acct:<follower account>, and inspect the response for the link with rel equals to http://ostatus.org/schema/1.0/subscribe, then builds the remote interact URL and opens it in a new tab.

dellagustin and others added 2 commits April 19, 2023 22:45
…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]>
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
@dellagustin
Copy link
Contributor Author

Demo

image
image
Known issue:
image

either open the pop up, or interact again.
@daveajones 's post is open on my instance (a login flow is triggered if I'm not already logged in):
image

@dellagustin dellagustin marked this pull request as ready for review May 1, 2023 08:52
@dellagustin
Copy link
Contributor Author

dellagustin commented May 1, 2023

@daveajones , ready for review, if you can live with the known issues.
@nathangathright I was too lazy to implement a modal dialog, to avoid the pop up block, but since it only happens when you first enter your account, that was acceptable for me
@glaszig , @stevencrader , @nathangathright , it would be great if you could propose a fix to the known issue related to the "Dark mode" (related, #221, #251).

@daveajones
Copy link
Contributor

10-4. Will review!

@stevencrader
Copy link
Collaborator

After rebasing on the current master (b7d2b76), make the changes mentioned below.

image

Change Menu Background

Add background: var(--button-background); to .context-menu menu in /ui/src/components/CommentMenu/styles.scss

Change Show/Hide Comments to use button style

Use the custom button used throughout the site in /ui/src/components/Comments/index.tsx.

Change:

            {!this.state.showComments && <button disabled={this.state.loadingComments} onClick={() => this.onClickShowComments()}>Show comments</button>}
            {this.state.showComments && <button onClick={() => this.onClickHideComments()}>Hide comments</button>}

To:

            {!this.state.showComments && <Button disabled={this.state.loadingComments} onClick={() => this.onClickShowComments()}>Show comments</Button>}
            {this.state.showComments && <Button onClick={() => this.onClickHideComments()}>Hide comments</Button>}

dellagustin added a commit to podStation/podcastindex-web-ui that referenced this pull request May 4, 2023
@dellagustin
Copy link
Contributor Author

dellagustin commented May 4, 2023

@stevencrader I adopted the change to the menu background with a0bd277 and sent a separate pull request for the button replacement - #258

Thanks a lot for the suggestions!

@stevencrader
Copy link
Collaborator

When you click outside of the menu, it does not disappear, it only disappear when you click a menu item or the menu button

To solve this, you could look at the fix I added for the top bar menu on mobile. See handleClickOutside in:

handleClickOutside(event) {
// @ts-ignore
if (this.wrapperRef && !this.wrapperRef.current.contains(event.target)) {
setTimeout(() => {
this.setState({
dropdownOpen: false,
})
}, 100)
}
}

Since your menu will be removed when navigating unlike the top bar, you could get away with a much shorter timeout value. I found a value of 10 works.

@dellagustin
Copy link
Contributor Author

Hello @stevencrader , thanks for tip with #253 (comment).
I implemented it and it worked. It also worked without setTimeout entirely. Do you see any reason to keep it in my case?

This commit implements the feature of closing the comment menu
when the user clicks outside of it.

It is based on a similar implementation on the class/component
TopBar.

References:
-
Podcastindex-org#253 (comment)

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

@daveajones I added some fixed to the known issues with the help of @stevencrader .
From my side, this is ready to go.

@stevencrader
Copy link
Collaborator

Hello @stevencrader , thanks for tip with #253 (comment). I implemented it and it worked. It also worked without setTimeout entirely. Do you see any reason to keep it in my case?

I don't see any reason to keep the timeout if it isn't needed.

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

Successfully merging this pull request may close these issues.

3 participants