RetroFed Forums
Your home away from modern life.
How do you want disabeling community themes to work?
Post Reply
AuthorMessage
DeckPacker piefed.blahaj.zone DeckPacker@piefed.blahaj.zone
Joined: 2026-03-07
(edited) Quote

UPDATE:
The feature is now fully implemented! It shows up as an extra option in the community sidebar and saves the result in the database (as was decided by the poll). It is not merged with main yet, but you can look at the pull request , if you are interested.

In a previous post , I talked about the new community themes feature.

From a lot of the commentors, I heard, that you wish, that you would like to have the ability to disable community themes from specific communities and not just in general.
I am currently planning on implementing that feature, but I am not quite shure, if you would like to be able to disable certain community themes on some of your devices, but not on others (which would mean storing that setting in a browser cookie) or if you want to disable community themes of certain communities for your entire user account, so that the setting is applied to all your devices at once (which would mean storing that setting in the database.

Feel free to share your opinion in more details in the comments!

Poll · closed
Disable certain community themes only on one device at a time (store it as a cookie)
50% (1)
Disable certain community themes for your entire account (store it in the database)
50% (1)
2 votes
20   Original
Skavau piefed.social Skavau@piefed.social
Joined: 2025-03-18
#2 · Quote Reply

I would think entire account personally. I can't think of when I'd want it to be visible on my phone but not my PC.

7
Snoopy piefed.social Snoopy@piefed.social
Joined: 2025-02-25
#3 · Quote Reply

I also agree with skavau. i often delete cookie. so i prefer a more lasting solution.

4
DeckPacker piefed.blahaj.zone DeckPacker@piefed.blahaj.zone
Joined: 2026-03-07
#4 · Quote Reply

I would think entire account personally. I can't think of when I'd want it to be visible on my phone but not my PC.

Alright, thanks for the feedback!

1
Katherine 🪴 piefed.social webkitten@piefed.social
Joined: 2025-12-19
#5 · Quote Reply

[deleted]
3
Snoopy piefed.social Snoopy@piefed.social
Joined: 2025-02-25
#6 · Quote Reply

[deleted]

Maybe switch button located somewhere in the topbar ? Or something like mbin for theming (they do a quite good job) ? :)

2
wjs018 piefed.wjs018.xyz wjs018@piefed.wjs018.xyz
Joined: 2025-07-15
#7 · Quote Reply

I wrote previously about how to put this in the session cookie, but if it is going to end up in the db, it probably makes sense to have it be a new table rather than adding a new column onto the user table. It can probably be a really simple table like CommunityBlock since this is essentially a style-only version of that (CommunityStyleBlock perhaps).

Some things to take note of while working on this:

  • Make sure to remove any of these rows that reference the user in User.delete_dependencies so that users can still be deleted. Just do it the same way we do for community blocks or any number of other tables.
  • Similarly, you need to add this to Community.delete_dependencies so that communities can still be deleted
  • To make things efficient, you can make a function to return all the blocked community styles for a particular user that can be cached (see app.utils.blocked_communities() as an example)
  • Make sure that whenever the community style blocks change (added or removed) that the cache is busted (again, using community blocks as an example): cache.delete_memoized(blocked_communities, user.id). This makes the next call refresh the result from the db rather than just pulling stale data from redis.

As for the UI (often the hardest part), I guess you will probably need some kind of button or form-control in the sidebar. Maybe a button like we do for Join/Leave currently or a checkbox and submit button? Not sure what would be best there.

All of that is just my idea for how to put this in the db anyway. @rimu@piefed.social probably has ideas as well or could tell you why all of this is crap.

5
Rimu Moderator rimu@piefed.social
Joined: 2024-01-04
#8 · Quote Reply

I wrote previously about how to put this in the session cookie, but if it is going to end up in the db, it probably makes sense to have it be a new table rather than adding a new column onto the user table. It can probably be a really simple table like CommunityBlock since this is essentially a style-only version of that (CommunityStyleBlock perhaps). Some things to take note of while working o...

Agreed

4
DeckPacker piefed.blahaj.zone DeckPacker@piefed.blahaj.zone
Joined: 2026-03-07
#9 · Quote Reply

I wrote previously about how to put this in the session cookie, but if it is going to end up in the db, it probably makes sense to have it be a new table rather than adding a new column onto the user table. It can probably be a really simple table like CommunityBlock since this is essentially a style-only version of that (CommunityStyleBlock perhaps). Some things to take note of while working o...

Thank you so much, for this advice!
I was also planning on doing a separate table for the blocked communities, I didn't think about the deleting part though, so thank you for telling me how that works.
As for the UI, I have currently implemented it as an extra section in the community info card at the side (which only shows up if the community has an active theme).
I will now be working on implementing this within the database.

NxSKpJ9aUCGZ7Ko.png

2
wjs018 piefed.wjs018.xyz wjs018@piefed.wjs018.xyz
Joined: 2025-07-15
#10 · Quote Reply

Thank you so much, for this advice! I was also planning on doing a separate table for the blocked communities, I didn't think about the deleting part though, so thank you for telling me how that works. As for the UI, I have currently implemented it as an extra section in the community info card at the side (which only shows up if the community has an active theme). I will now be working on impl...

Looks awesome! I always find the UI to be the hardest part, but that looks great.

2
DeckPacker piefed.blahaj.zone DeckPacker@piefed.blahaj.zone
Joined: 2026-03-07
#11 · Quote Reply

Looks awesome! I always find the UI to be the hardest part, but that looks great.

Do you know, if there is a way to be able to get the result of my function community.utils.get_community_theme_allowed in the jinja base template when any relevant route is rendered?

Because including this as a parameter in every route seems really inefficient.

1
wjs018 piefed.wjs018.xyz wjs018@piefed.wjs018.xyz
Joined: 2025-07-15
#12 · Quote Reply

Do you know, if there is a way to be able to get the result of my function community.utils.get_community_theme_allowed in the jinja base template when any relevant route is rendered? Because including this as a parameter in every route seems really inefficient.

The user and community are generally accessible across pretty much every relevant view function and template, so that might work well to stick those kinds of getter functions.

So, you could have a function for these models that returns whether the style is allowed for that user/community. See something like User.has_blocked_user() as an example. It could look something like this in the User class:

def allow_community_theme(self, community_id: int):
    # Need to do the import here to avoid circular import error
    from app.utils import function_you_made
    
    # Do the call to your function and logic here and return True/False
    # Make sure that anything you do also works for anonymous users

Similarly, you just swap some stuff around to add a function under the Community model where it would take the user_id as an argument.

2
DeckPacker piefed.blahaj.zone DeckPacker@piefed.blahaj.zone
Joined: 2026-03-07
#13 · Quote Reply

The user and community are generally accessible across pretty much every relevant view function and template, so that might work well to stick those kinds of getter functions. So, you could have a function for these models that returns whether the style is allowed for that user/community. See something like User.has_blocked_user() as an example. It could look something like this in the User cla...

That worked, thanks ;)

2
Post Reply
Back to top