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

Notifications count with hidden menu #469

Open
vavepl opened this issue Mar 7, 2020 · 0 comments
Open

Notifications count with hidden menu #469

vavepl opened this issue Mar 7, 2020 · 0 comments

Comments

@vavepl
Copy link
Contributor

vavepl commented Mar 7, 2020

What steps will reproduce the problem?

Add api to hidden menu in module, then send request for this api

What is the expected result?

Don't showing badge on module

What do you get instead? (A Screenshot can help us a lot!)

We don't have count in node but parent have badge (screen)

LUYA Check ouput (run this script and post the result: luyacheck.php)

image

Additional infos

https://github.com/luyadev/luya-module-admin/blob/master/src/apis/TimestampController.php#L80
This is my solution, maybe this will help

/**
     * Returns an array with auth_id as key and value is the diff notification count.
     *
     * @return array An array with key auth_id and value diff count
     * @since 2.0.0
     */
    private function getAuthNotifications()
    {
        $diff = [];
        foreach (UserAuthNotification::find()->where(['user_id' => Yii::$app->adminuser->id, 'is_muted' => false])->all() as $uan) {
            if (!Yii::$app->adminmenu->getApiDetail($uan->auth->api)["hiddenInMenu"]) {
                $diff[$uan->auth_id] = $uan->getDiffCount();
            }
        }
        return $diff;
    }
Q A
LUYA Version 1.0.26
Admin Version 3.0.2.0
PHP Version 7.3.13
Platform luya serve
Operating system OSX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant