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

Block Instances #1019

Merged
merged 3 commits into from
Apr 17, 2024
Merged

Block Instances #1019

merged 3 commits into from
Apr 17, 2024

Conversation

Sjmarf
Copy link
Member

@Sjmarf Sjmarf commented Apr 16, 2024

Added a "Block" action to the ellipsis menu in InstanceView. Due to an API limitation, the "block" action is only available when you visit the InstanceView from a community page or user page (on 0.19.4 and above), and not from search. I've submitted an issue on the Lemmy repo to hopefully resolve this limitation in future.

This PR doesn't add the block lists where you'll be able to unblock users/communities/instances - I'll do that in a follow-up PR

Closes #672

@Sjmarf Sjmarf requested a review from a team as a code owner April 16, 2024 18:51
@Sjmarf Sjmarf requested review from JakeShirley and EricBAndrews and removed request for a team April 16, 2024 18:51
Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found a couple issues while testing:

  • Wrong instance blocked
    • Repro: attempt to block slrpnk.net from lemmy.ml and check block status using web ui
    • Expected behavior: slrpnk.net is blocked
    • Actual behavior: bildung.social is blocked
    • Notes: it's at least consistent--unblocking slrpnk.net from Mlem removes bildung.social from the block list
  • block_already_exists error on unblocked instance
    • Repro: attempt to block hexbear.net from lemmy.ml
    • Expected behavior: instance blocked
    • Actual behavior: instance_block_already_exists error appears twice. Web UI indicates no block took place.
  • Block status not reflected in InstanceView
    • Repro: block hexbear.net from web ui and navigate to its page in Mlem
    • Expected behavior: menu offers Unblock option
    • Actual behavior: menu offers Block option

@Sjmarf
Copy link
Member Author

Sjmarf commented Apr 17, 2024

Thanks, I'll look into it when I get a chance later.

Wrong instance blocked

Hmm, interesting. APISite objects have both an id and instance_id, which were always the same during my testing. It's possible that they're different under certain circumstances, and I'm using the wrong one

block_already_exists error on unblocked instance

This is possibly a result of the first issue - accessing the wrong instance id

Block status not reflected in InstanceView

This unfortunately isn't possible as there is no blocked field of APISite. The hope is that the instance page won't be accessible anyways if you've blocked the instance - you can't visit a community or user page from that instance, so you can't get to the instance view.

@Sjmarf
Copy link
Member Author

Sjmarf commented Apr 17, 2024

Hmm, interesting. APISite objects have both an id and instance_id, which were always the same during my testing. It's possible that they're different under certain circumstances, and I'm using the wrong one

Turns out this was indeed the case. It should work correctly, now.

@Sjmarf Sjmarf requested a review from EricBAndrews April 17, 2024 19:28
Copy link
Member

@EricBAndrews EricBAndrews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Sjmarf Sjmarf merged commit d07db3a into dev Apr 17, 2024
4 checks passed
@Sjmarf Sjmarf deleted the sjmarf/block-instances branch April 17, 2024 19:53
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.

[0.19.0] Instance blocking
2 participants