Skip to content

Commit

Permalink
Use methor createAuthorIfNotExistsFor instead of createAuthor
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavotrott committed Feb 23, 2023
1 parent 0b96062 commit c912e28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/etherpad/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const Logger = require('../utils/logger');
const logger = new Logger('methods');

const AUTHOR_ID = 'authorID';
const AUTHOR_MAPPER = 'authorMapper';
const GROUP_ID = 'groupID';
const PAD_ID = 'padID';
const SESSION_ID = 'sessionID';
Expand Down Expand Up @@ -62,6 +63,12 @@ const methods = {
optional: [AUTHOR_NAME],
},
},
createAuthorIfNotExistsFor: {
params: {
mandatory: [AUTHOR_MAPPER],
optional: [AUTHOR_NAME],
},
},
listPadsOfAuthor: {
params: {
mandatory: [AUTHOR_ID],
Expand Down
2 changes: 1 addition & 1 deletion lib/redis/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ const createUser = (meetingId, {
return reject();
}

api.call('createAuthor', { name }).then(response => {
api.call('createAuthorIfNotExistsFor', { authorMapper: userId, name }).then(response => {
const authorId = response.authorID;
database[meetingId].users[userId] = {
authorId,
Expand Down

0 comments on commit c912e28

Please sign in to comment.