Skip to content
Snippets Groups Projects
Commit 3ea26928 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch 'master' into '862-some-fields-on-person-schema-did-not-accept-returning-null-values'

# Conflicts:
#   CHANGELOG.rst
parents eb199f48 0c0b814f
No related branches found
No related tags found
1 merge request!1260Resolve "Some fields on person schema did not accept returning null values"
Pipeline #134457 failed
......@@ -15,6 +15,10 @@ Fixed
* Progress page didn't work properly.
* About page failed to load for apps with an unknown licence.
* Partial permission checking on the person query was fixed.
* Some pages couldn't be scrolled when a task progress popup was open.
* Notification query failed on admin users without persons.
* Querying for notification caused unnecessary database requests.
* Loading bar didn't disappear on some pages after loading was finished.
`3.1`_ - 2022-05-30
-------------------
......
......@@ -71,7 +71,9 @@ export default {
// Show loader if iframe starts to change its content, even if the $route stays the same
this.$refs.contentIFrame.contentWindow.onpagehide = () => {
this.$root.contentLoading = true;
if (this.$root.isLegacyBaseTemplate) {
this.$root.contentLoading = true;
}
};
// Write title of iframe to SPA window
......
<template>
<v-bottom-sheet :value="show" persistent hide-overlay max-width="400px">
<v-bottom-sheet
:value="show"
persistent
hide-overlay
max-width="400px"
ref="sheet"
>
<v-expansion-panels accordion v-model="open">
<v-expansion-panel>
<v-expansion-panel-header color="primary" class="white--text px-4">
......@@ -33,6 +39,13 @@ export default {
data() {
return { open: 0 };
},
mounted() {
// Vuetify uses the hideScroll method to disable scrolling by setting an event listener
// to the window. As event listeners can only be removed by referencing the listener
// method and because vuetify this method is called on every state change of the dialog,
// we simply replace the method in this component instance
this.$refs.sheet.hideScroll = this.$refs.sheet.showScroll;
},
computed: {
show() {
return this.celeryProgressByUser && this.celeryProgressByUser.length > 0;
......
......@@ -20,7 +20,7 @@
v-if="
myNotifications &&
myNotifications.person &&
myNotifications.person.unreadNotificationsCount > 0
myNotifications.person.notifications.length > 0
"
>
mdi-bell-badge-outline
......@@ -38,7 +38,7 @@
v-if="
myNotifications.person &&
myNotifications.person.notifications &&
myNotifications.person.notifications.length
unreadNotifications.length
"
>
<v-subheader>{{ $t("notifications.notifications") }}</v-subheader>
......@@ -86,5 +86,10 @@ export default {
pollInterval: 30000,
},
},
computed: {
unreadNotifications() {
return this.myNotifications.filter(n => !n.read);
},
},
};
</script>
{
myNotifications: whoAmI {
person {
unreadNotificationsCount
notifications {
id
title
......
......@@ -74,7 +74,7 @@ class PersonType(DjangoObjectType):
place_of_birth = graphene.String(required=False)
notifications = graphene.List(NotificationType)
unread_notifications_count = graphene.Int()
unread_notifications_count = graphene.Int(required=False)
is_dummy = graphene.Boolean()
preferences = graphene.Field(PersonPreferencesType)
......@@ -162,7 +162,11 @@ class PersonType(DjangoObjectType):
return root.user.id if root.user else None
def resolve_unread_notifications_count(root, info, **kwargs): # noqa
return root.unread_notifications_count
if root.pk and has_person(info.context) and root == info.context.user.person:
return root.unread_notifications_count
elif root.pk:
return 0
return None
def resolve_photo(root, info, **kwargs):
if info.context.user.has_perm("core.view_photo_rule", root):
......@@ -211,11 +215,11 @@ class PersonType(DjangoObjectType):
return root.is_dummy if hasattr(root, "is_dummy") else False
def resolve_notifications(root: Person, info, **kwargs):
if has_person(info.context.user) and info.context.user.person == root:
if root.pk and has_person(info.context) and root == info.context.user.person:
return root.notifications.filter(send_at__lte=timezone.now()).order_by(
"read", "-created"
)
raise PermissionDenied()
return []
def resolve_can_edit_person(root, info, **kwargs): # noqa
return info.context.user.has_perm("core.edit_person_rule", root)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment