"Fossies" - the Fresh Open Source Software Archive 
Member "discourse-3.1.1/db/fixtures/010_uploads.rb" (12 Sep 2023, 1035 Bytes) of package /linux/www/discourse-3.1.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 # frozen_string_literal: true
2
3 {
4 -1 => "d-logo-sketch.png", # Old version.
5 -2 => "d-logo-sketch-small.png", # Old version.
6 -3 => "default-favicon.ico", # No longer used.
7 -4 => "default-apple-touch-icon.png", # No longer used. id of `-4` is now reserved for internal plugin usage.
8 -5 => "discourse-logo-sketch.png",
9 -6 => "discourse-logo-sketch-small.png",
10 }.each do |id, filename|
11 path = Rails.root.join("public/images/#{filename}")
12
13 Upload.seed do |upload|
14 upload.id = id
15 upload.user_id = Discourse.system_user.id
16 upload.original_filename = filename
17 upload.url = "/images/#{filename}"
18 upload.filesize = File.size(path)
19 upload.extension = File.extname(path)[1..10]
20 # Fake an SHA1. We need to have something, so that other parts of the application
21 # keep working. But we can't use the real SHA1, in case the seeded file has already
22 # been uploaded. Use an underscore to make clash impossible.
23 upload.sha1 = "_#{Upload.generate_digest(path)}"[0..Upload::SHA1_LENGTH - 1]
24 end
25 end