-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat(conversation): WB-3630, added 3 new endpoints #559
Conversation
…api/folders/:folderId/messages
…s/{messageId} and cleanup code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Il faudrai :
- laisser les fichiers gradle.properties supprimés
- modifier le gulpfile.js
- laisser l'appel à init
8a23a5f
to
4b524c6
Compare
This reverts commit afa0667.
conversation/backend/src/main/java/org/entcore/conversation/Conversation.java
Outdated
Show resolved
Hide resolved
conversation/backend/src/main/java/org/entcore/conversation/controllers/ApiController.java
Outdated
Show resolved
Hide resolved
conversation/backend/src/main/java/org/entcore/conversation/controllers/ApiController.java
Outdated
Show resolved
Hide resolved
conversation/backend/src/main/java/org/entcore/conversation/service/ConversationService.java
Outdated
Show resolved
Hide resolved
conversation/backend/src/main/java/org/entcore/conversation/controllers/ApiController.java
Show resolved
Hide resolved
* @param userIndex Map of ID <-> {"id": user ID, "displayName": username} | ||
* @param groupIndex Map of ID <-> {"id": group ID, "displayName": groupname} | ||
*/ | ||
static public void computeUsersAndGroupsDisplayNames( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je suis plus partisan de l'immutabilité des variables en paramètre des méthodes et du fait de retourner des objets qui résultent de l'information qu'on vient de manipuler.
Mais c'est peut-être plus une question de style de code ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'avais initialement pensé retourner des uplets, mais on est en Java 8...
Et créer une classe pour retourner 2-3 données à la fois m'a paru inutile.
conversation/backend/src/main/java/org/entcore/conversation/util/MessageUtil.java
Outdated
Show resolved
Hide resolved
if (!(o2 instanceof String)) { | ||
continue; | ||
} | ||
String[] a = ((String) o2).split("\\$"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem, je trouve galère de manipuler l'information sous forme encodée. Est-ce qu'on ne pourrait pas créer un objet qui porte l'information, avec des noms parlants.
J'avais tenté ça dans le cadre du chantier userPosition.
Ça permet aussi de documenter les "règles" de l'encodage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comme discuté ensemble, je vais proposer une implémentation alternative.
* @param message message read from DB | ||
* @param userInfos | ||
* @param lang | ||
* @param userIndex Map of ID <-> {"id": user ID, "displayName": username} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi ne pas privilégier l'utilisation d'instances de classe et de map ? du genre Map<int, UserDisplayName>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Map / JsonObject
Cela ne fait pas de différence pour moi, c'est la même structure de donnée : une collection de clés/valeurs.
En interne, un JsonObject est une instance de LinkedHashMap. userIndex
etgroupIndex
sont au format attendu par un Render de donnée en JSON.
La classe MessageUtil est dédiée au formatage des données pour les réponses du contrôleur.
* Replace recipients in a message (in DB format) with those found in an index. | ||
* @param message message read from DB | ||
* @param userIndex Map of ID <-> {"id": user ID, "displayName": username, "profile": profile} | ||
* @param groupIndex Map of ID <-> {"id": group ID, "displayName": groupname, "nbUsers": nb users, "type": type, "subType": subtype} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem : Map<int, GroupInfos>
?
@@ -35,6 +35,25 @@ public interface GroupService { | |||
"FunctionGroup", "ManualGroup", "FuncGroup", "DeleteGroup", "DirectionGroup", "FunctionalGroup", | |||
"DisciplineGroup", "CommunityGroup"); | |||
|
|||
enum Field { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je suis pas très familier du fonctionnement et de l'utilisation de ce genre d'enum avec des bitmask, je veux bien une explication à l'occasion :)
* chore: fix build scripts and POMs * chore: added a buildBackend option to build.sh * chore: rename gradle.properties files * feat(conversation): #WB-3630, added GET /conversation/api/* endpoints * feat(conversation, directory): #WB-3630, implement GET /conversation/api/folders/:folderId/messages * feat(conversation): #WB-3630, implement GET git /conversation/api/folders * feat(conversation): #WB-3630, implement GET /conversation/api/messages/{messageId} and cleanup code * Revert "chore: rename gradle.properties files" This reverts commit afa0667. * chore: feedback from PR * fix: feedback from PR
* chore: fix build scripts and POMs * chore: added a buildBackend option to build.sh * chore: rename gradle.properties files * feat(conversation): #WB-3630, added GET /conversation/api/* endpoints * feat(conversation, directory): #WB-3630, implement GET /conversation/api/folders/:folderId/messages * feat(conversation): #WB-3630, implement GET git /conversation/api/folders * feat(conversation): #WB-3630, implement GET /conversation/api/messages/{messageId} and cleanup code * Revert "chore: rename gradle.properties files" This reverts commit afa0667. * chore: feedback from PR * fix: feedback from PR
Description
Cette PR contient la PR #558 dont elle dépend, je la mettrai à jour une fois l'autre PR mergée.
Fixes
WB-3630
Type of change
Please check options that are relevant.
Which packages changed?
Please check the name of the package you changed
Tests
Reminder
Security flaws
Performance impacts (think bulk !)
Unit tests were replayed
Unit tests were added and/or changed
I have updated the reminder for the version including my modifications
All done ! 😃