Merge branch 'master' of salsa.debian.org:debian/debshots

This commit is contained in:
Christoph Haas 2020-04-20 20:29:06 +02:00
commit 33086f9430
12 changed files with 132 additions and 52 deletions

View file

@ -7,12 +7,14 @@ class Users::MySessionsController < Devise::SessionsController
old_screenshots = session[:uploaded_screenshots]
if old_screenshots.to_a.length > 0
old_screenshots.each do |id|
next unless id # sometimes we had 'nil' here
ss = Screenshot.find(id)
ss.user = @user
ss.save!
end
flash[:info] = "#{old_screenshots.to_a.length} uploads have been added to your account"
Log.log "Anonymously uploaded screenshots #{old_screenshots} added to account."
# The message is probably confusing. Just add the screenshots.
# flash[:info] = "#{old_screenshots.to_a.length} uploads have been added to your account"
Log.log "Anonymously uploaded screenshots #{old_screenshots} added to #{current_user}."
session[:uploaded_screenshots] = nil
end
end

View file

@ -3,12 +3,11 @@ class WelcomeController < ApplicationController
# TODO: Only approved screenshots!
@newest_upload = Screenshot.newest_upload
# TODO: Use the actually most popular package and not just a random one
@most_popular_package = Package.order(:visits).last
@most_popular_package = Package.with_screenshots.order(visits: :desc).first
@package_count = Package.count
@most_wanted_package = Package.without_screenshots_most_visits.first
@most_wanted_package = Package.without_screenshots.order(visits: :desc).first
end
def about