disable caching for reverse relations
This commit is contained in:
parent
e67ca77ad1
commit
7ab5346198
@ -98,6 +98,17 @@ export class RelationManagerService {
|
|||||||
viewModel: BaseViewModel,
|
viewModel: BaseViewModel,
|
||||||
relation: RelationDefinition
|
relation: RelationDefinition
|
||||||
): any {
|
): any {
|
||||||
|
// No cache for reverse relations.
|
||||||
|
// The issue: we cannot invalidate the cache, if a new object is created (The
|
||||||
|
// following example is for a O2M foreign relation):
|
||||||
|
// There is no possibility to detect the create case: The target does not update,
|
||||||
|
// all related models does not update. The autoupdate does not provide the created-
|
||||||
|
// information. So we may check, if the relaten has changed in length every time. But
|
||||||
|
// this is the same as just resolving the relation every time it is requested. So no cache here.
|
||||||
|
if (isReverseRelationDefinition(relation)) {
|
||||||
|
return this.handleRelation(model, viewModel, relation) as BaseViewModel | BaseViewModel[];
|
||||||
|
}
|
||||||
|
|
||||||
let result: any;
|
let result: any;
|
||||||
|
|
||||||
const cacheProperty = '__' + property;
|
const cacheProperty = '__' + property;
|
||||||
|
@ -78,14 +78,18 @@ export class SearchValueSelectorComponent extends BaseFormControlComponent<Selec
|
|||||||
if (!value) {
|
if (!value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.subscriptions.push(
|
if (Array.isArray(value)) {
|
||||||
value.pipe(auditTime(10)).subscribe(items => {
|
this.selectableItems = value;
|
||||||
this.selectableItems = items;
|
} else {
|
||||||
if (this.contentForm) {
|
this.subscriptions.push(
|
||||||
this.disabled = !items || (!!items && !items.length);
|
value.pipe(auditTime(10)).subscribe(items => {
|
||||||
}
|
this.selectableItems = items;
|
||||||
})
|
if (this.contentForm) {
|
||||||
);
|
this.disabled = !items || (!!items && !items.length);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public searchValue: FormControl;
|
public searchValue: FormControl;
|
||||||
|
@ -27,11 +27,6 @@ type OptionsObject = { user_id: number; user: ViewUser }[];
|
|||||||
styleUrls: ['./assignment-poll-dialog.component.scss']
|
styleUrls: ['./assignment-poll-dialog.component.scss']
|
||||||
})
|
})
|
||||||
export class AssignmentPollDialogComponent extends BasePollDialogComponent implements OnInit {
|
export class AssignmentPollDialogComponent extends BasePollDialogComponent implements OnInit {
|
||||||
/**
|
|
||||||
* The actual poll data to work on
|
|
||||||
*/
|
|
||||||
public poll: AssignmentPoll;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The summary values that will have fields in the dialog
|
* The summary values that will have fields in the dialog
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@ from django.db import migrations, models
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("core", "0025_projector_color"),
|
("core", "0026_remove_history_restricted"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
@ -37,7 +37,7 @@ def calculate_aspect_ratios(apps, schema_editor):
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("core", "0026_projector_size_1"),
|
("core", "0027_projector_size_1"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
@ -6,7 +6,7 @@ from django.db import migrations
|
|||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("core", "0027_projector_size_2"),
|
("core", "0028_projector_size_2"),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
@ -8,6 +8,7 @@ from jsonfield import JSONField
|
|||||||
|
|
||||||
from openslides.utils.autoupdate import AutoupdateElement
|
from openslides.utils.autoupdate import AutoupdateElement
|
||||||
from openslides.utils.cache import element_cache, get_element_id
|
from openslides.utils.cache import element_cache, get_element_id
|
||||||
|
from openslides.utils.locking import locking
|
||||||
from openslides.utils.manager import BaseManager
|
from openslides.utils.manager import BaseManager
|
||||||
from openslides.utils.models import SET_NULL_AND_AUTOUPDATE, RESTModelMixin
|
from openslides.utils.models import SET_NULL_AND_AUTOUPDATE, RESTModelMixin
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ from mypy_extensions import TypedDict
|
|||||||
from ..utils.websocket import WEBSOCKET_CHANGE_ID_TOO_HIGH
|
from ..utils.websocket import WEBSOCKET_CHANGE_ID_TOO_HIGH
|
||||||
from . import logging
|
from . import logging
|
||||||
from .auth import UserDoesNotExist, async_anonymous_is_enabled
|
from .auth import UserDoesNotExist, async_anonymous_is_enabled
|
||||||
from .autoupdate import AutoupdateFormat
|
|
||||||
from .cache import ChangeIdTooLowError, element_cache, split_element_id
|
from .cache import ChangeIdTooLowError, element_cache, split_element_id
|
||||||
from .utils import get_worker_id
|
from .utils import get_worker_id
|
||||||
from .websocket import ProtocollAsyncJsonWebsocketConsumer
|
from .websocket import ProtocollAsyncJsonWebsocketConsumer
|
||||||
|
@ -134,7 +134,7 @@ class UserCreate(TestCase):
|
|||||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||||
user = User.objects.get(username="test_name_Thimoo2ho7ahreighio3")
|
user = User.objects.get(username="test_name_Thimoo2ho7ahreighio3")
|
||||||
self.assertEqual(user.about_me, "<p><foo>bar</foo></p>")
|
self.assertEqual(user.about_me, "<p><foo>bar</foo></p>")
|
||||||
|
|
||||||
def test_double_username(self):
|
def test_double_username(self):
|
||||||
for field in ("last_name", "username"):
|
for field in ("last_name", "username"):
|
||||||
response = self.client.post(reverse("user-list"), {"username": "admin"})
|
response = self.client.post(reverse("user-list"), {"username": "admin"})
|
||||||
|
Loading…
Reference in New Issue
Block a user