Merge remote-tracking branch 'origin/develop' into navigation-update

* origin/develop:
  Update dependency opn to v5
  fix notices being under the navbar, also change offset to use variable
  fix modals not having proper z index
  reduce indexes to be below 9999 so that develop error messages appear above
  Do not allow to find by name in findUser()
  Use lookup endpoint to obtain users by nickname
  Use $ for id UserProfile routes
  Allow opening profile: multiChoiceProprties record, anonymous access
  Allow opening profile when clicking an avatar inside of user popover
This commit is contained in:
Henry Jameson 2022-08-23 21:52:17 +03:00
commit cd7380efe7
16 changed files with 139 additions and 58 deletions

View file

@ -29,10 +29,10 @@
.global-notice-list {
position: fixed;
top: 50px;
top: calc(var(--navbar-height) + 0.5em);
width: 100%;
pointer-events: none;
z-index: var(--ZI_popovers);
z-index: var(--ZI_navbar_popovers);
display: flex;
flex-direction: column;
align-items: center;

View file

@ -44,6 +44,11 @@ const GeneralTab = {
value: mode,
label: this.$t(`settings.third_column_mode_${mode}`)
})),
userPopoverAvatarActionOptions: ['close', 'zoom', 'open'].map(mode => ({
key: mode,
value: mode,
label: this.$t(`settings.user_popover_avatar_action_${mode}`)
})),
loopSilentAvailable:
// Firefox
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||

View file

@ -60,12 +60,14 @@
</BooleanSetting>
</li>
<li>
<BooleanSetting
path="userPopoverZoom"
<ChoiceSetting
id="userPopoverAvatarAction"
path="userPopoverAvatarAction"
:options="userPopoverAvatarActionOptions"
expert="1"
>
{{ $t('settings.user_popover_avatar_zoom') }}
</BooleanSetting>
{{ $t('settings.user_popover_avatar_action') }}
</ChoiceSetting>
</li>
<li>
<BooleanSetting

View file

@ -11,8 +11,8 @@ const UserPopover = {
Popover: defineAsyncComponent(() => import('../popover/popover.vue'))
},
computed: {
userPopoverZoom () {
return this.$store.getters.mergedConfig.userPopoverZoom
userPopoverAvatarAction () {
return this.$store.getters.mergedConfig.userPopoverAvatarAction
},
userPopoverOverlay () {
return this.$store.getters.mergedConfig.userPopoverOverlay

View file

@ -14,7 +14,7 @@
class="user-popover"
:user-id="userId"
:hide-bio="true"
:avatar-action="userPopoverZoom ? 'zoom' : close"
:avatar-action="userPopoverAvatarAction == 'close' ? close : userPopoverAvatarAction"
:on-close="close"
/>
</template>

View file

@ -45,7 +45,7 @@ const UserProfile = {
},
created () {
const routeParams = this.$route.params
this.load(routeParams.name || routeParams.id)
this.load({ name: routeParams.name, id: routeParams.id })
this.tab = get(this.$route, 'query.tab', defaultTabKey)
},
unmounted () {
@ -106,12 +106,17 @@ const UserProfile = {
this.userId = null
this.error = false
const maybeId = userNameOrId.id
const maybeName = userNameOrId.name
// Check if user data is already loaded in store
const user = this.$store.getters.findUser(userNameOrId)
const user = maybeId ? this.$store.getters.findUser(maybeId) : this.$store.getters.findUserByName(maybeName)
if (user) {
loadById(user.id)
} else {
this.$store.dispatch('fetchUser', userNameOrId)
(maybeId
? this.$store.dispatch('fetchUser', maybeId)
: this.$store.dispatch('fetchUserByName', maybeName))
.then(({ id }) => loadById(id))
.catch((reason) => {
const errorMessage = get(reason, 'error.error')
@ -150,12 +155,12 @@ const UserProfile = {
watch: {
'$route.params.id': function (newVal) {
if (newVal) {
this.switchUser(newVal)
this.switchUser({ id: newVal })
}
},
'$route.params.name': function (newVal) {
if (newVal) {
this.switchUser(newVal)
this.switchUser({ name: newVal })
}
},
'$route.query': function (newVal) {