►
Description
Responding to MR feedback: "User is an omniscient class. Could this logic be encapsulated somewhere else?"
Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/421265
Branch with work in progress changes: https://gitlab.com/gitlab-org/gitlab/-/commit/082e330bc6aaf03eda79300
We also discuss Numbered block Parameters in Ruby https://medium.com/@baweaver/ruby-2-7-numbered-parameters-3f5c06a55fe4
A
Recording
has
started
okay,
I
actually,
don't
know
how
to
do
a
podcast
style
interview
but
I
or
sorry
introduction,
but
it
has
been
requested
that
we
introduced
this.
So
this
is
back
in
pairing.
We
are
three
get
lab
team
members
just
looking
to
discuss.
Sometimes.
B
A
Connect
have
some
code
therapy
yeah.
Sometimes
we
are
more
thinking
about
team
members.
We
are
also
human
beings
and
other
things
perfect.
Okay,
good
I'm,
glad
I've
got
that
out
of
the
way.
So
today,
on
our
agenda,
we
have
two
things
that
people
are
interested
in
discussing
one
is
a
refactor.
A
This
was
some
Mr
feedback
that
I
got
and
then
the
other.
Maybe
we
can
do
both
we
can
do
reproducing
CI
builds
locally
with
GDK
and
Docker
I'll
do
two
topics,
so
let
me
share
my
screen
and
I
just
found
the
branch
where
I
worked
on
this
the
other
week.
I
actually
started
working
on
this
by
myself
and
I
thought
to
myself
as
I
was
working
on.
C
A
This
would
be
more
fun
with
other
people,
because
I
received
this
feedback
and
we'll
see
to
myself.
Oh
I'll,
just
you
know
whip
this
refactor
up,
and
then
it
took
me
a
while.
A
So
here
is
the
original
feedback
from
Brian
Williams
user
is
an
omniscient
class,
it
sure
is,
could
this
logic
be
encapsulated
somewhere
else
and
I
said
the
great
idea
I
will
do
that
separately
one
month
ago
have
not
done
it
yet
so
started
some
work
on
this
I
pointed
you
all
to
this
whip
commit,
and
so
that
method
is
called
custom
permission
for
it's
in
the
ee
user
model
and
then
so
I'm
able
to
remove
it
here,
which
is
super
cool.
D
A
Also,
if
you
notice
the
customer
Mission
before,
but
it's
also
calling
these
pre-loaded
member
Rose
classes
and
I'm
actually
as
I'm
talking
about
this
I'm
kind
of
remembering
where
I
got
stuck.
So
that's
good,
because
that
before
I
was
like,
why
are
they
stop
working
on
this,
but
now
I'm
remembering
so
we
have
this
method
that
preloads
these
relationships.
A
This
is
to
prevent
n
Plus
One
issues
which
we
discussed
last
week,
and
then
we
have
the
other
one
that
does
a
preloader
specifically
for
group
relationships
that
prevents
n
plus
ones
when
there
are
groups
so
I'm
replacing
these
with
a
custom,
finder
class
custom
abilities,
finder
takes
in
the
user,
a
list
of
resources
which
could
be
groups
or
projects
and
then
just
kind
of
shuffled
that
logic
into
this
class
right
and
so
I
got
to
this
point
and
I
realized
that
I
had
forgotten
that
we
actually
sometimes
called
this
method
previously
defined
down
here
on
its
own,
like
we
pre-load
the
relation,
so
we
pass
in
a
group.
A
But
then
this
method
is
always
called
for
one
resource
because
custom
permission
for
is
called
in
policy
classes.
So
basically
say:
you're
listed
looking
at
a
group
of
projects
and
we
want
to
know
if
you
have
the
ability
to
read
all
of
those
projects.
We
call
the
preloader
to
make
sure
that
stuff's
all
cached.
B
A
Only
called
in
a
few
places
actually,
but
so
here
we
have
this
nice
little
module
where
we're
doing
a
lot
of
different
pre-loading,
and
this
I
was
trying
to
call
it
in
here.
This
is
actually
I
like
stopped
midward.
For
some
reason,
I
must
have
been
in
a
big
rush,
couldn't
couldn't
finish
whatever
I
was
gonna,
say
here:
resource
ability
or
resources
ability,
so
resources
to
your
projects.
A
Okay,
oh
and
here
yes,
this
is
the
rub.
So
in
this
context
we
might
be
checking
for
a
lot
of
different
abilities
in
the
project.
So,
let's
look
at
where
this
method
is
called
prepare
projects
for
rendering
it's
called
in
various
controllers
that
load
lists
of
projects
where
we
then
make
various
calls
on
them.
So
this
is
a
pre-loader
for
custom
permissions,
there's
also
one
for
Max
member
access,
which
pulls
the
max
access
level.
It's
like
a
list
of
integers
for
the
list
of
projects.
A
What
is
this
called
account?
Sorry
project.
A
We're
not
doing
it
to
answer
your
question
when
we
call
this
we're
not
doing
anything
with
the
result.
It's
just
calling
it
on
the
list
to
Cache
it
before
we
start
making
ability
checks
on
each
different
projects.
C
B
A
Yes
and
I
remember
when
this
logic
was
first
added.
There
were
discussions
about
like
where,
where
else
could
we
do
this
right
because
you
it
needs
to
be
in
a
context
where
you
know
the
preloading
needs
to
happen
so,
like
you,
don't
want
to
call
the
preloader,
for
example,
you're
like,
should
we
call
it
like
a
considered
initializers
or
something
like?
Is
it
like
every
time
a
request
comes
through?
Do
we
pre-load
this?
We
don't
really
need
it
for
every
request,
but
we
need
it
for
many
requests.
A
B
B
A
Hey
we're
discussing
a
refactor
so
welcome
to
the
show.
A
So
Sam
was
saying
that
calling
preload
here
we're
trying
to
refactor
this
into
like
this
finder
or
into
something
that's
not
on
user,
so
that
we're
not
just
adding
one
more
method
to
the
user
class,
which
has
you
know
thousands
of
methods,
probably
Sam,
was
kind
of
questioning
this
approach
in
general
of.
Why
are
we
calling
a
preloader
in
this
method
that
is
invoked
in
various
controllers
as
a
way
of
caching
and
I
agree,
it's
not
ideal.
C
So
if
we
just
like,
if
we
ignore
philosophically
why
it's
like
this
and
just
work
through
on
the
refactor,
maybe
and
then
we
can
come
back
to
okay,
it
might
be
that
a
better
solution
falls
out
of
just
trying
to
move
it
around
right.
Sometimes
that
happens.
Yeah.
A
A
The
new
object
is
defined
here
and
it
takes
user
resources
and
ability.
Although
it
should
be
noted
that
the
pre-loading
class
doesn't
actually
care
about
ability,
it
cares
about
user
and
it
cares
about
the
resources,
but
it
doesn't
care
about
the
ability
because
it
pre-loads
all
of
the
abilities.
A
Yeah,
like
there's,
there's
the
custom
abilities
like
preloader,
which
we
already
have
that
class.
So
this
is
where
I
started,
getting
going
down
a
refactor
a
rabbit
or
like
a
spiral
like
why
I'm
wasting
my
time
spiral
because
it's
like
well,
this
already
encapsulated
in
a
class.
All
that's
happening
here
is
that
we're
wrapping
it
with
safer
cross
loader,
so
does
that?
Does
that
require
its
own
class
or
like?
What
should
the
interface
of
this
be?
Assuming
that
this
method,
in
some
form
needs
to
be
publicly
available
to
be
called
over
here?.
C
B
A
Okay,
let's
look
into
that
really
quick,
so
user
member
roles
in
projects-
this
is
the
preloader.
So
what
you're
saying
is
that
we
should
take
this
logic
and
put
it
in
execute
or
something.
C
I
mean
you
could,
did
we
just
might
get.
B
A
B
Places
where
we
pass
like
a
cash
when
we
pass
the
cash
or
something
like
that.
A
B
Like
this
yeah,
something
like
that
or
maybe
on
initialize,
not
necessarily
on
execute.
B
We
don't
know
any
anything
with
with,
with
the
execute.
C
Kind
of
I
think
I
made.
It
would
need
the
resource
key
as
well
in
it.
A
B
Rename
the
method
name
and
then
we
have
like
a
a
another
execute
one
is
like
with
with
the
safe
request
loader
and
one
when
not
yeah,.
D
A
It
is
cool
resource.
A
Up
a
bit,
it's
too
big,
there's
also
feedback
on
that
Mr
about
refactoring
this
logic,
but
we'll
do
that
another
time
another
day.
So
who
is
request?
Okay,
look.
Can
we
rename
or
not,
execute
before
I'm
driving?
What
should
this
be
called.
A
A
hash
basically
of
project
IDs
that
point
to
the
memorables
that
the
user
has
for
the
member.
A
A
A
B
A
A
D
C
A
It
returns
a
hash
exactly
so
we're
oh
yeah,
oh
yeah,
you're
right,
so
we
just
want
this.
A
A
A
Or
could
it
return
I?
Don't
think
so
it
should
return
just
the
project
ID
pointing
to
an
empty
array
if
there
are
no
custom
abilities,
so
it
would
still
be
there
shh.
A
D
But
you
need
to
you,
need
the
the
safe
Navigator
there
to
for
for
this
to
actually
be
more
safe
sort
of
sort
of
thing.
D
B
D
C
A
A
C
A
A
D
B
C
Would
always
remember
yeah
for
me:
I
always
use
it,
because
you
get
a
meaningful
error
at
the
point
where
the
error
occurs
rather
than
somewhere
up
the
stack.
The
the
code
saying
nil
does
not
respond
to
LA,
which
is
normally
what
happens
when
you're
left
scratching
your
head
about
where
the
actual
problem
was.
D
C
B
We
can
look
at
the
member
roles,
projects
pre-loader
see
if
it
would
even
return
a
nil.
Do
we
have
situations
where
it
would.
A
Yeah
I,
don't
think
we
do
I,
don't
think.
We
would
expect
that,
based
on
my
memory
of
writing
this
code
a
while
ago,
see
when
there's
it
returns
an
empty
value
right.
So
when
there's
the
membership
has
no
custom
role,
project
ID
would
still
be
there.
It
just
points
to
a
null
value,
which
is
fine,
because
we're
just
calling
fetch
on
we'd
still
get
an
empty
array.
A
A
It's
yeah
there's
also
discussion
to
be
had
about
whether
we
could
consolidate,
but
for
now,
let's
just
worry
about
project.
So
this
this
is
cool.
We
have
safe
a
request,
loader
being
called
in
here,
which
is
great
I,
don't
have
any
unit
tests
yet
for
custom
abilities
finder,
but
let
me
just
run:
do
you
mind
if
I
I'm
just
going
to
run
this
pre-loader
unit
test,
really
quick
to
make
sure
we
didn't
like
break
the
interface
of
the
class?
It
should
just
be
a
street
view.
Factor
at
this
point.
B
C
You
need
to
do
that
that
controller
concern
as
well
right,
the
one
that
was
called
in
current
user
thought.
Yes,.
A
Yes,
we
have
to
change
out
the
other
places
where,
where
was
it
the
place
where?
Yes,
where
I
stopped
typing
even
worse,.
C
B
Stops
him
and
and
just
play
pause,
Jay
jumps
back
and
L
skips
forward.
A
C
A
A
So
this
still
works
hopefully-
and
now
in
here
we
are
going
to
so
here-
we're
not
going
to
be
calling
this
method
anymore.
Instead,
we're
actually
going
to
be
calling
the
preloader
itself
right.
So.
A
This
that's
kind
of
a
mouthful
all
right,
so
many
lines
so
we're
calling
preloader
and
then
we
don't
need
to
pull
out
the
resource
ID
or
we
don't
need
to
call
fetch
even
right,
because
we're
just
trying
to
do
a
preload
here,
so
we're
taking
the
floor
collection
of
projects.
I
think
this
is
current
users.
A
A
Okay
I
mean
having
the
starting
to
call
this.
It
seems
like
this
should,
like
maybe
the
default.
Instead,
that's
right,
like
it's
just.
C
A
I
feel
like
we
had.
We
have
some
tests
somewhere
I
think
they
were
in
the
method.
So
there
were
this.
This
safe
request,
loader
business,
was
previously
in
this
method.
I
think
the
unit
tests
for
this
method
I
did
delete
those.
Yet
no,
let's
look
for
those,
because
I
think
that
they
do
test
that
the
safe
request,
loader
is
being
called
on
line.
Two
seven,
seven,
two.
A
So
we
can
do
that
in
our
unit
tests
for
the
preloader,
so
I
see
let's
yeah.
Let's
remove
this
argument
and
just
always
use
that
I.
Don't
know
why
I
thought
we
had
to
do
it
only
sometimes
I
guess
it
was
just
felt
safer
at
the
time
get
rid
of,
let's
say
professor
and
then.
A
A
A
B
B
Cool,
it's
just
good
to
remember
too
quit
the
process
before
you
switch
branches
otherwise
like
when
you
pull
master
or
something
there
will
be
so
many
spec
changes.
So
it'll
keep
your
laptop
running
the
whole
day.
Okay,
yeah!
That's
right!
Because
it'll
like
most
of
the
tests,
we
don't
run
again,
but.
A
A
D
A
A
B
I,
don't
have
that
much
confidence
in
my
commits
that
that
seems
like
a
long
feedback.
Loop,
yeah.
A
It's
probably
because
the
data
has
already
been
preloaded
in
cash
right,
so
this
test
online
36
online
36.
I'm,
guessing
if
we
run
it
on
its
own,
it
will
pass.
D
D
A
D
D
D
B
A
A
A
It
is,
it
is
some
my
Branch
I've
done
some
work
on,
but
I
don't
think.
Let
me
navigate
this
more
intelligently,
I,
don't
that
wasn't
right
out
of
these
changed
files.
I
hadn't
changed
the
preloader
yet
before
this.
So
these
should
be
the
only
changes
to
the
preloader.
B
So
can
we
were
there
any
like
next,
if
or
or
in
the
previous
implementation?
Yes,.
A
Well
in
here
there
is
next
and
last
project
custom
rolls
enabled
which
that
method
looks
for
the
license,
so
that
I
guess
it
is
happening
there.
D
A
D
C
A
Yeah,
okay,
so
comment
out
to
these
you
mean
yeah,
okay,
I
think
welcome
to
answer
your
question:
let's
run
this,
but
also
I.
Think
what's
going
on
with
this
shared
example,
great
examples
there's
two
context
blocks
and
like
they
don't
necessarily
run
in
this
order
right,
they
could
run
in
any.
A
C
B
A
D
A
Is
a
flag
to
have
save
requests
reloader
work
properly,
that
came
up
last
week
in
the
M
plus
one
discussion.
We
had
some
n
Plus
One
specs
that
worked
very
differently
on
safe
request.
Letter
was
enabled
in
the
test
environment,
but.
A
I
would
expect
that
to
be
in
our
favor,
because
we
don't
want
things
to
be
cashed.
You
don't
want
save
Professor
to
be
working
okay,
so.
B
A
C
A
A
A
A
C
B
A
Yeah,
it
just
goes
no
yeah,
so
there
should
be
I
think
there
might
only
be
one
project,
I'm,
not
sure.
A
B
A
A
B
A
D
A
A
C
It
could
be
I
doubt
it
though,
but
there
might
be
a
rule
to
enable
the
safe
request,
loader
mode
on
all
of
the
specs
within
that
directory.
C
So
they
might
not
lead
the
the
metadata
flag
on
them
to
do.
D
A
C
So
below
line
17,
can
you
create
a
local
variable.
D
A
C
A
C
B
Oh,
that's
it
yeah,
but
it's
before
the
doob
I'm,
not
sure
if
it
works
for
share
examples,
but
let's
try
it
out.
Okay,.
A
A
A
A
C
A
A
A
B
A
D
D
D
A
B
I
mean
I
think
it
means
it's
just
not
used,
or
is
it
the
first.
D
B
A
simple
block
with
positional
arguments:
you
can
do
the
following
and
then
okay,
you
can
just
one
is
the
first
parameter
to
the
block
function.
Okay,.
D
B
It's
just
the
first
argument
and
then
that
would
be
that
to
a
the
resource
mapping.
Let's
see
resource
IDs,
minus
resource
data
keys.
B
B
B
B
A
D
B
C
D
It's
basically
the
result
of
this
operation
populated
the
default
value
as
a
hash.
Okay,
yeah.
A
D
A
Yeah,
maybe
this
means
sorry
we're
at
the
end
of
our
time,
so
I
should
make
sure
you
wrap
up
on
time,
but
I
think
what
I'm
going
to
do
moving
forward.
This
is
super
helpful,
is
either
just
update
the
specs
here
or
I.
Guess
I
have
to
think
about
what
I
needed
to
do,
because
I
can't
remember
the
significance
of
why
we
need
a
license
check
to
make
sure
that
data
isn't
returned,
but
that
might
be
important
important
to
check
for
so
I.
A
Thanks
for
joining
I
look
forward
to
seeing
you
all
next
week,
there
are
things
on
the
dock.
If
you
want
to
look
on
them,
yeah
appreciate
it.