Skip to content

Commit

Permalink
Merge pull request #40994 from nextcloud/fix/37092/user-menu-validation
Browse files Browse the repository at this point in the history
fix(user_menu): pass only actual prop to user menu entries
  • Loading branch information
susnux authored Oct 20, 2023
2 parents e49353d + ef4db75 commit a6d137c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions core/src/components/UserMenu/UserMenuEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<NcLoadingIcon v-if="loading"
class="menu-entry__loading-icon"
:size="18" />
<img v-else :src="cachedIcon" alt="" />
<img v-else :src="cachedIcon" alt="">
{{ name }}
</a>
<button v-else>
<img :src="cachedIcon" alt="" />
<img :src="cachedIcon" alt="">
{{ name }}
</button>
</li>
Expand Down
22 changes: 20 additions & 2 deletions core/src/views/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@
</template>
<ul>
<UserMenuEntry v-for="entry in settingsNavEntries"
v-bind="entry"
:key="entry.id" />
:id="entry.id"
:key="entry.id"
:name="entry.name"
:href="entry.href"
:active="entry.active"
:icon="entry.icon" />
</ul>
</NcHeaderMenu>
</template>
Expand All @@ -58,6 +62,20 @@ import UserMenuEntry from '../components/UserMenu/UserMenuEntry.vue'

import logger from '../logger.js'

/**
* @typedef SettingNavEntry
* @property {string} id - id of the entry, used as HTML ID, for example, "settings"
* @property {string} name - Label of the entry, for example, "Personal Settings"
* @property {string} icon - Icon of the entry, for example, "/apps/settings/img/personal.svg"
* @property {'settings'|'link'|'guest'} type - Type of the entry
* @property {string} href - Link of the entry, for example, "/settings/user"
* @property {boolean} active - Whether the entry is active
* @property {number} order - Order of the entry
* @property {number} unread - Number of unread pf this items
* @property {string} classes - Classes for custom styling
*/

/** @type {SettingNavEntry[]} */
const settingsNavEntries = loadState('core', 'settingsNavEntries', [])

const translateStatus = (status) => {
Expand Down
4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.

0 comments on commit a6d137c

Please sign in to comment.