glitch-soc / mastodon

A glitchy but lovable microblogging server
https://glitch-soc.github.io/docs/
GNU Affero General Public License v3.0
690 stars 184 forks source link

Change limit on number of followed hashtags per column #2489

Open jakkarth opened 9 months ago

jakkarth commented 9 months ago

Pitch

In the same way that we have an environment variable to change the limit on the number of characters for a post, we should have an environment variable to change the limit on the number of hashtags that can be followed in a ui column.

Motivation

Users may want to follow more than four hashtags related to a specific topic. For example, #gardening #permaculture #ecology #urbanecology #urbangardening.

The argument against this in vanilla is a concern about server performance. As instance admins, that should be our call to make. It's up to us to balance the needs of our users vs the capacity of the server we're running on.

jakkarth commented 9 months ago

This is my first time looking at the mastodon/glitch-soc code base and I'm not very familiar with ruby and this architecture. It looks like on the front-end side in column_settings.jsx onSelect line 51 would need to be changed, list_panel.jsx getOrderedLists line 17 may need to be changed?, and tag_feed.rb LIMIT_PER_MODE line 4 may need to be changed. I don't have a dev environment set up to test this though. I hope it would be an easy change and you can move forward based on my description, but if I need to set everything up and try to make a PR I can try.

jakkarth commented 9 months ago

It looks like only tag_feed.rb and column_settings.jsx changes are needed. I didn't touch list_panel.jsx and it seems to be working with my new hardcoded value of 40. Posts matching the fifth hashtag but not 1-4 are being shown in the column as intended. I guess I'll take a look at how to get an environment variable into these spots, using the MAX_CHARS variable as an example that impacts both front and back end code.

jakkarth commented 9 months ago

Turns out it was relatively straightforward. Working ok in my dev environment. I edited .devcontainer/docker-compose.yml to add MAX_FEED_HASHTAGS: 5 in the environment section, and it does indeed limit it to 5. Reducing the number doesn't seem to affect columns with more than that already added, which is intuitive in the same way changing the max character count doesn't go back and truncate previous posts.

I'd be happy for feedback as this is my first time contributing to this project. :smile:

jakkarth commented 9 months ago

@ClearlyClaire sorry for the at, I'm not sure how to bring this to project maintainer attention.