Merge remote-tracking branch 'upstream/pull/4136'

This commit is contained in:
Tom Hughes 2023-08-03 11:25:14 +01:00
commit a9b616af12
2 changed files with 2 additions and 2 deletions

View file

@ -22,7 +22,7 @@ class ApplicationController < ActionController::Base
def authorize_web def authorize_web
if session[:user] if session[:user]
self.current_user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first self.current_user = User.where(:id => session[:user], :status => %w[active confirmed suspended]).first
if session[:fingerprint] && if session[:fingerprint] &&
session[:fingerprint] != current_user.fingerprint session[:fingerprint] != current_user.fingerprint

View file

@ -35,7 +35,7 @@ class Trace < ApplicationRecord
has_many :points, :class_name => "Tracepoint", :foreign_key => "gpx_id", :dependent => :delete_all, :inverse_of => :trace has_many :points, :class_name => "Tracepoint", :foreign_key => "gpx_id", :dependent => :delete_all, :inverse_of => :trace
scope :visible, -> { where(:visible => true) } scope :visible, -> { where(:visible => true) }
scope :visible_to, ->(u) { visible.where("visibility IN ('public', 'identifiable') OR user_id = ?", u) } scope :visible_to, ->(u) { visible.where(:visibility => %w[public identifiable]).or(visible.where(:user => u)) }
scope :visible_to_all, -> { where(:visibility => %w[public identifiable]) } scope :visible_to_all, -> { where(:visibility => %w[public identifiable]) }
scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) } scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) }