remove duplicate code

fix issue where clicking on
the same user in 2 locations on the page would not work correctly

centralize logic