Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some JS events on entities no longer triggered #18771

Closed
tsteur opened this issue Feb 10, 2022 · 6 comments
Closed

Some JS events on entities no longer triggered #18771

tsteur opened this issue Feb 10, 2022 · 6 comments
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Milestone

Comments

@tsteur
Copy link
Member

tsteur commented Feb 10, 2022

On cloud in javascripts/account.js we are listening to some events when eg a site gets added and then check if the user is allowed to create another user or site.

We just noticed in tests this may be broken / no longer working. Likely because of vue.js.

We're doing in the code things like

    $rootScope.$on('Segmentation.initAddSegment', function (event, parameters) {
        parameters.isAllowed = checkIsFeatureAllowed('segments');
    });

    $rootScope.$on('Goals.initAddGoal', function (event, parameters) {
        parameters.isAllowed = checkIsFeatureAllowed('goals');
    });

    $rootScope.$on('TagManager.initAddContainer', function (event, parameters) {
        parameters.isAllowed = checkIsFeatureAllowed('tagmanager');
    });

    $rootScope.$on('UsersManager.initAddUser', function (event, parameters) {
        parameters.isAllowed = checkIsFeatureAllowed('users');
    });

    $rootScope.$on('CustomDimensions.initAddDimension', function (event, parameters) {
        ...
    });
    $rootScope.$on('SitesManager.initAddSite', function (event, parameters) {
     ...
...

Can we check if these events are still triggered? Eg I couldn't find any event named UsersManager.initAddUser in the code. And how would we listen to these events now assuming they aren't triggered on angular $rootScope anymore.

They were triggered eg when clicking on the "add new user" button and then we would check if the user can create a new user and if not, show a popover explaining the issue that limit was reached.

cc @diosmosis

@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should. labels Feb 10, 2022
@tsteur tsteur added this to the 4.8.0 milestone Feb 10, 2022
@diosmosis
Copy link
Member

@tsteur on my 4.5.0 checkout I can't find UsersManager.initAddUser. The other events should still triggered. I tested locally and if I add:

  window.piwikHelper.getAngularDependency('$rootScope').$on('Segmentation.initAddSegment', function (event, parameters) {
    console.log('sdkjlfsjdf');
  });

to some JS, then try to add a segment, I will see the output. It's possible the initAddUser method was removed some time in the past. I'll see if it's in any older files.

@diosmosis
Copy link
Member

@tsteur the UsersManager.initAddUser event was removed in the users management rewrite, added it back to #18583 in 9a50c86.

@diosmosis
Copy link
Member

The other events should work as long as they are present.

@tsteur
Copy link
Member Author

tsteur commented Feb 10, 2022

great 👍 thanks a lot

@sgiehl
Copy link
Member

sgiehl commented Feb 14, 2022

@tsteur Anything else needed here?

@tsteur
Copy link
Member Author

tsteur commented Feb 14, 2022

That's all 👍

@sgiehl sgiehl closed this as completed Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Projects
None yet
Development

No branches or pull requests

3 participants