Skip to content

Commit

Permalink
Merge pull request #553 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
erral committed Feb 21, 2024
2 parents 5249609 + f839a9e commit 56d8896
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 132 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [1.1.115](https://github.com/eea/volto-clms-theme/compare/1.1.114...1.1.115) - 21 February 2024

#### :bug: Bug Fixes

- fix: 3086 [Unai Etxaburu - [`9a1dd4b`](https://github.com/eea/volto-clms-theme/commit/9a1dd4b47d21b50241db599a8bcfbb3356f07d73)]

### [1.1.114](https://github.com/eea/volto-clms-theme/compare/1.1.113...1.1.114) - 21 February 2024

#### :hammer_and_wrench: Others
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-clms-theme",
"version": "1.1.114",
"version": "1.1.115",
"description": "volto-clms-theme: Volto theme for CLMS site",
"main": "src/index.js",
"author": "CodeSyntax for the European Environment Agency",
Expand Down
42 changes: 41 additions & 1 deletion src/components/CLMSProfileView/CLMSUserProfileView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import PropTypes from 'prop-types';
* CLMSProfileView container.
* @module components/CLMSProfileView/CLMSProfileView
*/

const messages = defineMessages({
UserProfile: {
id: 'UserProfile',
Expand Down Expand Up @@ -72,6 +71,10 @@ const messages = defineMessages({
id: 'Success',
defaultMessage: 'Success',
},
missingData: {
id: 'Missing data',
defaultMessage: 'Please fill all required data',
},
});

/**
Expand Down Expand Up @@ -116,6 +119,30 @@ class CLMSUserProfileView extends Component {
componentDidMount() {
this.props.getUser(this.props.userId);
this.props.getUserSchema();
(this.props.user?.affiliation === null ||
this.props.user?.country === null ||
this.props.user?.sector_of_activity === null ||
this.props.user?.thematic_activity === null) &&
window.location.assign('/en/profile');
(this.props.user?.affiliation === null ||
this.props.user?.country === null ||
this.props.user?.sector_of_activity === null ||
this.props.user?.thematic_activity === null) &&
toast.error(
<Toast
error
title={this.props.intl.formatMessage(messages.missingData)}
// content={this.props.intl.formatMessage(messages.saved)}
/>,
);
}

componentWillUnmount() {
(this.props.user?.affiliation === null ||
this.props.user?.country === null ||
this.props.user?.sector_of_activity === null ||
this.props.user?.thematic_activity === null) &&
window.location.assign('/en/profile');
}

/**
Expand Down Expand Up @@ -158,6 +185,7 @@ class CLMSUserProfileView extends Component {
}

const loggedIn = !!this.props.userId;

return (
<>
{loggedIn && (
Expand All @@ -166,6 +194,18 @@ class CLMSUserProfileView extends Component {
<h1 className="page-title">
{this.props.intl.formatMessage(messages.UserProfile)}
</h1>
{(this.props.user?.affiliation === null ||
this.props.user?.country === null ||
this.props.user?.sector_of_activity === null ||
this.props.user?.thematic_activity === null) && (
<Segment
className="profile-segment"
textAlign={'center'}
color={'red'}
>
Please fill all required data
</Segment>
)}
<p>
Use this form to update your profile details. Be aware that if
you want to change your name and e-mail address, you have to do
Expand Down

0 comments on commit 56d8896

Please sign in to comment.