Vote #79705
完了Hide menu item in the cross-project menu if the module is not enabled in any project
0%
説明
A tab in the cross-project menu is always displayed regardless of the enabled modules in projects. For example, gantt tab in the cross-project menu is always shown even if the gantt module is disabled in all projects.
I think a tab in the cross-project menu should not be displayed if no projects in the application use the module. Users disable the module because they don't want to see the tab or have any interest in the tab.
journals
--------------------------------------------------------------------------------
If you disable each modules (e.g. 'Issue tracking', 'Time tracking', 'Gantt', 'Calendar', 'News') in all projects available to logged in users, the each tabs (e.g. 'Issues', 'Spent time', 'Gantt', 'Calendar', 'News') of the cross-project menu is not displayed.
I made a patch, and attach it.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Committed. Thank you for your contribution.
--------------------------------------------------------------------------------
The current implementation generates one query per each module checked, please see the above log:
<pre>
D, [2019-01-15T05:45:00.920205 #12] DEBUG -- : EnabledModule Exists (0.9ms) SELECT 1 AS one FROM `enabled_modules` WHERE `enabled_modules`.`project_id` IN (SELECT `projects`.`id` FROM `projects` WHERE (projects.status <> 9)) AND `enabled_modules`.`name` = 'issue_tracking' LIMIT 1
D, [2019-01-15T05:45:00.922439 #12] DEBUG -- : EnabledModule Exists (0.6ms) SELECT 1 AS one FROM `enabled_modules` WHERE `enabled_modules`.`project_id` IN (SELECT `projects`.`id` FROM `projects` WHERE (projects.status <> 9)) AND `enabled_modules`.`name` = 'time_tracking' LIMIT 1
D, [2019-01-15T05:45:00.927233 #12] DEBUG -- : EnabledModule Exists (0.9ms) SELECT 1 AS one FROM `enabled_modules` WHERE `enabled_modules`.`project_id` IN (SELECT `projects`.`id` FROM `projects` WHERE (projects.status <> 9)) AND `enabled_modules`.`name` = 'gantt' LIMIT 1
D, [2019-01-15T05:45:00.930691 #12] DEBUG -- : EnabledModule Exists (0.6ms) SELECT 1 AS one FROM `enabled_modules` WHERE `enabled_modules`.`project_id` IN (SELECT `projects`.`id` FROM `projects` WHERE (projects.status <> 9)) AND `enabled_modules`.`name` = 'calendar' LIMIT 1
D, [2019-01-15T05:45:00.932697 #12] DEBUG -- : EnabledModule Exists (0.6ms) SELECT 1 AS one FROM `enabled_modules` WHERE `enabled_modules`.`project_id` IN (SELECT `projects`.`id` FROM `projects` WHERE (projects.status <> 9)) AND `enabled_modules`.`name` = 'news' LIMIT 1
</pre>
Is this ok from a performance point of view?
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
I also had a concern about these queries but as long as they are fast it should not be a problem.
--------------------------------------------------------------------------------
It is still displayed for roles that don't have permission to use any of those...
Once they click on projects tab.
My Redmine version is: 4.1.0.stable.19444
--------------------------------------------------------------------------------
related_issues
relates,Closed,5920,Unify and improve cross-project views layout