branch feature/14_add_rss_feed updated (a8face4b -> dc0581ec)
This is an automated email from the git hooks/post-receive script. New change to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git omits a8face4b refs #14 création du flux atom à la création du sondage + ajout des entrées dans le flux pour l'ajout, la suppression et la modification d'un vote + ajout du bouton pour lire le flux à partir du sondage adds b8c44987 Les dates étaient retournées formatées selon la timezone du serveur. Renvoi des dates sous forme de timestamp pour que le client les affiche dans sa timezone. adds 87237839 Création de sondage : validation des choix avant de passer à l'étape suivante. adds 233ce949 ref #64 correction de la NPE adds 2318dc2f fixes #64 par défaut, on ne met pas la date de début de vote à la fin de la période d'ajout de choix adds d059538c gestion des participant d'un sondage adds 1f0b53c2 gestion des participant d'un sondage : fix test adds 4a48b234 fixes #66 Type de sondage dans la description adds cc3fd2d1 vote pour de sondage restreint adds f18cc728 vote pour de sondage restreint adds c58910b0 refs #23 remove vote summary notification as we cannot really determine the vote edition and deletion for a period adds 739ccaea fix validation du choix de fichier qui ne s'affichait pas sous Chrome adds a2fde28a refs #23 remove forgotten method adds 6bfa1b6d utilisation de la lib Object.values pour les navigateurs ne supportant pas encore cette function native js adds 50e10760 correction de l'édition des dates dans le sondage adds 30c80cc3 dépouillement des sondages restreints adds a51dafd8 Mise en page du login et de la creation de compte adds ad502bb0 import et export des participants d'un sondage restreint vers une liste de votants adds 1cf983bd validation des participants au vote + correction du noms de la liste principal d'un vote adds 7de2afcc edition du sondage : ne pas modifier les champ pour un sondage clos et corriger le bouton précédent adds dc69fb7f participants a un sondage : ajout des actions en bas d'une liste, demande de confirmation avant adds 9b78da36 factorisé le desenregistrement des tag sur le bus adds b1712689 création d'un utilitaire de log pour le JS adds 5c3fb9ad création et utilisation des composants : Modal, confirmation et information. adds 98a2d75f correction taille du QrCode adds 48602581 correction gestion de erreur en cas de sondage non accessible adds af16d6a7 devMode à false par défaut, et a vrai dans la configuration des tests. adds 9330980a afficher quels participants ont votés et leur renvoyer des invitations (#51, #36 et #33) adds d2b378d7 afficher le % d'abstention (#33) adds a701c5c3 ajout d'un parametre dans webpack pour faire echoué la tâche gitlab-CI build-js si la compilation webpack echoue adds 3579daaf les regExp dans les expression riot ne sont pas compiler correctement pas adds b6b6b17c vérification de la taille des fichiers, coté client adds 4d97782c vérification de la taille des fichiers, coté serveur (#55) adds 528bb4b2 ne pas afficher le bouton de renvoie des invitation à la création du sondage adds f966c64b log d'error a l'import du LDAP adds e0244fb9 fix NPE if the choice adding end date is null adds 7c7c7123 add log adds c24f5e75 display validation errors on poll edition adds f3b7d92b use a datetime component for the browsers which do not support datetime inputs adds 7f5b0e57 revert commit adds f510580d Merge remote-tracking branch 'origin/develop' into develop adds fb934a32 fix author adds b3c86e11 tentative de correction des jobs de rappels de fin de sondage adds 6cfb92d5 mise à jour du docker de base pour la construction du JS adds f15c7cfc wording + modification de la conf de notification d'un sondage : boolean au lieu d'une enum (il n'y avait plus que 2 valeurs pour l'énum) adds fb8573a7 Fix animation in Choice tag adds 3105f48b modification de libellé, correction sur les doit les lecture de commentaire adds 921300ad utilisation de la ShortTopiaIdFactory pour avoir des URLs plus courtes adds 6aaa7488 Merge branch 'develop' of gitlab.nuiton.org:chorem/pollen into develop adds e1b806b0 "datediff" n'est pas un fonction prise en charge par postgres adds 28b4528f correction de l'affichage des date picker et time picker suite aux modifications sur les animations adds c82a9f5e mise en place de flyway pour la migration de base de données + utilisé un autre fichier de properties pour les tests (evite les conflits avec les conf local) adds a7bb7bb8 "datediff" n'est pas un fonction prise en charge par postgres new 602caeb1 refs #14 création du flux atom à la création du sondage + ajout des entrées dans le flux pour l'ajout, la suppression et la modification d'un vote + ajout du bouton pour lire le flux à partir du sondage new 82c0964c refs #14 add feed content in poll + migration new b08c01c6 refs #14 add permission to feed url new a0e6368b modification des emails (pas d'affichage du contenu du vote) new 42b7384c refs #14 do not display user name if the vote is anonymous new dc0581ec refs #14 fix tests This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (a8face4b) \ N -- N -- N refs/heads/feature/14_add_rss_feed (dc0581ec) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit dc0581ec60c325f7c26a6a1342d71da1fdd447f2 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:09:31 2017 +0200 refs #14 fix tests commit 42b7384ca379b8e4779c2964dd746304a4f20bc1 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:09:03 2017 +0200 refs #14 do not display user name if the vote is anonymous commit a0e6368bd69a00eebac919d3dc02ba4c064074d8 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:08:06 2017 +0200 modification des emails (pas d'affichage du contenu du vote) commit b08c01c6510d868a9d52321efc2640f766d2afa7 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:06:10 2017 +0200 refs #14 add permission to feed url commit 82c0964c26a7ef99fd223bfb6412be2ead911ae1 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:03:43 2017 +0200 refs #14 add feed content in poll + migration commit 602caeb1ff262bfc4246816cc3d83188222adf92 Author: Kevin Morin <morin@codelutin.com> Date: Fri May 12 09:26:40 2017 +0200 refs #14 création du flux atom à la création du sondage + ajout des entrées dans le flux pour l'ajout, la suppression et la modification d'un vote + ajout du bouton pour lire le flux à partir du sondage Summary of changes: .gitlab-ci.yml | 2 +- pollen-persistence/pom.xml | 5 + .../persistence/PollenFlywayServiceImpl.java | 29 +++ .../pollen/persistence/entity/PollTopiaDao.java | 22 +- .../entity/VoterListMemberTopiaDao.java | 24 ++ .../persistence/entity/VoterListTopiaDao.java | 13 ++ .../h2/V3_0_0_1__add_feed_content_in_poll.sql | 2 + .../V3_0_0_1__add_feed_content_in_poll.sql | 2 + pollen-persistence/src/main/xmi/pollen.properties | 2 +- pollen-persistence/src/main/xmi/pollen.zargo | Bin 25019 -> 24351 bytes .../org/chorem/pollen/rest/api/JsonHelper.java | 2 +- .../rest/api/PollenRestApiApplicationListener.java | 15 -- .../org/chorem/pollen/rest/api/v1/ErrorAction.java | 7 + .../chorem/pollen/rest/api/v1/FavoriteListApi.java | 7 + .../org/chorem/pollen/rest/api/v1/PollApi.java | 8 +- .../pollen/rest/api/v1/PollenResourceApi.java | 5 +- .../chorem/pollen/rest/api/v1/VoteCountingApi.java | 4 +- .../chorem/pollen/rest/api/v1/VoterListApi.java | 46 +++- pollen-rest-api/src/main/resources/mapping | 29 ++- .../src/main/resources/pollen-rest-api.properties | 5 +- .../pollen/rest/api/AbstractPollenRestApiTest.java | 5 +- .../org/chorem/pollen/rest/api/PollApiTest.java | 14 +- .../resources/pollen-rest-api-test.properties} | 13 +- pollen-services/pom.xml | 7 +- pollen-services/src/main/config/PollenServices.ini | 23 +- .../java/org/chorem/pollen/services/UnitHuman.java | 43 ++++ ...ltBean.java => ListVoteCountingResultBean.java} | 18 +- .../org/chorem/pollen/services/bean/PollBean.java | 24 +- .../chorem/pollen/services/bean/PollenBean.java | 10 +- .../pollen/services/bean/PollenEntityId.java | 18 +- .../org/chorem/pollen/services/bean/VoteBean.java | 36 ++- .../chorem/pollen/services/bean/VoterListBean.java | 5 +- .../pollen/services/bean/VoterListMemberBean.java | 10 + .../services/config/PollenServicesConfig.java | 5 +- .../services/job/SendPollEndReminderJob.java | 68 +++--- .../pollen/services/job/SendVoteSummariesJob.java | 71 ------ .../pollen/services/service/CommentService.java | 4 +- .../services/service/FavoriteListService.java | 66 ++++++ .../pollen/services/service/FeedService.java | 9 +- .../pollen/services/service/FixturesService.java | 5 - .../services/service/NotificationService.java | 38 ++-- .../pollen/services/service/PollService.java | 42 ++-- .../services/service/PollenResourceService.java | 32 ++- .../services/service/VoteCountingService.java | 96 ++++---- .../pollen/services/service/VoteService.java | 45 ++-- .../pollen/services/service/VoterListService.java | 194 +++++++++++++---- .../services/service/mail/AbstractVoteEmail.java | 36 +-- .../pollen/services/service/mail/EmailService.java | 35 +-- .../services/service/mail/VoteAddedEmail.java | 15 +- .../services/service/mail/VoteDeletedEmail.java | 15 +- .../services/service/mail/VoteEditedEmail.java | 15 +- .../services/service/mail/VoteSummaryEmail.java | 69 ------ .../services/service/security/SecurityService.java | 36 +-- .../main/resources/email/VoteAddedEmail.mustache | 12 +- .../resources/email/VoteAddedEmail_fr.mustache | 12 +- .../main/resources/email/VoteDeletedEmail.mustache | 12 +- .../resources/email/VoteDeletedEmail_fr.mustache | 12 +- .../main/resources/email/VoteEditedEmail.mustache | 12 +- .../resources/email/VoteEditedEmail_fr.mustache | 10 - .../main/resources/email/VoteSummaryEmail.mustache | 26 --- .../resources/email/VoteSummaryEmail_fr.mustache | 26 --- .../i18n/pollen-services_en_GB.properties | 3 + .../i18n/pollen-services_fr_FR.properties | 4 +- .../src/test/resources/pollen-services.properties | 1 + pollen-ui-riot-js/package.json | 13 +- pollen-ui-riot-js/src/main/web/conf.js | 17 +- pollen-ui-riot-js/src/main/web/css/main.css | 39 +++- pollen-ui-riot-js/src/main/web/i18n.json | 118 ++++++++-- pollen-ui-riot-js/src/main/web/index.html | 2 +- pollen-ui-riot-js/src/main/web/index.js | 1 + pollen-ui-riot-js/src/main/web/js/Error.js | 10 +- .../src/main/web/js/FavoriteListService.js | 4 + pollen-ui-riot-js/src/main/web/js/FormHelper.js | 4 +- pollen-ui-riot-js/src/main/web/js/I18nHelper.js | 13 +- pollen-ui-riot-js/src/main/web/js/Logger.js | 18 ++ pollen-ui-riot-js/src/main/web/js/Poll.js | 27 ++- pollen-ui-riot-js/src/main/web/js/PollForm.js | 53 +++-- pollen-ui-riot-js/src/main/web/js/PollService.js | 4 +- .../src/main/web/js/ResourceService.js | 3 +- pollen-ui-riot-js/src/main/web/js/Session.js | 21 +- pollen-ui-riot-js/src/main/web/js/UIHelper.js | 45 +++- pollen-ui-riot-js/src/main/web/js/VoteService.js | 8 + .../src/main/web/js/VoterListService.js | 226 +++++++++++++++++++ .../src/main/web/tag/HeaderI18n.tag.html | 6 +- pollen-ui-riot-js/src/main/web/tag/Home.tag.html | 12 +- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 27 ++- .../src/main/web/tag/PollenErrorManager.tag.html | 6 +- .../src/main/web/tag/PollenHeader.tag.html | 53 +++-- .../src/main/web/tag/PollenWaiter.tag.html | 4 +- pollen-ui-riot-js/src/main/web/tag/QrCode.tag.html | 11 +- .../src/main/web/tag/SignCheck.tag.html | 28 ++- pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html | 23 +- pollen-ui-riot-js/src/main/web/tag/SignUp.tag.html | 18 +- .../src/main/web/tag/UserCard.tag.html | 24 +- .../src/main/web/tag/UserProfile.tag.html | 7 +- .../main/web/tag/components/date-picker.tag.html | 40 +++- .../web/tag/components/date-time-picker.tag.html | 78 +++++++ .../main/web/tag/components/time-picker.tag.html | 70 ++++-- .../web/tag/favoriteList/ChildListCard.tag.html | 16 +- .../web/tag/favoriteList/FavoriteList.tag.html | 10 +- .../web/tag/favoriteList/FavoriteListCard.tag.html | 12 +- .../web/tag/favoriteList/FavoriteLists.tag.html | 3 +- .../main/web/tag/favoriteList/MemberCard.tag.html | 16 +- .../src/main/web/tag/poll/Choice.tag.html | 94 ++++---- .../src/main/web/tag/poll/ChoiceDate.tag.html | 8 +- .../src/main/web/tag/poll/ChoiceView.tag.html | 24 +- .../src/main/web/tag/poll/Choices.tag.html | 4 + .../src/main/web/tag/poll/Comments.tag.html | 16 +- .../src/main/web/tag/poll/Created.tag.html | 4 +- .../src/main/web/tag/poll/Description.tag.html | 6 +- .../src/main/web/tag/poll/EditPoll.tag.html | 15 +- .../src/main/web/tag/poll/Podium.tag.html | 6 +- .../src/main/web/tag/poll/Poll.tag.html | 70 ++++-- .../src/main/web/tag/poll/Polls.tag.html | 2 +- .../src/main/web/tag/poll/Results.tag.html | 6 +- .../src/main/web/tag/poll/Settings.tag.html | 125 ++++++----- .../src/main/web/tag/poll/Voters.tag.html | 89 +++++--- .../src/main/web/tag/poll/Votes.tag.html | 25 +-- .../src/main/web/tag/popup/AccountCreated.tag.html | 81 ------- .../src/main/web/tag/popup/ConfirmPopup.tag.html | 76 +++++++ .../main/web/tag/popup/InformationPopup.tag.html | 67 ++++++ .../src/main/web/tag/popup/Modal.tag.html | 81 +++++++ .../src/main/web/tag/popup/NewPassword.tag.html | 98 +++------ .../src/main/web/tag/popup/QrCodeButton.tag.html | 8 +- .../main/web/tag/popup/ResendValidation.tag.html | 100 +++------ .../src/main/web/tag/voterList/VoterList.tag.html | 145 +++++++++++++ .../web/tag/voterList/VoterListActions.tag.html | 178 +++++++++++++++ .../web/tag/voterList/VoterListMember.tag.html | 101 +++++++++ .../votecounting/AbstractVoteCountingStrategy.java | 30 +-- .../pollen/votecounting/VoteCountingStrategy.java | 16 +- .../pollen/votecounting/model/ChoiceScore.java | 30 +++ .../votecounting/model/GroupOfVoterBuilder.java | 90 -------- .../model/{GroupOfVoter.java => ListOfVoter.java} | 34 +-- ...tingResult.java => ListVoteCountingResult.java} | 28 +-- pollen-votecounting-borda/pom.xml | 5 + .../votecounting/BordaVoteCountingStrategy.java | 17 ++ .../BordaVoteCountingStrategyTest.java | 189 +++++++++------- pollen-votecounting-condorcet/pom.xml | 5 + .../CondorcetVoteCountingStrategy.java | 16 ++ .../CondorcetVoteCountingStrategyTest.java | 192 +++++++++------- pollen-votecounting-coombs/pom.xml | 5 + .../votecounting/CoombsVoteCountingStrategy.java | 16 ++ .../CoombsVoteCountingStrategyTest.java | 127 +++++------ pollen-votecounting-instant-runoff/pom.xml | 5 + .../InstantRunoffVoteCountingStrategy.java | 16 ++ .../InstantRunoffVoteCountingStrategyTest.java | 136 +++++------- pollen-votecounting-normal/pom.xml | 6 + .../votecounting/NormalVoteCountingStrategy.java | 18 ++ .../NormalVoteCountingStrategyTest.java | 241 +++++++++------------ pollen-votecounting-number/pom.xml | 5 + .../votecounting/NumberVoteCountingStrategy.java | 16 ++ .../NumberVoteCountingStrategyTest.java | 173 +++++++++------ pollen-votecounting-percentage/pom.xml | 5 + .../PercentageVoteCountingStrategy.java | 28 +++ .../PercentageVoteCountingStrategyTest.java | 191 +++++++++------- pom.xml | 12 + 156 files changed, 3480 insertions(+), 2172 deletions(-) create mode 100644 pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenFlywayServiceImpl.java create mode 100644 pollen-persistence/src/main/java/org/chorem/pollen/persistence/entity/VoterListMemberTopiaDao.java create mode 100644 pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_1__add_feed_content_in_poll.sql create mode 100644 pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_1__add_feed_content_in_poll.sql copy pollen-rest-api/src/{main/resources/pollen-rest-api.properties => test/resources/pollen-rest-api-test.properties} (84%) create mode 100644 pollen-services/src/main/java/org/chorem/pollen/services/UnitHuman.java rename pollen-services/src/main/java/org/chorem/pollen/services/bean/{GroupVoteCountingResultBean.java => ListVoteCountingResultBean.java} (72%) delete mode 100644 pollen-services/src/main/java/org/chorem/pollen/services/job/SendVoteSummariesJob.java delete mode 100644 pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteSummaryEmail.java delete mode 100644 pollen-services/src/main/resources/email/VoteSummaryEmail.mustache delete mode 100644 pollen-services/src/main/resources/email/VoteSummaryEmail_fr.mustache create mode 100644 pollen-ui-riot-js/src/main/web/js/Logger.js create mode 100644 pollen-ui-riot-js/src/main/web/js/VoterListService.js create mode 100644 pollen-ui-riot-js/src/main/web/tag/components/date-time-picker.tag.html delete mode 100644 pollen-ui-riot-js/src/main/web/tag/popup/AccountCreated.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/popup/ConfirmPopup.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/popup/InformationPopup.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/popup/Modal.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/voterList/VoterList.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/voterList/VoterListActions.tag.html create mode 100644 pollen-ui-riot-js/src/main/web/tag/voterList/VoterListMember.tag.html delete mode 100644 pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/GroupOfVoterBuilder.java rename pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/{GroupOfVoter.java => ListOfVoter.java} (75%) rename pollen-votecounting-api/src/main/java/org/chorem/pollen/votecounting/model/{GroupVoteCountingResult.java => ListVoteCountingResult.java} (64%) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 602caeb1ff262bfc4246816cc3d83188222adf92 Author: Kevin Morin <morin@codelutin.com> Date: Fri May 12 09:26:40 2017 +0200 refs #14 création du flux atom à la création du sondage + ajout des entrées dans le flux pour l'ajout, la suppression et la modification d'un vote + ajout du bouton pour lire le flux à partir du sondage --- pollen-persistence/src/main/xmi/pollen.properties | 1 + .../org/chorem/pollen/rest/api/v1/PollApi.java | 6 ++ pollen-rest-api/src/main/resources/mapping | 2 + pollen-services/pom.xml | 6 +- .../pollen/services/service/FeedService.java | 116 +++++++++++++++++++++ .../pollen/services/service/PollService.java | 1 + .../services/service/PollenServiceSupport.java | 28 +++++ .../pollen/services/service/VoteService.java | 3 + .../pollen/services/service/mail/EmailService.java | 35 +------ .../i18n/pollen-services_en_GB.properties | 5 + .../i18n/pollen-services_fr_FR.properties | 5 + .../src/main/web/tag/poll/Poll.tag.html | 3 +- pom.xml | 8 +- 13 files changed, 181 insertions(+), 38 deletions(-) diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties index dec4909a..73dd47bf 100644 --- a/pollen-persistence/src/main/xmi/pollen.properties +++ b/pollen-persistence/src/main/xmi/pollen.properties @@ -27,6 +27,7 @@ model.tagValue.hibernateAttributeType.String=string package.org.chorem.pollen.persistence.entity.stereotype=entity # Text org.chorem.pollen.persistence.entity.Poll.attribute.description.tagValue.hibernateAttributeType=text +org.chorem.pollen.persistence.entity.Poll.attribute.feedContent.tagValue.hibernateAttributeType=text org.chorem.pollen.persistence.entity.Choice.attribute.description.tagValue.hibernateAttributeType=text org.chorem.pollen.persistence.entity.Comment.attribute.text.tagValue.hibernateAttributeType=text # Blob diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java index 988304f7..7df49fc3 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java @@ -32,9 +32,11 @@ import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.bean.PollenEntityRef; import org.chorem.pollen.services.bean.VoterListBean; import org.chorem.pollen.services.bean.VoterListMemberBean; +import org.chorem.pollen.services.service.FeedService; import org.chorem.pollen.services.service.InvalidFormException; import org.chorem.pollen.services.service.PollService; import org.debux.webmotion.server.WebMotionController; +import org.debux.webmotion.server.render.Render; import java.io.File; import java.util.List; @@ -135,4 +137,8 @@ public class PollApi extends WebMotionController { public PollBean assignPoll(PollService pollService, PollenEntityId<Poll> pollId) { return pollService.assignPollToConnectedUser(pollId.getEntityId()); } + + public Render getFeedForPoll(FeedService feedService, PollenEntityId<Poll> pollId) { + return renderAtom(feedService.getFeedForPoll(pollId.getEntityId())); + } } diff --git a/pollen-rest-api/src/main/resources/mapping b/pollen-rest-api/src/main/resources/mapping index 32e4f203..d59c50aa 100644 --- a/pollen-rest-api/src/main/resources/mapping +++ b/pollen-rest-api/src/main/resources/mapping @@ -124,6 +124,8 @@ PUT /v1/polls/{pollId}/close PollApi.closePoll PUT /v1/polls/{pollId}/reopen PollApi.reopenPoll PUT /v1/polls/{pollId}/assign PollApi.assignPoll +GET /v1/polls/{pollId}/feed PollApi.getFeedForPoll + # PollenResourceApi GET /v1/resources/{resourceId} PollenResourceApi.getResource diff --git a/pollen-services/pom.xml b/pollen-services/pom.xml index 1df904ca..49951934 100644 --- a/pollen-services/pom.xml +++ b/pollen-services/pom.xml @@ -127,10 +127,10 @@ <artifactId>guava</artifactId> </dependency> - <!--dependency> - <groupId>rome</groupId> + <dependency> + <groupId>com.rometools</groupId> <artifactId>rome</artifactId> - </dependency--> + </dependency> <dependency> <groupId>junit</groupId> diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java new file mode 100644 index 00000000..96239861 --- /dev/null +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java @@ -0,0 +1,116 @@ +package org.chorem.pollen.services.service; + +import com.rometools.rome.feed.synd.SyndContent; +import com.rometools.rome.feed.synd.SyndContentImpl; +import com.rometools.rome.feed.synd.SyndEntry; +import com.rometools.rome.feed.synd.SyndEntryImpl; +import com.rometools.rome.feed.synd.SyndFeed; +import com.rometools.rome.feed.synd.SyndFeedImpl; +import com.rometools.rome.io.FeedException; +import com.rometools.rome.io.SyndFeedInput; +import com.rometools.rome.io.SyndFeedOutput; +import org.chorem.pollen.persistence.entity.Poll; +import org.chorem.pollen.persistence.entity.Vote; +import org.chorem.pollen.services.PollenTechnicalException; +import org.chorem.pollen.services.service.security.PermissionVerb; + +import java.io.StringReader; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.nuiton.i18n.I18n.n; +import static org.nuiton.i18n.I18n.t; + +/** + * @author Kevin Morin (Code Lutin) + * @since 3.0 + */ +public class FeedService extends PollenServiceSupport { + + public static final String FEED_TYPE = "atom_1.0"; + public static final String DESCRIPTION_TYPE = "text/plain"; + + public void onPollCreated(Poll poll) { + SyndFeed feed = new SyndFeedImpl(); + feed.setFeedType(FEED_TYPE); + + feed.setTitle(poll.getTitle()); + String voteUrl = getPollVoteUrl(poll); + feed.setLink(voteUrl); + feed.setDescription(poll.getDescription()); + + SyndEntry entry = new SyndEntryImpl(); + entry.setTitle(t("pollen.service.feed.pollCreated.title", poll.getCreator().getName(), poll.getTitle())); + entry.setLink(voteUrl); + entry.setPublishedDate(poll.getTopiaCreateDate()); + + SyndContent description = new SyndContentImpl(); + description.setType(DESCRIPTION_TYPE); + description.setValue(t("pollen.service.feed.pollCreated.description", + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(poll.getTopiaCreateDate()), + poll.getCreator().getName(), + poll.getTitle())); + entry.setDescription(description); + + List<SyndEntry> feedEntries = Collections.singletonList(entry); + feed.setEntries(feedEntries); + + saveFeed(poll, feed); + } + + public void onVoteAdded(Poll poll, Vote vote) { + addVoteFeedEntry(poll, vote, n("pollen.service.feed.voteAdded.title")); + } + + public void onVoteEdited(Poll poll, Vote vote) { + addVoteFeedEntry(poll, vote, n("pollen.service.feed.voteEdited.title")); + } + + public void onVoteDeleted(Poll poll, Vote vote) { + addVoteFeedEntry(poll, vote, n("pollen.service.feed.voteDeleted.title")); + } + + public SyndFeed getFeedForPoll(String pollId) { + checkNotNull(pollId); + checkPermission(PermissionVerb.readPoll, pollId); + + Poll poll = getPollService().getPoll0(pollId); + + try { + SyndFeedInput feedInput = new SyndFeedInput(true, getLocale()); + return feedInput.build(new StringReader(poll.getFeedContent())); + + } catch (FeedException e) { + throw new PollenTechnicalException("Error while reading the feed", e); + } + } + + private void addVoteFeedEntry(Poll poll, Vote vote, String messageKey) { + SyndFeed feed = getFeedForPoll(poll.getTopiaId()); + List<SyndEntry> entries = new ArrayList<>(feed.getEntries()); + + SyndEntry entry = new SyndEntryImpl(); + entry.setTitle(t(messageKey, vote.getVoter().getName())); + entry.setLink(getPollVoteUrl(poll)); + entry.setPublishedDate(vote.getTopiaCreateDate()); + + entries.add(entry); + feed.setEntries(entries); + + saveFeed(poll, feed); + } + + private void saveFeed(Poll poll, SyndFeed feed) { + try { + SyndFeedOutput output = new SyndFeedOutput(); + String feedContent = output.outputString(feed); + poll.setFeedContent(feedContent); + commit(); + + } catch (FeedException e) { + throw new PollenTechnicalException("Error while creating the feed", e); + } + } +} diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java index 143408d4..45bf43df 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java @@ -227,6 +227,7 @@ public class PollService extends PollenServiceSupport { commit(); getNotificationService().onPollCreated(savedPoll); + getFeedService().onPollCreated(savedPoll); return PollenEntityRef.of(savedPoll); diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java index f6076a60..62704bd4 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/PollenServiceSupport.java @@ -33,6 +33,7 @@ import org.chorem.pollen.persistence.entity.ChoiceTopiaDao; import org.chorem.pollen.persistence.entity.CommentTopiaDao; import org.chorem.pollen.persistence.entity.FavoriteListMemberTopiaDao; import org.chorem.pollen.persistence.entity.FavoriteListTopiaDao; +import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.PollTopiaDao; import org.chorem.pollen.persistence.entity.PollenPrincipalTopiaDao; import org.chorem.pollen.persistence.entity.PollenResourceTopiaDao; @@ -49,6 +50,7 @@ import org.chorem.pollen.services.PollenUIContext; import org.chorem.pollen.services.bean.PaginationResultBean; import org.chorem.pollen.services.bean.PollenBean; import org.chorem.pollen.services.bean.PollenBeans; +import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.config.PollenServicesConfig; import org.chorem.pollen.services.service.mail.EmailService; import org.chorem.pollen.services.service.security.PermissionVerb; @@ -128,6 +130,10 @@ public abstract class PollenServiceSupport implements PollenService { return newService(NotificationService.class); } + protected FeedService getFeedService() { + return newService(FeedService.class); + } + protected PollService getPollService() { return newService(PollService.class); } @@ -447,4 +453,26 @@ public abstract class PollenServiceSupport implements PollenService { } + protected <E extends TopiaEntity> PollenEntityId<E> getPollenEntityId(E entity) { + PollenEntityId<E> pollenEntityId = PollenEntityId.newId((Class<E>) entity.getClass()); + pollenEntityId.setEntityId(entity.getTopiaId()); + pollenEntityId.encode(serviceContext.getTopiaApplicationContext().getTopiaIdFactory()); + return pollenEntityId; + } + + protected String getPollVoteUrl(Poll poll) { + return getPollVoteUrl(getPollenEntityId(poll), null); + } + + protected String getPollVoteUrl(Poll poll, String token) { + return getPollVoteUrl(getPollenEntityId(poll), token); + } + + protected String getPollVoteUrl(PollenEntityId<Poll> pollId, String token) { + return getPollenUIUrlRenderService().getPollVoteUrl + (getUIContext().getPollVoteUrl(), + pollId.getReducedId(), + token); + } + } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java index 75ddd952..ab933ac4 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/VoteService.java @@ -142,6 +142,7 @@ public class VoteService extends PollenServiceSupport { commit(); getNotificationService().onVoteAdded(poll, result); + getFeedService().onVoteAdded(poll, result); return PollenEntityRef.of(result); @@ -163,6 +164,7 @@ public class VoteService extends PollenServiceSupport { commit(); getNotificationService().onVoteEdited(poll, result); + getFeedService().onVoteEdited(poll, result); return toBean(VoteBean.class, result); @@ -182,6 +184,7 @@ public class VoteService extends PollenServiceSupport { commit(); getNotificationService().onVoteDeleted(poll, vote); + getFeedService().onVoteDeleted(poll, vote); } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java index d8192600..b2809702 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java @@ -138,10 +138,7 @@ public class EmailService extends PollenServiceSupport { email.setPollenUrl(getUIContext().getUiEndPoint()); - PollenEntityId<Poll> pollId = PollenEntityId.newId(Poll.class); - pollId.setEntityId(poll.getTopiaId()); - pollId.encode(serviceContext.getTopiaApplicationContext().getTopiaIdFactory()); - + PollenEntityId<Poll> pollId = getPollenEntityId(poll); email.setUrl(getPollenUIUrlRenderService().getPollEditUrl(getUIContext().getPollEditUrl(), pollId.getReducedId(), poll.getCreator().getPermission().getToken())); @@ -188,15 +185,7 @@ public class EmailService extends PollenServiceSupport { public PollInvitationEmail newPollInvitationEmail(Poll poll) { PollInvitationEmail email = new PollInvitationEmail(getLocale()); email.setPoll(poll); - - PollenEntityId<Poll> pollId = PollenEntityId.newId(Poll.class); - pollId.setEntityId(poll.getTopiaId()); - pollId.encode(serviceContext.getTopiaApplicationContext().getTopiaIdFactory()); - - email.setVoteUrl(getPollenUIUrlRenderService().getPollVoteUrl - (getUIContext().getPollVoteUrl(), - pollId.getReducedId(), - null)); + email.setVoteUrl(getPollVoteUrl(poll)); return email; } @@ -205,15 +194,7 @@ public class EmailService extends PollenServiceSupport { RestrictedPollInvitationEmail email = new RestrictedPollInvitationEmail(getLocale()); email.setPoll(poll); email.setPrincipal(principal); - - PollenEntityId<Poll> pollId = PollenEntityId.newId(Poll.class); - pollId.setEntityId(poll.getTopiaId()); - pollId.encode(serviceContext.getTopiaApplicationContext().getTopiaIdFactory()); - - email.setVoteUrl(getPollenUIUrlRenderService().getPollVoteUrl - (getUIContext().getPollVoteUrl(), - pollId.getReducedId(), - principal.getPermission().getToken())); + email.setVoteUrl(getPollVoteUrl(poll, principal.getPermission().getToken())); email.setToken(principal.getPermission().getToken()); @@ -226,10 +207,7 @@ public class EmailService extends PollenServiceSupport { email.setPollenUrl(pollenUIContext.getUiEndPoint()); - PollenEntityId<PollenUser> userId = PollenEntityId.newId(PollenUser.class); - userId.setEntityId(user.getTopiaId()); - userId.encode(serviceContext.getTopiaApplicationContext().getTopiaIdFactory()); - + PollenEntityId<PollenUser> userId = getPollenEntityId(user); email.setValidateUrl(getPollenUIUrlRenderService().getUserValidateUrl(pollenUIContext.getUserValidateUrl(), userId.getReducedId(), user.getEmailActivationToken().getToken())); @@ -242,10 +220,7 @@ public class EmailService extends PollenServiceSupport { email.setUser(user); email.setPollenUrl(pollenUIContext.getUiEndPoint()); - PollenEntityId<PollenUser> userId = PollenEntityId.newId(PollenUser.class); - userId.setEntityId(user.getTopiaId()); - userId.encode(serviceContext.getTopiaApplicationContext().getTopiaIdFactory()); - + PollenEntityId<PollenUser> userId = getPollenEntityId(user); email.setValidateUrl(getPollenUIUrlRenderService().getUserValidateUrl(pollenUIContext.getUserValidateUrl(), userId.getReducedId(), user.getEmailActivationToken().getToken())); diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties index 15c319c9..472f0ee8 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties @@ -102,6 +102,11 @@ pollen.error.voterList.member.weight.greaterThan0=member weight must be greater pollen.error.voterList.name.alreadyUsed=voterList name already used pollen.error.voterList.name.mandatory=voterList name can not be empty pollen.error.voterList.weight.greaterThan0=voterList weight must be greater than 0 +pollen.service.feed.pollCreated.description=On the %s, %s created the poll "%s". +pollen.service.feed.pollCreated.title=%s created the poll "%s" +pollen.service.feed.voteAdded.title=%s voted +pollen.service.feed.voteDeleted.title=%s deleted his vote +pollen.service.feed.voteEdited.title=%s edited his vote pollen.service.mail.ChoiceAddedEmail.subject=[Pollen] A choice was added in poll %s pollen.service.mail.ChoiceDeletedEmail.subject=[Pollen] A choice was deleted in poll %s pollen.service.mail.ChoiceEditedEmail.subject=[Pollen] A choice was edited in poll %s diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties index 58016941..3e8bc045 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties @@ -101,6 +101,11 @@ pollen.error.voterList.member.weight.greaterThan0=Le membre doit avoir un poid s pollen.error.voterList.name.alreadyUsed=Le nom de la liste de votant existe déjà pollen.error.voterList.name.mandatory=Nom de la liste de votant est obligatoire pollen.error.voterList.weight.greaterThan0=Poid de la liste de votant doit être supérieur à 0 +pollen.service.feed.pollCreated.description=Le %s, %s a créé le sondage %s. +pollen.service.feed.pollCreated.title=%s a créé le sondage "%s" +pollen.service.feed.voteAdded.title=%s a voté +pollen.service.feed.voteDeleted.title=%s a supprimé son vote +pollen.service.feed.voteEdited.title=%s a modifié son vote pollen.service.mail.ChoiceAddedEmail.subject=[Pollen] Un choix a été ajouté au sondage %s pollen.service.mail.ChoiceDeletedEmail.subject=[Pollen] Un choix a été supprimé du sondage %s pollen.service.mail.ChoiceEditedEmail.subject=[Pollen] Un choix a été modifié sur le sondage %s diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html index c354261c..144f1b74 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html @@ -120,7 +120,8 @@ require("../popup/QrCodeButton.tag.html"); <h1> <QrCodeButton if={poll.pollType === "FREE"} value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote"/> {poll.title} - <h1> + <a href="{session.configuration.endPoint}/v1/polls/{poll.id}/feed" class="fa fa-rss-square" aria-hidden="true"></a> + </h1> <h3>{poll.description}</h3> diff --git a/pom.xml b/pom.xml index 603652d7..f7b20abc 100644 --- a/pom.xml +++ b/pom.xml @@ -470,11 +470,11 @@ <!-- Rome (rss) --> - <!--dependency> - <groupId>rome</groupId> + <dependency> + <groupId>com.rometools</groupId> <artifactId>rome</artifactId> - <version>1.0</version> - </dependency--> + <version>1.7.2</version> + </dependency> <!-- Logging --> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 82c0964c26a7ef99fd223bfb6412be2ead911ae1 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:03:43 2017 +0200 refs #14 add feed content in poll + migration --- .../db/migration/common/V3_0_0_1__exemple.sql | 2 -- .../h2/V3_0_0_1__add_feed_content_in_poll.sql | 2 ++ .../resources/db/migration/h2/V3_0_0_2__exemple.sql | 2 -- .../V3_0_0_1__add_feed_content_in_poll.sql | 2 ++ .../db/migration/postgresql/V3_0_0_2__exemple.sql | 3 --- pollen-persistence/src/main/xmi/pollen.properties | 2 +- pollen-persistence/src/main/xmi/pollen.zargo | Bin 24262 -> 24351 bytes 7 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pollen-persistence/src/main/resources/db/migration/common/V3_0_0_1__exemple.sql b/pollen-persistence/src/main/resources/db/migration/common/V3_0_0_1__exemple.sql deleted file mode 100644 index c6496384..00000000 --- a/pollen-persistence/src/main/resources/db/migration/common/V3_0_0_1__exemple.sql +++ /dev/null @@ -1,2 +0,0 @@ - --- Ici un script de migration commun aux bases H2 et PostgreSQL diff --git a/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_1__add_feed_content_in_poll.sql b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_1__add_feed_content_in_poll.sql new file mode 100644 index 00000000..4b5dc3d6 --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_1__add_feed_content_in_poll.sql @@ -0,0 +1,2 @@ +-- add feed content in poll +alter table poll add feedContent longvarchar; \ No newline at end of file diff --git a/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_2__exemple.sql b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_2__exemple.sql deleted file mode 100644 index 766ee6c1..00000000 --- a/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_2__exemple.sql +++ /dev/null @@ -1,2 +0,0 @@ - --- Ici un script de migration specifique pour les bases H2 diff --git a/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_1__add_feed_content_in_poll.sql b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_1__add_feed_content_in_poll.sql new file mode 100644 index 00000000..fdca6945 --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_1__add_feed_content_in_poll.sql @@ -0,0 +1,2 @@ +-- add feed content in poll +alter table poll add feedContent text; \ No newline at end of file diff --git a/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_2__exemple.sql b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_2__exemple.sql deleted file mode 100644 index 19b11200..00000000 --- a/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_2__exemple.sql +++ /dev/null @@ -1,3 +0,0 @@ - - --- Ici un script de migration specifique pour les bases PostgreSQL diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties index 73dd47bf..1bde58c0 100644 --- a/pollen-persistence/src/main/xmi/pollen.properties +++ b/pollen-persistence/src/main/xmi/pollen.properties @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # #L% ###m -model.tagvalue.version=3.0.0.0 +model.tagvalue.version=3.0.0.1 #model.tagValue.notGenerateToString=true #model.tagValue.constantPrefix=PROPERTY_ #model.tagValue.useEnumerationName=true diff --git a/pollen-persistence/src/main/xmi/pollen.zargo b/pollen-persistence/src/main/xmi/pollen.zargo index 4754bcf1..498ac22d 100644 Binary files a/pollen-persistence/src/main/xmi/pollen.zargo and b/pollen-persistence/src/main/xmi/pollen.zargo differ -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit b08c01c6510d868a9d52321efc2640f766d2afa7 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:06:10 2017 +0200 refs #14 add permission to feed url --- pollen-ui-riot-js/src/main/web/conf.js | 2 +- pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pollen-ui-riot-js/src/main/web/conf.js b/pollen-ui-riot-js/src/main/web/conf.js index 6a5f7120..19b836c1 100644 --- a/pollen-ui-riot-js/src/main/web/conf.js +++ b/pollen-ui-riot-js/src/main/web/conf.js @@ -1,5 +1,5 @@ window.pollenConf = { - endPoint: "http://felteu:8888/pollen-rest-api", + endPoint: "http://localhost:8888/pollen-rest-api", defaultErrorTimeout: 15, resourceMaxSize: 10000000 // octets => 10 Mo }; diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html index 144f1b74..85c3d77e 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Poll.tag.html @@ -120,7 +120,7 @@ require("../popup/QrCodeButton.tag.html"); <h1> <QrCodeButton if={poll.pollType === "FREE"} value="{window.location.origin}{window.location.pathname}#poll/{poll.id}/vote"/> {poll.title} - <a href="{session.configuration.endPoint}/v1/polls/{poll.id}/feed" class="fa fa-rss-square" aria-hidden="true"></a> + <a href="{session.configuration.endPoint}/v1/polls/{poll.id}/feed?permission={poll.permission}" class="fa fa-rss-square" aria-hidden="true"></a> </h1> <h3>{poll.description}</h3> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit a0e6368bd69a00eebac919d3dc02ba4c064074d8 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:08:06 2017 +0200 modification des emails (pas d'affichage du contenu du vote) --- .../services/service/NotificationService.java | 2 +- .../services/service/mail/AbstractVoteEmail.java | 36 +++++----------------- .../pollen/services/service/mail/EmailService.java | 27 ++-------------- .../services/service/mail/VoteAddedEmail.java | 15 ++------- .../services/service/mail/VoteDeletedEmail.java | 15 ++------- .../services/service/mail/VoteEditedEmail.java | 15 ++------- .../main/resources/email/VoteAddedEmail.mustache | 12 +------- .../resources/email/VoteAddedEmail_fr.mustache | 12 +------- .../main/resources/email/VoteDeletedEmail.mustache | 12 +------- .../resources/email/VoteDeletedEmail_fr.mustache | 12 +------- .../main/resources/email/VoteEditedEmail.mustache | 12 +------- .../resources/email/VoteEditedEmail_fr.mustache | 10 ------ .../main/resources/email/VoteSummaryEmail.mustache | 26 ---------------- .../resources/email/VoteSummaryEmail_fr.mustache | 26 ---------------- .../i18n/pollen-services_en_GB.properties | 1 + .../i18n/pollen-services_fr_FR.properties | 2 +- 16 files changed, 28 insertions(+), 207 deletions(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/NotificationService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/NotificationService.java index 325f1831..54adbbfd 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/NotificationService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/NotificationService.java @@ -147,7 +147,7 @@ public class NotificationService extends PollenServiceSupport { List<VoterListMember> allMembers = getVoterListDao().getAllMembers(mainVoterList); allMembers.stream() - .map(member -> member.getMember()) + .map(VoterListMember::getMember) .distinct() .forEach(pollenPrincipal -> { RestrictedPollInvitationEmail mail = emailService.newRestrictedPollInvitationEmail(poll, pollenPrincipal); diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/AbstractVoteEmail.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/AbstractVoteEmail.java index 1251865a..aa200a1c 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/AbstractVoteEmail.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/AbstractVoteEmail.java @@ -22,51 +22,31 @@ package org.chorem.pollen.services.service.mail; */ import org.chorem.pollen.persistence.entity.Poll; -import org.chorem.pollen.persistence.entity.VoteVisibility; -import org.chorem.pollen.votecounting.VoteCounting; -import org.chorem.pollen.votecounting.model.ChoiceToVoteRenderType; +import org.chorem.pollen.persistence.entity.Vote; import java.util.Locale; -import java.util.function.Function; /** * @author Kevin Morin */ public abstract class AbstractVoteEmail extends PollenMail { - protected Poll poll; + protected final Poll poll; - protected Function<String, String> voteCountingDisplayVoteValueFunction; + protected final Vote vote; - protected boolean voteCountingCheckboxEditorType; - - protected AbstractVoteEmail(Locale locale) { + protected AbstractVoteEmail(Locale locale, Poll poll, Vote vote) { super(locale); + this.poll = poll; + this.vote = vote; } public Poll getPoll() { return poll; } - public void setPoll(Poll poll) { - this.poll = poll; - } - - public Function<String, String> getVoteCountingDisplayVoteValue() { - return voteCountingDisplayVoteValueFunction; + public Vote getVote() { + return vote; } - public boolean isVoteCountingCheckboxEditorType() { - return voteCountingCheckboxEditorType; - } - - public void setVoteCounting(VoteCounting voteCounting) { - this.voteCountingDisplayVoteValueFunction = - voteValue -> voteCounting.getDisplayVoteValue(Double.parseDouble(voteValue)); - this.voteCountingCheckboxEditorType = voteCounting.getVoteValueEditorType() == ChoiceToVoteRenderType.CHECKBOX; - } - - public boolean isVoteVisible() { - return poll.getVoteVisibility() == VoteVisibility.CREATOR || poll.getVoteVisibility() == VoteVisibility.EVERYBODY; - } } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java index b2809702..d47eff68 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/EmailService.java @@ -26,7 +26,6 @@ import com.github.mustachejava.Mustache; import com.github.mustachejava.MustacheException; import com.github.mustachejava.MustacheFactory; import com.google.common.base.Charsets; -import com.google.common.base.Preconditions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.mail.Email; @@ -43,8 +42,6 @@ import org.chorem.pollen.services.PollenUIContext; import org.chorem.pollen.services.bean.PollenEntityId; import org.chorem.pollen.services.config.PollenServicesConfig; import org.chorem.pollen.services.service.PollenServiceSupport; -import org.chorem.pollen.votecounting.VoteCounting; -import org.chorem.pollen.votecounting.VoteCountingFactory; import java.io.StringWriter; import java.util.Locale; @@ -103,33 +100,15 @@ public class EmailService extends PollenServiceSupport { } public VoteAddedEmail newVoteAddedEmail(Poll poll, Vote vote) { - VoteAddedEmail email = new VoteAddedEmail(getLocale()); - initAbstractVoteEmail(email, poll); - email.setVote(vote); - return email; + return new VoteAddedEmail(getLocale(), poll, vote); } public VoteEditedEmail newVoteEditedEmail(Poll poll, Vote vote) { - VoteEditedEmail email = new VoteEditedEmail(getLocale()); - initAbstractVoteEmail(email, poll); - email.setVote(vote); - return email; + return new VoteEditedEmail(getLocale(), poll, vote); } public VoteDeletedEmail newVoteDeletedEmail(Poll poll, Vote vote) { - VoteDeletedEmail email = new VoteDeletedEmail(getLocale()); - email.setPoll(poll); - email.setVote(vote); - return email; - } - - private void initAbstractVoteEmail(AbstractVoteEmail email, Poll poll) { - email.setPoll(poll); - VoteCountingFactory voteCountingFactory = serviceContext.getVoteCountingFactory(); - VoteCounting voteCounting = voteCountingFactory.getVoteCounting(poll.getVoteCountingType()); - Preconditions.checkNotNull( - voteCounting, "Could not find vote counting for id " + poll.getVoteCountingType()); - email.setVoteCounting(voteCounting); + return new VoteDeletedEmail(getLocale(), poll, vote); } public PollCreatedEmail newPollCreatedEmail(Poll poll) { diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteAddedEmail.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteAddedEmail.java index 82000f0d..20d6725e 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteAddedEmail.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteAddedEmail.java @@ -21,6 +21,7 @@ package org.chorem.pollen.services.service.mail; * #L% */ +import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.Vote; import org.nuiton.i18n.I18n; @@ -34,10 +35,8 @@ import java.util.Locale; */ public class VoteAddedEmail extends AbstractVoteEmail { - protected Vote vote; - - protected VoteAddedEmail(Locale locale) { - super(locale); + protected VoteAddedEmail(Locale locale, Poll poll, Vote vote) { + super(locale, poll, vote); } @Override @@ -45,12 +44,4 @@ public class VoteAddedEmail extends AbstractVoteEmail { return I18n.l(locale, "pollen.service.mail.VoteAddedEmail.subject", poll.getTitle()); } - public Vote getVote() { - return vote; - } - - public void setVote(Vote vote) { - this.vote = vote; - } - } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteDeletedEmail.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteDeletedEmail.java index c12841f6..3fa17def 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteDeletedEmail.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteDeletedEmail.java @@ -21,6 +21,7 @@ package org.chorem.pollen.services.service.mail; * #L% */ +import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.Vote; import org.nuiton.i18n.I18n; @@ -34,10 +35,8 @@ import java.util.Locale; */ public class VoteDeletedEmail extends AbstractVoteEmail { - protected Vote vote; - - protected VoteDeletedEmail(Locale locale) { - super(locale); + protected VoteDeletedEmail(Locale locale, Poll poll, Vote vote) { + super(locale, poll, vote); } @Override @@ -45,12 +44,4 @@ public class VoteDeletedEmail extends AbstractVoteEmail { return I18n.l(locale, "pollen.service.mail.VoteDeletedEmail.subject", poll.getTitle()); } - public Vote getVote() { - return vote; - } - - public void setVote(Vote vote) { - this.vote = vote; - } - } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteEditedEmail.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteEditedEmail.java index eeac3b65..cb3b22b9 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteEditedEmail.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/mail/VoteEditedEmail.java @@ -21,6 +21,7 @@ package org.chorem.pollen.services.service.mail; * #L% */ +import org.chorem.pollen.persistence.entity.Poll; import org.chorem.pollen.persistence.entity.Vote; import org.nuiton.i18n.I18n; @@ -34,22 +35,12 @@ import java.util.Locale; */ public class VoteEditedEmail extends AbstractVoteEmail { - protected Vote vote; - - protected VoteEditedEmail(Locale locale) { - super(locale); + protected VoteEditedEmail(Locale locale, Poll poll, Vote vote) { + super(locale, poll, vote); } @Override public String getSubject() { return I18n.l(locale, "pollen.service.mail.VoteEditedEmail.subject", poll.getTitle()); } - - public Vote getVote() { - return vote; - } - - public void setVote(Vote vote) { - this.vote = vote; - } } \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteAddedEmail.mustache b/pollen-services/src/main/resources/email/VoteAddedEmail.mustache index 89008dff..21a76ad1 100644 --- a/pollen-services/src/main/resources/email/VoteAddedEmail.mustache +++ b/pollen-services/src/main/resources/email/VoteAddedEmail.mustache @@ -5,14 +5,4 @@ Someone answered your poll '{{poll.title}}'. {{/vote.anonymous}} {{^vote.anonymous}} {{vote.voter.name}} answered your poll '{{poll.title}}'. -{{/vote.anonymous}} -{{#voteVisible}} -{{#vote.voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}}: {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/vote.voteToChoice}} -{{/voteVisible}} \ No newline at end of file +{{/vote.anonymous}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteAddedEmail_fr.mustache b/pollen-services/src/main/resources/email/VoteAddedEmail_fr.mustache index f908540c..62958101 100644 --- a/pollen-services/src/main/resources/email/VoteAddedEmail_fr.mustache +++ b/pollen-services/src/main/resources/email/VoteAddedEmail_fr.mustache @@ -5,14 +5,4 @@ Quelqu'un a répondu à votre sondage '{{poll.title}}'. {{/vote.anonymous}} {{^vote.anonymous}} {{vote.voter.name}} a répondu à votre sondage '{{poll.title}}'. -{{/vote.anonymous}} -{{#voteVisible}} -{{#vote.voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}} : {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/vote.voteToChoice}} -{{/voteVisible}} \ No newline at end of file +{{/vote.anonymous}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteDeletedEmail.mustache b/pollen-services/src/main/resources/email/VoteDeletedEmail.mustache index eb7aa228..509377bd 100644 --- a/pollen-services/src/main/resources/email/VoteDeletedEmail.mustache +++ b/pollen-services/src/main/resources/email/VoteDeletedEmail.mustache @@ -5,14 +5,4 @@ Someone deleted his vote on your poll '{{poll.title}}'. {{/vote.anonymous}} {{^vote.anonymous}} {{vote.voter.name}} deleted his vote on your poll '{{poll.title}}'. -{{/vote.anonymous}} -{{#voteVisible}} -{{#vote.voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}}: {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/vote.voteToChoice}} -{{/voteVisible}} \ No newline at end of file +{{/vote.anonymous}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteDeletedEmail_fr.mustache b/pollen-services/src/main/resources/email/VoteDeletedEmail_fr.mustache index dfeef3b4..8eab06ae 100644 --- a/pollen-services/src/main/resources/email/VoteDeletedEmail_fr.mustache +++ b/pollen-services/src/main/resources/email/VoteDeletedEmail_fr.mustache @@ -5,14 +5,4 @@ Bonjour {{poll.creator.name}}, {{/vote.anonymous}} {{^vote.anonymous}} {{vote.voter.name}} a supprimé son vote sur votre sondage '{{poll.title}}'. -{{/vote.anonymous}} -{{#voteVisible}} - {{#vote.voteToChoice}} - {{#voteCountingCheckboxEditorType}} - {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} - {{/voteCountingCheckboxEditorType}} - {{^voteCountingCheckboxEditorType}} - - {{choice.choiceValue}} : {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} - {{/voteCountingCheckboxEditorType}} - {{/vote.voteToChoice}} -{{/voteVisible}} \ No newline at end of file +{{/vote.anonymous}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteEditedEmail.mustache b/pollen-services/src/main/resources/email/VoteEditedEmail.mustache index 482feddd..b48433a9 100644 --- a/pollen-services/src/main/resources/email/VoteEditedEmail.mustache +++ b/pollen-services/src/main/resources/email/VoteEditedEmail.mustache @@ -5,14 +5,4 @@ Someone edited his vote on your poll '{{poll.title}}'. {{/vote.anonymous}} {{^vote.anonymous}} {{vote.voter.name}} edited his vote on your poll '{{poll.title}}'. -{{/vote.anonymous}} -{{#voteVisible}} -{{#vote.voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}}: {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/vote.voteToChoice}} -{{/voteVisible}} \ No newline at end of file +{{/vote.anonymous}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteEditedEmail_fr.mustache b/pollen-services/src/main/resources/email/VoteEditedEmail_fr.mustache index 4f9c6f6a..6ec8a8e5 100644 --- a/pollen-services/src/main/resources/email/VoteEditedEmail_fr.mustache +++ b/pollen-services/src/main/resources/email/VoteEditedEmail_fr.mustache @@ -5,14 +5,4 @@ Quelqu'un a modifié son vote sur votre sondage '{{poll.title}}'. {{/vote.anonymous}} {{^vote.anonymous}} {{vote.voter.name}} a modifié son vote sur votre sondage '{{poll.title}}'. -{{#voteVisible}} -{{#vote.voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}} : {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/vote.voteToChoice}} -{{/voteVisible}} {{/vote.anonymous}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteSummaryEmail.mustache b/pollen-services/src/main/resources/email/VoteSummaryEmail.mustache deleted file mode 100644 index 5367b60c..00000000 --- a/pollen-services/src/main/resources/email/VoteSummaryEmail.mustache +++ /dev/null @@ -1,26 +0,0 @@ -Hello {{poll.creator.name}}, - -Since {{lastVoteNotification}}, {{votes.size}} person(s) answered your poll '{{poll.title}}' -{{#votes}} -{{#voteVisible}} -{{#anonymous}} -Someone answered: -{{/anonymous}} -{{^anonymous}} -{{voter.name}} answered: -{{/anonymous}} -{{#voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}}: {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/voteToChoice}} -{{/voteVisible}} -{{^voteVisible}} -{{^anonymous}} -- {{voter.name}} -{{/anonymous}} -{{/voteVisible}} -{{/votes}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/email/VoteSummaryEmail_fr.mustache b/pollen-services/src/main/resources/email/VoteSummaryEmail_fr.mustache deleted file mode 100644 index 6bf86b3b..00000000 --- a/pollen-services/src/main/resources/email/VoteSummaryEmail_fr.mustache +++ /dev/null @@ -1,26 +0,0 @@ -Bonjour {{poll.creator.name}}, - -Depuis le {{lastVoteNotification}}, {{votes.size}} personne(s) a(ont) répondu à votre sondage '{{poll.title}}' -{{#votes}} -{{#voteVisible}} -{{#anonymous}} -Quelqu'un a répondu : -{{/anonymous}} -{{^anonymous}} -{{voter.name}} a répondu : -{{/anonymous}} -{{#voteToChoice}} -{{#voteCountingCheckboxEditorType}} -{{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} {{choice.choiceValue}} -{{/voteCountingCheckboxEditorType}} -{{^voteCountingCheckboxEditorType}} -- {{choice.choiceValue}} : {{#voteCountingDisplayVoteValueFunction}}{{voteValue}}{{/voteCountingDisplayVoteValueFunction}} -{{/voteCountingCheckboxEditorType}} -{{/voteToChoice}} -{{/voteVisible}} -{{^voteVisible}} -{{^anonymous}} -- {{voter.name}} -{{/anonymous}} -{{/voteVisible}} -{{/votes}} \ No newline at end of file diff --git a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties index 472f0ee8..6293aeb4 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_en_GB.properties @@ -102,6 +102,7 @@ pollen.error.voterList.member.weight.greaterThan0=member weight must be greater pollen.error.voterList.name.alreadyUsed=voterList name already used pollen.error.voterList.name.mandatory=voterList name can not be empty pollen.error.voterList.weight.greaterThan0=voterList weight must be greater than 0 +pollen.service.feed.anonymous= pollen.service.feed.pollCreated.description=On the %s, %s created the poll "%s". pollen.service.feed.pollCreated.title=%s created the poll "%s" pollen.service.feed.voteAdded.title=%s voted diff --git a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties index 3e8bc045..5189223c 100644 --- a/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties +++ b/pollen-services/src/main/resources/i18n/pollen-services_fr_FR.properties @@ -101,6 +101,7 @@ pollen.error.voterList.member.weight.greaterThan0=Le membre doit avoir un poid s pollen.error.voterList.name.alreadyUsed=Le nom de la liste de votant existe déjà pollen.error.voterList.name.mandatory=Nom de la liste de votant est obligatoire pollen.error.voterList.weight.greaterThan0=Poid de la liste de votant doit être supérieur à 0 +pollen.service.feed.anonymous=Quelqu'un pollen.service.feed.pollCreated.description=Le %s, %s a créé le sondage %s. pollen.service.feed.pollCreated.title=%s a créé le sondage "%s" pollen.service.feed.voteAdded.title=%s a voté @@ -127,4 +128,3 @@ pollen.service.mail.UserAccountCreatedEmail.subject=[Pollen] Confirmation de cr pollen.service.mail.VoteAddedEmail.subject=[Pollen] Un nouveau vote a été ajouté au sondage %s pollen.service.mail.VoteDeletedEmail.subject=[Pollen] Un vote a été supprimé sur le sondage %s pollen.service.mail.VoteEditedEmail.subject=[Pollen] Un vote a été modifié du sondage %s -pollen.service.mail.VoteSummaryEmail.subject=[Pollen] Résumé des votes depuis le %s pour le sondage %s -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 42b7384ca379b8e4779c2964dd746304a4f20bc1 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:09:03 2017 +0200 refs #14 do not display user name if the vote is anonymous --- .../java/org/chorem/pollen/services/service/FeedService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java index 96239861..f6570f63 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/FeedService.java @@ -91,8 +91,15 @@ public class FeedService extends PollenServiceSupport { SyndFeed feed = getFeedForPoll(poll.getTopiaId()); List<SyndEntry> entries = new ArrayList<>(feed.getEntries()); + String voterName; + if (vote.isAnonymous()) { + voterName = t("pollen.service.feed.anonymous"); + } else { + voterName = vote.getVoter().getName(); + } + SyndEntry entry = new SyndEntryImpl(); - entry.setTitle(t(messageKey, vote.getVoter().getName())); + entry.setTitle(t(messageKey, voterName)); entry.setLink(getPollVoteUrl(poll)); entry.setPublishedDate(vote.getTopiaCreateDate()); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/14_add_rss_feed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit dc0581ec60c325f7c26a6a1342d71da1fdd447f2 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jun 2 10:09:31 2017 +0200 refs #14 fix tests --- .../org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java | 3 ++- .../src/test/java/org/chorem/pollen/rest/api/PollApiTest.java | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java index 74037f7c..1f8b29b7 100644 --- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java +++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java @@ -70,7 +70,8 @@ public class AbstractPollenRestApiTest extends WebMotionTest { TopiaIdFactory topiaIdFactory = application.getTopiaApplicationContext().getTopiaIdFactory(); - jsonHelper = new JsonHelper(topiaIdFactory, true); + // do not pretty print otherwise adding a pretty print json in header fails (last '}' missing) + jsonHelper = new JsonHelper(topiaIdFactory, false); } return jsonHelper; diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java index 269d1d6e..da278766 100644 --- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java +++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollApiTest.java @@ -32,7 +32,6 @@ import org.chorem.pollen.persistence.entity.PollType; import org.chorem.pollen.persistence.entity.ResultVisibility; import org.chorem.pollen.persistence.entity.VoteVisibility; import org.chorem.pollen.services.PollenFixtures; -import org.chorem.pollen.services.PollenUIContext; import org.chorem.pollen.services.bean.ChoiceBean; import org.junit.Before; import org.junit.Ignore; @@ -55,7 +54,6 @@ public class PollApiTest extends AbstractPollenRestApiTest { @Before public void setUp() throws Exception { - loadFixtures("fixtures"); } @@ -147,8 +145,8 @@ public class PollApiTest extends AbstractPollenRestApiTest { .addParameter("choices", choiceStr) .addParameter("voterLists", "[]") .addParameter("voterListMembers", "[]") - .addParameter("pollenUIContext", getJsonHelper().toJson(new PollenUIContext())) - .Post(); + .Post().setHeader(PollenRestApiRequestFilter.REQUEST_HEADER_UI_CONTEXT, + getJsonHelper().toJson(fixture("pollenUIContext_chorem"))); String content = request.execute().returnContent().asString(); showTestResult(content); @@ -177,8 +175,8 @@ public class PollApiTest extends AbstractPollenRestApiTest { .addParameter("choices", choiceStr) .addParameter("voterLists", "[]") .addParameter("voterListMembers", "[]") - .addParameter("pollenUIContext", getJsonHelper().toJson(new PollenUIContext())) - .Post(); + .Post().setHeader(PollenRestApiRequestFilter.REQUEST_HEADER_UI_CONTEXT, + getJsonHelper().toJson(fixture("pollenUIContext_chorem"))); String content = request.execute().returnContent().asString(); showTestResult(content); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm