Skip to content
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

Fixes to profile images for fog/Google Cloud Storage #9958

Merged
merged 3 commits into from
Aug 23, 2021
Merged

Conversation

jywarren
Copy link
Member

@jywarren jywarren commented Jul 27, 2021

Follow-up to #9807 to try fixing profile images

See: https://publiclab.org/profile/liz to test, or https://stable.publiclab.org/profile/liz

fixes #9957

@gitpod-io
Copy link

gitpod-io bot commented Jul 27, 2021

@jywarren jywarren changed the title Update user.rb Fixes to profile images Jul 27, 2021
@jywarren jywarren changed the title Fixes to profile images Fixes to profile images for fog/Google Cloud Storage Jul 27, 2021
has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
url: '/system/profile/photos/:id/:style/:basename.:extension'
has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' }
#,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation detected (column 1 instead of 8).

url: '/system/profile/photos/:id/:style/:basename.:extension'
has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' }
#,
# url: '/system/profile/photos/:id/:style/:basename.:extension'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation detected (column 8 instead of 2).

has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
url: '/system/profile/photos/:id/:style/:basename.:extension'
has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' }
#,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.

#:path => ":rails_root/public/system/images/photos/:id/:style/:basename.:extension"
#. ":rails_root/public/system/public/system/:class/:attachment/:id_partition/:style/:filename" # from config/initializers/paperclip.rb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.

has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
url: '/system/profile/photos/:id/:style/:basename.:extension'
has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' }
#,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab detected.

@jywarren
Copy link
Member Author

Pushed this to unstable to test...

has_attached_file :photo, styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
url: '/system/profile/photos/:id/:style/:basename.:extension'
has_attached_file :photo,
styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use one level of indentation for parameters following the first line of a multi-line method call.

@codecov
Copy link

codecov bot commented Aug 3, 2021

Codecov Report

Merging #9958 (37170c8) into main (f41f8e7) will increase coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head 37170c8 differs from pull request most recent head 4388759. Consider uploading reports for the commit 4388759 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #9958      +/-   ##
==========================================
+ Coverage   82.13%   82.18%   +0.04%     
==========================================
  Files          98       98              
  Lines        5968     5967       -1     
==========================================
+ Hits         4902     4904       +2     
+ Misses       1066     1063       -3     
Impacted Files Coverage Δ
app/controllers/images_controller.rb 70.27% <100.00%> (ø)
app/helpers/application_helper.rb 87.62% <100.00%> (+2.21%) ⬆️
app/models/user.rb 86.12% <100.00%> (ø)
app/services/search_service.rb 95.00% <100.00%> (-0.10%) ⬇️
app/controllers/user_tags_controller.rb 83.78% <0.00%> (+1.35%) ⬆️

@jywarren
Copy link
Member Author

jywarren commented Aug 3, 2021

OK, so now we are forming the path to the image correctly -- /public/system/users/photos/000/000/001/thumb/aseprite_templates.png however all profiles point to the same image, for some reason!

@jywarren
Copy link
Member Author

jywarren commented Aug 3, 2021

OK, trying :id_partition instead of :id in the url: setting...

@jywarren
Copy link
Member Author

jywarren commented Aug 3, 2021

@jywarren
Copy link
Member Author

jywarren commented Aug 3, 2021

Tested this in GitPod and it should work. Testing on unstable now.

@codeclimate
Copy link

codeclimate bot commented Aug 3, 2021

Code Climate has analyzed commit 4388759 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Style 1

View more on Code Climate.

@jywarren
Copy link
Member Author

jywarren commented Aug 3, 2021

OK! I believe this is working and ready to deploy!!

@jywarren
Copy link
Member Author

jywarren commented Aug 3, 2021

system test error should disappear:

Minitest::UnexpectedError:         Capybara::ExpectationNotMet: expected to find css "div.alert-success" but there were no matches
            test/system/post_test.rb:253:in `block in <class:PostTest>'

@icarito
Copy link
Member

icarito commented Aug 18, 2021

I'm finding missing images in a different directory. So I think we might have a routing issue. E.g.

https://storage.googleapis.com/publiclab- production/public/system/profile/photos/7/original/384404446-square.png
but it's being searched at /public/system/users/photos/000/000/007/thumb/384404446-square.png

@jywarren
Copy link
Member Author

Ah so in these URLs, it's users but it should be profiles?

has_attached_file :photo,
styles: { thumb: '200x200#', medium: '500x500#', large: '800x800#' },
url: '/public/system/profile/photos/:id/:style/:basename.:extension',
path: ':rails_root/public/system/public/system/profile/photos/:id/:style/:filename'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, the other way around. So the images you're finding are at users but we are pointing to profile?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jywarren
Copy link
Member Author

Confirmed it worked!

so, images are now pointed at https://unstable.publiclab.org/public/system/profile/photos/152/thumb/DSCN6508.JPG

so i remove "unstable." and it works https://publiclab.org/public/system/profile/photos/152/thumb/DSCN6508.JPG

i'll try uploading a new image just to final check

great, i believe it worked!

it uploaded to https://publiclab.org/public/system/profile/photos/1/medium/aseprite_templates.png

ok, let's merge and deploy

@jywarren jywarren merged commit d3a19b3 into main Aug 23, 2021
@jywarren
Copy link
Member Author

reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
* Update user.rb

* adjusted url param for profile images

* adjusted custom route for profile images
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
* Update user.rb

* adjusted url param for profile images

* adjusted custom route for profile images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile images on profile page aren't lazy loading
2 participants