Right now we have a few patterns. Default image for a group is a ? but default image for a repo is a circle with the first letter of the repo name. As for users, we just get it through gravatar (but in this case, we wouldn't be able to because that requires getting their email address first)
Don't we assign a generic pattern image to users without a profile picture? I think that would look a little weird in the tokens and it may be better to simply not show an image
There are currently multiple scenarios for a user (assignee, author) to be added to the search bar.
User types out the username (Eg. author:@ClemMakesApps)
User clicks on the username that is displayed on the dropdown (same as if the user filters and clicks)
User pastes the username to the search bar
In terms of architecture, it is easy to display the user's name and avatar when the user goes through scenario 2 because it is already received by the API. The implementation for the other 2 scenarios could probably be shared but I wanted to double check with the team before I proceeded.
For scenarios 1 and 3, I propose we perform an ajax request to get that specific username's name and avatar. The downsides of this proposal is that in scenario 3, if a user pastes something such as assignee:@ClemMakesApps assignee:@jschatz assignee:@filipa (multiple assignees), we would be doing 3 separate requests to get their information. It would be nice if we could have a separate API that would return all of these user's names and avatar information but AFAIK, backend does not have any bandwidth for this. Although this would have some impact to the DB/infrastructure, I think the impact should be minimal because the number of API requests would still be the same as though we typed and filtered each user's username.
In terms of UX, I was thinking that for scenarios 1 and 3, we display the author:@username and convert it into the avatar + name visual once we receive that information from the backend.
Actually @filipa, it looks like in scenario 3, the last filter is loaded using JSON (Probably because the paste triggers the dropdowns to load) but not all the filters before are loaded.
In that case let's make it behave the same for all pasted data. :) No request should be made correct? Maybe we should open a bug with this, since we thought no request was being made in the first place?
Multiple assignees (FE) review ended up taking a lot of my time this release month. I don't think I will be able to ship this Deliverable in time along with my others. Assigning to @jschatz1 as discussed in slack.
I propose we perform an ajax request to get that specific username's name and avatar.
Judging from a first look into this, we will need a new backend route. User routes currently don't have that information.
I feel comfortable adding this route myself but it will take me some time.
It would be nice if we could have a separate API that would return all of these user's names and avatar information
I agree that this would be nice but I would keep that as a performance optimization for later. Especially since we are having trouble with pasting (#31859 (moved)) and do not have a way to copy filters (#31854 (moved)).
if a user pastes something such as assignee:@ClemMakesApps assignee:@jschatz assignee:@filipa (multiple assignees)
@ClemMakesApps I just noticed that it is not possible to filter by multiple assignees nor by multiple authors. Even though it is possible to write multiple assignee:@user / author:@user tokens, only the last one is considered.
I have a theory that this would cover most of the cases this is used for, but the only way we can confirm that is by searching the logs (https://log.gitlap.com/app/kibana) which aren't really structured for this
If someone isn't a project member, we could fall back to getting their information from /$user.json - adding that information there should be fine - but I'm not really sure what else uses that
I'm not sure what happened to @filipa's suggestion above
No request should be made correct?
Sorry, @filipa, I ignored your suggestion because I didn't understand it. If we make no request for pasted data, we can't show user name and avatar. Am I misunderstanding your suggestion?
we explicitly request the autocomplete information for users, as it contains all project members.
I have a theory that this would cover most of the cases this is used for
@smcgivern There are only 20 users queried in the autocomplete and authors don't have to be project members (so they are not queried at all). I would definitely use the information from autocomplete if we have it but we can not rely on it being always available.
we could fall back to getting their information from /$user.json - adding that information there should be fine - but I'm not really sure what else uses that
@smcgivern That endpoint is used for user activity. Fetching user activity just to get user name and avatar doesn't seem right to me.
Sorry, it seems using thread here was a bad idea. Continuing unthreaded:
User types out the username (Eg. author:@ClemMakesApps)
A request is made when you type. No need for an extra request
@filipa We need an extra request if user is not within 20 autocompleted users or is not project member.
A request is made when we open the dropdown. No need for an extra request
Yep, agreed.
A request is made when we paste data. No need for an extra request.
Currently, pasting data doesn't make a request for every user (which should be fixed, probably in #31859 (moved)). But I agree that if we make the request when pasting, there is no need to make an additional request.
From the available options the API is the only one which already returns the necessary data and not much more—no backend modification would be necessary.
So my plan here would be:
1. User types out the username (Eg. author:@ClemMakesApps)
Use autocomplete data if available. Otherwise make API call.
2. User clicks on the username that is displayed on the dropdown (same as if the user filters and clicks)
Use data from dropdown.
3. User pastes the username to the search bar
For every pasted user that is neither fetched by autocomplete nor by dropdown, make API call.
Not sure where you got this information but multiple assignees doesn't have a max limit
@ClemMakesApps By "right now" I meant current version on gitlab.com—so without multiple assignees. The 2 comes from one author + one assignee filter as every additional author or assignee overwrites the previous one in the search bar.