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
resolves mrusme/neonmodem#32 Filter for lemmy communities #36
base: master
Are you sure you want to change the base?
Conversation
Created a new issue for the limited results number here: |
Oh think that gets it working :) |
d720b92
to
44dcb26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey hey, thanks for the PR! I left a couple of comments.
01d91cc
to
7fb12fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Just two more questions that came to my mind, other than that good to go!
ID: strconv.Itoa(i.Community.ID), | ||
Name: i.Community.Name, | ||
var maxSubscriptions int | ||
if sys.config["MaxSubscriptions"] != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding another check that makes sure MaxSubscriptions
wasn't set to 0
? I fear that if someone might mistakenly change that in their config, debugging the issue might be really tricky. And from what I understand, 0
wouldn't make any sense.
} else { | ||
maxSubscriptions = MaxSubscriptions | ||
} | ||
page := 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the previous comment, I was assuming paging would start at 0
. It seems like we would either want to page from 0
to < maxSubscriptions
or from 1
to <= maxSubscriptions
. Otherwise the configured value would not factually represent the actual amount of pages, no?
SysIDX: sys.ID, | ||
}) | ||
} | ||
page += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless there was an error or the len
of resp.Communities
is 0
, it seems like the page would always increment. Do you think it might be better to make the for
loop an actual for page := 0; page <= maxSubscriptions; page++
, to make this more visible? Or is there another reason you decided to go for the page += 1
at the end that I might be overseeing here? The explicit for
loop would save two dedicated lines, ehehehe. :-)
|
||
var getPosts types.GetPosts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
@BreadMakesYouFat any updates? :-) |
A possible fix for Lemmy community filtering. Tested with make + go1.19.0.
A limitation is that we currently only request 50 posts at a time, and so some communities will be empty. I tried naively upping the limit value but this seems to result in no results, so probably need to send multiple requests and I'm not very experienced with requests in go: