Skip to content

Commit

Permalink
Release 3.2.2 - Session renaming bug (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinejaussoin authored Nov 8, 2020
1 parent 5aa53bd commit 9ddd9a5
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ When using the Docker deployment, your database runs from a container. But if yo

## Versions History

### Version 3.2.2

- Fixed a bug where any user editing the name of the session would become owner of the session.

### Version 3.2.1

- Fixed a serious bug under Firefox, where users could not see the content of the post ([#154](https:/antoinejaussoin/retro-board/issues/154), [#148](https:/antoinejaussoin/retro-board/issues/148)). 👏 Thanks to all people who reported this ([@Xyaren](https:/Xyaren), [@dallasgutauckis](https:/dallasgutauckis), [@courtney-thwaites](https:/courtney-thwaites)).
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": "retro-board",
"version": "3.2.1",
"version": "3.2.2",
"description": "An agile retrospective board - Powering www.retrospected.com",
"private": true,
"workspaces": [
Expand Down
2 changes: 1 addition & 1 deletion retro-board-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "retro-board-app",
"version": "3.2.1",
"version": "3.2.2",
"license": "GNU GPLv3",
"private": true,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion retro-board-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "retro-board-common",
"version": "3.2.1",
"version": "3.2.2",
"license": "GNU GPLv3",
"private": true,
"main": "dist/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion retro-board-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "retro-board-server",
"version": "3.2.1",
"version": "3.2.2",
"license": "GNU GPLv3",
"private": true,
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions retro-board-server/src/db/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ const getOrSaveUser = (userRepository: UserRepository) => async (
return await userRepository.saveFromJson(user);
};

const updateName = (sessionRepository: SessionRepository) => async (
sessionId: string,
name: string
): Promise<void> => {
await sessionRepository.updateName(sessionId, name);
};

const deleteSessions = (sessionRepository: SessionRepository) => async (
userId: string,
sessionId: string
Expand Down Expand Up @@ -418,5 +425,6 @@ export default async function db(): Promise<Store> {
previousSessions: previousSessions(sessionRepository),
getDefaultTemplate: getDefaultTemplate(userRepository),
deleteSession: deleteSessions(sessionRepository),
updateName: updateName(sessionRepository),
};
}
7 changes: 7 additions & 0 deletions retro-board-server/src/db/repositories/SessionRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export default class SessionRepository extends Repository<Session> {
});
return options;
}
async updateName(sessionId: string, name: string) {
const sessionEntity = await this.findOne(sessionId);
if (sessionEntity) {
sessionEntity.name = name;
await this.save(sessionEntity);
}
}
async saveFromJson(
session: Omit<JsonSession, 'createdBy'>,
authorId: string
Expand Down
9 changes: 1 addition & 8 deletions retro-board-server/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ export default (store: Store, io: SocketIO.Server) => {
socket.emit(action, data);
};

const persistSession = async (userId: string | null, session: Session) => {
if (!userId) {
return;
}
await store.saveSession(userId, session);
};

const updateOptions = async (
userId: string | null,
session: Session,
Expand Down Expand Up @@ -276,7 +269,7 @@ export default (store: Store, io: SocketIO.Server) => {
return;
}
session.name = data.name;
await persistSession(userId, session);
await store.updateName(session.id, data.name);
sendToAll(socket, session.id, RECEIVE_SESSION_NAME, data.name);
};

Expand Down
1 change: 1 addition & 0 deletions retro-board-server/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export interface Store {
session: Session,
columns: ColumnDefinition[]
) => Promise<ColumnDefinition[]>;
updateName: (sessionId: string, name: string) => Promise<void>;
}

export interface Configuration {
Expand Down

0 comments on commit 9ddd9a5

Please sign in to comment.