-
Notifications
You must be signed in to change notification settings - Fork 0
Make human readable short urls #92
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
Conversation
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.
Great work, really spicy. 🌶️
Much appreciated! 🎆
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.
Somehow I need to log in to reach these images with the shorter URL even tho I set the album to be public
end | ||
|
||
def authorize_image | ||
unless current_user.present? && (current_user.site_admin? || logged_in_as_admin_of?(album.circle) || album.shared?) |
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.
I think this line would be complete with only checking for album.shared?
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.
Otherwise anytime someone/some website would like to reach the image (for example, our blog), there should be a user logged in
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.
oh true, i forgot to check for public albums
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.
Will correct it tomorrow
So this pr solves issue with the monkey patching private albums
and greatly shortens the path to images without introducing another redirect, so
it is easier for browsers to cache 🥳
It uses friendly_id gem to make human friendly urls from filenames.
The good part is we don't have to replace old links on the blog, because they will still work.
If PR is accepted please ping me, because i want to deploy it to lois. There is a data migration rake task, to move old images to the new AlbumImage model, but if something goes bad i want to be there to put out the dumpster fire 🔥
closes #91 and closes #90