Also, once !11404 (merged) is merged, we should consider adding a UsersCache.currentUser and prefill UsersCache from gon. Then we could solely rely on UsersCache in frontend code.
@iamphill I though the main reason we did not want to do that was because we did not knew what the project and namespace were.
Are there other reasons?
Not only we need to know the current user we also need to know the namespace and the project name
@filipa Since we need the current user's avatar for the issues mentioned above and I haven't found a way without making an additional Ajax call, I'd like to focus on a solution for that particular problem rather than creating a general context right now.
@filipa Nope. What if the paths change in the future? We'd have to go through all the frontend to check. We'd also have to take into consideration that GitLab can be hosted in a sub-directory. Its doable, but much easier to let the backend give us the full link we need, single source of truth.
Yah, so to clear up gon... We don't want to use it for much at all, but I wouldn't say its deprecated. In some cases its the only sane solution. I could have missed a big discussion about this however.
It's not a good solution for you to simply share any backend data with some frontend component. It will get too bloated and eventually when we want to remove that final inline script it will be a huge task.
It is however a fine solution for sharing backend data that is used on a lot of pages. So, I'd say current_user applies.
This still can follow "flux". We have a service. This service queries (through dom, object accessor, or network) for some specific data. In this case current_user data in object. This is then in the store, and component can use it one way.
From docs:
Calling the Service to get data from the serverobject
@winh isn't this ajax call made somewhere? How do we get the data in the first place?
@filipa Currently, we use gon for that which inserts a script tag into the current page and assigns data to the global window.gon object. This is ugly, but we get this data "for free" (without an extra Ajax call).
If we do the Ajax call for user data upon page load, it probably doesn't slow down any component that needs it. I'm only a bit hesitant because if that call fails for whatever reason, we would not be able to display the data until we make another call.
Like I said, nothing so grave that it would keep me from using that approach.
If we do the Ajax call for user data upon page load, it probably doesn't slow down any component that needs it. I'm only a bit hesitant because if that call fails for whatever reason, we would not be able to display the data until we make another call.
So we are going to do the same things twice:
Backend grabs data from DB and renders HTML with user data.
Frontend makes an AJAX call and grabs the part of already rendered user data.
Maybe it's worth to add a thin JS function which will take data from gon (backend will put it while rendering HTML), place the data to a frontend storage, and clear gon.
Pros:
No need to make things twice.
No need to use global variable (gon).
Ability to use storage and synchronize it with different AJAX calls if they'll fired later on the page.
GitLab is moving all development for both GitLab Community Edition
and Enterprise Edition into a single codebase. The current
gitlab-ce repository will become a read-only mirror, without any
proprietary code. All development is moved to the current
gitlab-ee repository, which we will rename to just gitlab in the
coming weeks. As part of this migration, issues will be moved to the
current gitlab-ee project.
If you have any questions about all of this, please ask them in our
dedicated FAQ issue.
Using "gitlab" and "gitlab-ce" would be confusing, so we decided to
rename gitlab-ce to gitlab-foss to make the purpose of this FOSS
repository more clear
I created a merge requests for CE, and this got closed. What do I
need to do?
Everything in the ee/ directory is proprietary. Everything else is
free and open source software. If your merge request does not change
anything in the ee/ directory, the process of contributing changes
is the same as when using the gitlab-ce repository.
Will you accept merge requests on the gitlab-ce/gitlab-foss project
after it has been renamed?
No. Merge requests submitted to this project will be closed automatically.
Will I still be able to view old issues and merge requests in
gitlab-ce/gitlab-foss?
Yes.
How will this affect users of GitLab CE using Omnibus?
No changes will be necessary, as the packages built remain the same.
How will this affect users of GitLab CE that build from source?
Once the project has been renamed, you will need to change your Git
remotes to use this new URL. GitLab will take care of redirecting Git
operations so there is no hard deadline, but we recommend doing this
as soon as the projects have been renamed.
Where can I see a timeline of the remaining steps?