diff --git a/client/src/app/core/services/constants.service.ts b/client/src/app/core/services/constants.service.ts index 3c67ba77a..6b08ba1c9 100644 --- a/client/src/app/core/services/constants.service.ts +++ b/client/src/app/core/services/constants.service.ts @@ -15,9 +15,11 @@ interface Constants { * Get constants from the server. * * @example - * this.constantsService.get('OpenSlidesSettings').subscribe(constant => { - * console.log(constant); - * }); + * ```ts + * this.constantsService.get('OpenSlidesSettings').subscribe(constant => { + * console.log(constant); + * }); + * ``` */ @Injectable({ providedIn: 'root' @@ -50,7 +52,7 @@ export class ConstantsService extends OpenSlidesComponent { super(); // The hook for recieving constants. - websocketService.getOberservable('constantsResponse').subscribe(constants => { + websocketService.getOberservable('constants').subscribe(constants => { this.constants = constants; if (this.pending) { // send constants to subscribers that await constants. @@ -64,7 +66,7 @@ export class ConstantsService extends OpenSlidesComponent { // We can request constants, if the websocket connection opens. websocketService.connectEvent.subscribe(() => { if (!this.websocketOpen && this.pending) { - this.websocketService.send('constantsRequest', {}); + this.websocketService.send('constants', {}); } this.websocketOpen = true; }); @@ -83,7 +85,7 @@ export class ConstantsService extends OpenSlidesComponent { this.pending = true; // if the connection is open, we directly can send the request. if (this.websocketOpen) { - this.websocketService.send('constantsRequest', {}); + this.websocketService.send('constants', {}); } } if (!this.pendingSubject[key]) { diff --git a/client/src/app/site/login/login.component.ts b/client/src/app/site/login/login.component.ts index 48937f332..dc870a76f 100644 --- a/client/src/app/site/login/login.component.ts +++ b/client/src/app/site/login/login.component.ts @@ -72,6 +72,13 @@ export class LoginComponent extends BaseComponent implements OnInit, OnDestroy { */ public inProcess = false; + /** + * The provacy policy send by the server. + * + * TODO: give an option to show it during login. + */ + public privacyPolicy: string; + /** * Constructor for the login component * @@ -106,9 +113,12 @@ export class LoginComponent extends BaseComponent implements OnInit, OnDestroy { super.setTitle('Login'); this.http.get(environment.urlPrefix + '/users/login/', {}).subscribe(response => { - this.installationNotice = this.matSnackBar.open(response.info_text, this.translate.instant('OK'), { - duration: 5000 - }); + if (response.info_text) { + this.installationNotice = this.matSnackBar.open(response.info_text, this.translate.instant('OK'), { + duration: 5000 + }); + } + this.privacyPolicy = response.privacy_policy; }); } diff --git a/openslides/core/apps.py b/openslides/core/apps.py index 56fa8af78..413ac7a67 100644 --- a/openslides/core/apps.py +++ b/openslides/core/apps.py @@ -121,10 +121,6 @@ class CoreAppConfig(AppConfig): config_groups[-1]['subgroups'][-1]['items'].append(config_variable.data) constants['OpenSlidesConfigVariables'] = config_groups - # Send the privacy policy to the client. A user should view them, even he is - # not logged in (so does not have the config values yet). - constants['PrivacyPolicy'] = config['general_event_privacy_policy'] - return constants diff --git a/openslides/core/views.py b/openslides/core/views.py index 7d987fed9..081d2dbc7 100644 --- a/openslides/core/views.py +++ b/openslides/core/views.py @@ -15,6 +15,7 @@ from .. import __license__ as license, __url__ as url, __version__ as version from ..utils import views as utils_views from ..utils.auth import anonymous_is_enabled, has_perm from ..utils.autoupdate import inform_changed_data, inform_deleted_data +from ..utils.constants import get_constants from ..utils.plugins import ( get_plugin_description, get_plugin_license, @@ -48,7 +49,6 @@ from .models import ( ProjectorMessage, Tag, ) -from ..utils.constants import get_constants # Special Django views diff --git a/openslides/users/views.py b/openslides/users/views.py index e0aed75bf..2622db1b9 100644 --- a/openslides/users/views.py +++ b/openslides/users/views.py @@ -453,6 +453,8 @@ class UserLoginView(APIView): password='admin') else: context['info_text'] = '' + # Add the privacy policy, so the client can display it even, it is not logged in. + context['privacy_policy'] = config['general_event_privacy_policy'] else: # self.request.method == 'POST' context['user_id'] = self.user.pk