FEATURE: image uploads now have short urls

Shorten all image uploads to use short urls, this is the client
side implementation.
This commit is contained in:
Sam
2017-08-22 16:40:01 -04:00
parent 605653a369
commit d7a2584c6e
9 changed files with 97 additions and 7 deletions

View File

@ -36,6 +36,13 @@ describe UploadsController do
xhr :post, :create, file: logo, type: "super \# long \//\\ type with \\. $%^&*( chars" * 5
end
it 'can look up long urls' do
upload = Fabricate(:upload)
xhr :post, :lookup_urls, short_urls: [upload.short_url]
result = JSON.parse(response.body)
expect(result[0]["url"]).to eq(upload.url)
end
it 'is successful with an image' do
Jobs.expects(:enqueue).with(:create_avatar_thumbnails, anything)
@ -78,6 +85,7 @@ describe UploadsController do
expect(response.status).to eq 200
expect(json["id"]).to be
expect(json["short_url"]).to eq("upload://qUm0DGR49PAZshIi7HxMd3cAlzn.png")
end
it 'correctly sets retain_hours for admins' do