- if target_user.nil? # all traces
- if @user
- @traces = Trace.visible_to(@user) # 1
- else
- @traces = Trace.visible_to_all # 2
- end
- else
- if @user && @user == target_user
- @traces = @user.traces # 3 (check vs user id, so no join + can't pick up non-public traces by changing name)
- else
- @traces = target_user.traces.visible_to_all # 4
- end
- end
+ @traces = if target_user.nil? # all traces
+ if current_user
+ Trace.visible_to(current_user) # 1
+ else
+ Trace.visible_to_all # 2
+ end
+ elsif current_user && current_user == target_user
+ current_user.traces # 3 (check vs user id, so no join + can't pick up non-public traces by changing name)
+ else
+ target_user.traces.visible_to_all # 4
+ end