Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared boards have some titles of symbols translated back to English #814

Merged
merged 1 commit into from
Dec 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions src/components/Board/Board.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ export class BoardContainer extends Component {
* Adds a Board to the Active Communicator
*/
addBoardCommunicator: PropTypes.func.isRequired,
downloadImages: PropTypes.func
downloadImages: PropTypes.func,
lang: PropTypes.string
};

state = {
Expand Down Expand Up @@ -395,7 +396,7 @@ export class BoardContainer extends Component {
const tiles = board.tiles.map(tile => ({
...tile,
label:
tile.labelKey && intl.messages[tile.labelKey]
tile.labelKey && intl.messages[tile.labelKey] && !board.locale
? intl.formatMessage({ id: tile.labelKey })
: tile.label
}));
Expand Down Expand Up @@ -455,7 +456,8 @@ export class BoardContainer extends Component {
upsertCommunicator,
changeCommunicator,
replaceBoard,
updateApiObjectsNoChild
updateApiObjectsNoChild,
lang
} = this.props;

var createCommunicator = false;
Expand All @@ -469,7 +471,8 @@ export class BoardContainer extends Component {
...board,
author: userData.name,
email: userData.email,
hidden: false
hidden: false,
locale: lang
};
//check if user has an own communicator
let communicatorData = { ...communicator };
Expand Down Expand Up @@ -614,7 +617,7 @@ export class BoardContainer extends Component {
};

updateIfFeaturedBoard = board => {
const { userData, updateBoard, intl } = this.props;
const { userData, updateBoard, intl, lang } = this.props;
let boardData = {
...board
};
Expand All @@ -632,7 +635,8 @@ export class BoardContainer extends Component {
author: userData.name,
email: userData.email,
hidden: false,
isPublic: false
isPublic: false,
locale: lang
};
updateBoard(boardData);
}
Expand Down Expand Up @@ -926,7 +930,8 @@ export class BoardContainer extends Component {
updateApiObjects,
replaceBoard,
updateBoard,
switchBoard
switchBoard,
lang
} = this.props;

// Loggedin user?
Expand Down Expand Up @@ -980,7 +985,8 @@ export class BoardContainer extends Component {
tiles: uTiles,
author: userData.name,
email: userData.email,
hidden: false
hidden: false,
locale: lang
};
//check if user has an own communicator
let communicatorData = { ...communicator };
Expand All @@ -1007,7 +1013,7 @@ export class BoardContainer extends Component {
isPublic: false,
author: userData.name,
email: userData.email,
locale: userData.locale,
locale: lang,
caption: tile.image
};
childBoardData = { ...boardData };
Expand Down Expand Up @@ -1093,11 +1099,11 @@ export class BoardContainer extends Component {

handleCopyRemoteBoard = async () => {
const { intl, showNotification } = this.props;
await this.createBoarsRecursively(this.state.copyPublicBoard);
await this.createBoardsRecursively(this.state.copyPublicBoard);
showNotification(intl.formatMessage(messages.boardCopiedSuccessfully));
};

async createBoarsRecursively(board) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehehe

async createBoardsRecursively(board) {
const {
createBoard,
addBoardCommunicator,
Expand Down Expand Up @@ -1191,7 +1197,7 @@ export class BoardContainer extends Component {
board.tiles.forEach(async tile => {
if (tile.loadBoard) {
const nextBoard = await API.getBoard(tile.loadBoard);
this.createBoarsRecursively(nextBoard);
this.createBoardsRecursively(nextBoard);
}
});
}
Expand Down Expand Up @@ -1365,7 +1371,8 @@ const mapStateToProps = ({
communicator,
speech,
scanner,
app: { displaySettings, navigationSettings, userData }
app: { displaySettings, navigationSettings, userData },
language: { lang }
}) => {
const activeCommunicatorId = communicator.activeCommunicatorId;
const currentCommunicator = communicator.communicators.find(
Expand All @@ -1387,7 +1394,8 @@ const mapStateToProps = ({
displaySettings,
navigationSettings,
userData,
emptyVoiceAlert
emptyVoiceAlert,
lang
};
};

Expand Down