-
Notifications
You must be signed in to change notification settings - Fork 15
Allow specifying preview file when pushing #51
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
base: master
Are you sure you want to change the base?
Allow specifying preview file when pushing #51
Conversation
Updated my site and apparently my theory was totally off base here :( Leaving open in case anyone can explain to me what I'm missing, but without that I have to assume postgres is just not returning rows in insertion order, which I guess makes sense given how massive the neocities DB probably is. Can be closed once a maintainer sees this. |
It's probably possible to change this. What ordering do you think would make sense for a preview to be the first one? I got an email recently (was it you?) that suggested it should be the last edited one. |
Not my email, but I agree with whoever emailed you -- I think doing it from most recently edited to least recently edited makes more sense than what I was thinking. My original thought to make the first file the preview file because activity feed entries felt like they should be immutable to me. Would just be a matter of changing this to something like (untested)
And then I could update this PR to upload the preview file last instead of first. Side note, but it feels somewhat strange to allow the preview file ordering to change after the activity feed entry has been created. Activity feed entries just feel to me like they should be immutable (or maybe immutable after a short grace period), but with the 24 hour gap between entries I suppose a single "site edit" / activity feed entry contains all the changes in that 24 hour period and so it is mutable until the period is over. |
I went ahead and changed it in neocities/neocities@141bba6, try your change now and let me know if it works. I also changed it to bring 6 back. It might make more sense to just have a list of all the site files changed in an equal thumbnail size if there's more than one, because then I could show a lot more and that would be cool. |
Ah, that sounds awesome, I like the idea of a showing more files for larger changesets a lot! It's interesting that Not sure what the policy is on having multiple accounts, but it's hard to test with only one account since I only get one test every 24 hours :P However since this should go into effect retroactively and since |
Opened a PR for this: neocities/neocities#561 |
I've tested this functionality with
--dry-run
but I haven't tested with a live site to ensure that file upload order impacts preview order. I believe it does based on the following lines:/upload
callsSite.store_file
https://github.com/neocities/neocities/blob/0531a1d85fd2b0d7b1fa333669230f867dd83f89/app/api.rb#L130C26-L130C37
Site.store_file
callsSiteChange.record
with the name of the uploaded filehttps://github.com/neocities/neocities/blob/0531a1d85fd2b0d7b1fa333669230f867dd83f89/models/site.rb#L1809
SiteChange.record
only creates anEvent
once every 24 hours, so only the first upload will trigger thishttps://github.com/neocities/neocities/blob/0531a1d85fd2b0d7b1fa333669230f867dd83f89/models/site_change.rb#L16-L19
Event
s are used on both/site/:sitename
and on activity feedshttps://github.com/neocities/neocities/blob/0531a1d85fd2b0d7b1fa333669230f867dd83f89/models/site.rb#L1383-L1388
https://github.com/neocities/neocities/blob/0531a1d85fd2b0d7b1fa333669230f867dd83f89/models/site.rb#L1390-L1397
Granted, this isn't going to be perfect and it's going to be dependent on what order the site change files are returned here:
https://github.com/neocities/neocities/blob/0531a1d85fd2b0d7b1fa333669230f867dd83f89/models/site_change.rb#L9-L11
But I believe it should usually follow insertion order.
I'll try and test when if I remember when I next update my site, but if someone with a working test env could check for me that would be much appreciated ^.^