This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit dcc5acf416e3e249576087dabe74355afcfe14a2 Author: Kevin Morin <morin@codelutin.com> Date: Mon Aug 7 16:51:34 2017 +0200 fixes #69 Poll creation - Split the notification option into comment notification, vote notification, new choice notification --- ...omment_and_new_choice_notifications_in_poll.sql | 6 ++++ ...omment_and_new_choice_notifications_in_poll.sql | 6 ++++ pollen-persistence/src/main/xmi/pollen.properties | 2 +- pollen-persistence/src/main/xmi/pollen.zargo | Bin 26817 -> 26949 bytes pollen-services/src/main/config/PollenServices.ini | 12 +++++++ .../org/chorem/pollen/services/bean/PollBean.java | 24 ++++++++++++++ .../services/config/PollenServicesConfig.java | 11 +++++++ .../services/service/NotificationService.java | 8 ++--- .../pollen/services/service/PollService.java | 17 +++------- .../i18n/pollen-services_en_GB.properties | 2 ++ .../i18n/pollen-services_fr_FR.properties | 2 ++ pollen-ui-riot-js/src/main/web/i18n.json | 18 ++++++----- .../src/main/web/tag/poll/Settings.tag.html | 36 +++++++++++++++++---- 13 files changed, 111 insertions(+), 33 deletions(-) diff --git a/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_7__add_comment_and_new_choice_notifications_in_poll.sql b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_7__add_comment_and_new_choice_notifications_in_poll.sql new file mode 100644 index 00000000..d029d391 --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_7__add_comment_and_new_choice_notifications_in_poll.sql @@ -0,0 +1,6 @@ +-- add notification types in poll +alter table poll add commentNotification boolean; +alter table poll add newChoiceNotification boolean; + +update poll set commentNotification = true, newChoiceNotification = true where voteNotification; +update poll set commentNotification = false, newChoiceNotification = false where not voteNotification; \ No newline at end of file diff --git a/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_7__add_comment_and_new_choice_notifications_in_poll.sql b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_7__add_comment_and_new_choice_notifications_in_poll.sql new file mode 100644 index 00000000..d029d391 --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_7__add_comment_and_new_choice_notifications_in_poll.sql @@ -0,0 +1,6 @@ +-- add notification types in poll +alter table poll add commentNotification boolean; +alter table poll add newChoiceNotification boolean; + +update poll set commentNotification = true, newChoiceNotification = true where voteNotification; +update poll set commentNotification = false, newChoiceNotification = false where not voteNotification; \ No newline at end of file diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties index c659a6ce..49cb0e8f 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.6 +model.tagvalue.version=3.0.0.7 #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 55e72c05..f967fa89 100644 Binary files a/pollen-persistence/src/main/xmi/pollen.zargo and b/pollen-persistence/src/main/xmi/pollen.zargo differ diff --git a/pollen-services/src/main/config/PollenServices.ini b/pollen-services/src/main/config/PollenServices.ini index 3e0eeb89..852fd00e 100644 --- a/pollen-services/src/main/config/PollenServices.ini +++ b/pollen-services/src/main/config/PollenServices.ini @@ -71,6 +71,18 @@ key = pollen.default.voteNotification type = Boolean defaultValue = false +[option defaultCommentNotification] +description = pollen.configuration.defaultCommentNotification +key = pollen.default.commentNotification +type = Boolean +defaultValue = false + +[option defaultNewChoiceNotification] +description = pollen.configuration.defaultNewChoiceNotification +key = pollen.default.newChoiceNotification +type = Boolean +defaultValue = false + [option defaultNotifyMeHoursBeforePollEnds] description = pollen.configuration.defaultNotifyMeHoursBeforePollEnds key = pollen.default.notifyMeHoursBeforePollEnds diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java index 09c7407b..d5104feb 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/bean/PollBean.java @@ -136,6 +136,10 @@ public class PollBean extends PollenBean<Poll> { protected boolean voteNotification; + protected boolean commentNotification; + + protected boolean newChoiceNotification; + protected String notificationLocale; protected ReportResumeBean report; @@ -183,6 +187,8 @@ public class PollBean extends PollenBean<Poll> { setChoiceType(entity.getChoiceType()); setNotifyMeHoursBeforePollEnds(entity.getNotifyMeHoursBeforePollEnds()); setVoteNotification(entity.isVoteNotification()); + setCommentNotification(entity.isCommentNotification()); + setNewChoiceNotification(entity.isNewChoiceNotification()); setNotificationLocale(entity.getNotificationLocale()); Date now = new Date(); @@ -244,6 +250,8 @@ public class PollBean extends PollenBean<Poll> { entity.setWithMe(isWithMe()); entity.setNotifyMeHoursBeforePollEnds(getNotifyMeHoursBeforePollEnds()); entity.setVoteNotification(isVoteNotification()); + entity.setCommentNotification(isCommentNotification()); + entity.setNewChoiceNotification(isNewChoiceNotification()); entity.setNotificationLocale(getNotificationLocale()); return entity; @@ -516,6 +524,22 @@ public class PollBean extends PollenBean<Poll> { this.voteNotification = voteNotification; } + public boolean isCommentNotification() { + return commentNotification; + } + + public void setCommentNotification(boolean commentNotification) { + this.commentNotification = commentNotification; + } + + public boolean isNewChoiceNotification() { + return newChoiceNotification; + } + + public void setNewChoiceNotification(boolean newChoiceNotification) { + this.newChoiceNotification = newChoiceNotification; + } + public String getNotificationLocale() { return notificationLocale; } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServicesConfig.java b/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServicesConfig.java index bca8228d..37fc3d79 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServicesConfig.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/config/PollenServicesConfig.java @@ -140,6 +140,17 @@ public class PollenServicesConfig extends GeneratedPollenServicesConfig { return Boolean.valueOf(get().getOption(PollenServicesConfigOption.DEFAULT_VOTE_NOTIFICATION.getKey())); } + @Override + public Boolean getDefaultCommentNotification() { + return Boolean.valueOf(get().getOption(PollenServicesConfigOption.DEFAULT_COMMENT_NOTIFICATION.getKey())); + } + + + @Override + public Boolean getDefaultNewChoiceNotification() { + return Boolean.valueOf(get().getOption(PollenServicesConfigOption.DEFAULT_NEW_CHOICE_NOTIFICATION.getKey())); + } + public List<String> getMailsFeedbackList() { return Lists.newArrayList(get().getOption(PollenServicesConfigOption.MAILS_FEEDBACK.getKey()).split(",")); } 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 ea9b86ac..035fb742 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 @@ -210,7 +210,7 @@ public class NotificationService extends PollenServiceSupport { } public void onChoiceAdded(Poll poll, Choice choice) { - if (poll.isVoteNotification()) { + if (poll.isNewChoiceNotification()) { EmailService emailService = getEmailService(); ChoiceAddedEmail email = emailService.newChoiceAddedEmail(poll, choice); email.addTo(poll.getCreator().getEmail()); @@ -227,7 +227,7 @@ public class NotificationService extends PollenServiceSupport { } public void onCommentAdded(Poll poll, Comment comment) { - if (poll.isVoteNotification()) { + if (poll.isCommentNotification()) { EmailService emailService = getEmailService(); CommentAddedEmail email = emailService.newCommentAddedEmail(poll, comment); email.addTo(poll.getCreator().getEmail()); @@ -236,7 +236,7 @@ public class NotificationService extends PollenServiceSupport { } public void onCommentEdited(Poll poll, Comment comment) { - if (poll.isVoteNotification()) { + if (poll.isCommentNotification()) { EmailService emailService = getEmailService(); CommentEditedEmail email = emailService.newCommentEditedEmail(poll, comment); email.addTo(poll.getCreator().getEmail()); @@ -245,7 +245,7 @@ public class NotificationService extends PollenServiceSupport { } public void onCommentDeleted(Poll poll, Comment comment) { - if (poll.isVoteNotification()) { + if (poll.isCommentNotification()) { EmailService emailService = getEmailService(); CommentDeletedEmail email = emailService.newCommentDeletedEmail(poll, comment); email.addTo(poll.getCreator().getEmail()); 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 87d9bbf3..735c9901 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 @@ -181,6 +181,8 @@ public class PollService extends PollenServiceSupport { pollBean.setResultVisibility(pollenServiceConfig.getDefaultResultVisibility()); pollBean.setContinuousResults(pollenServiceConfig.getDefaultContinuousResults()); pollBean.setVoteNotification(pollenServiceConfig.getDefaultVoteNotification()); + pollBean.setCommentNotification(pollenServiceConfig.getDefaultCommentNotification()); + pollBean.setNewChoiceNotification(pollenServiceConfig.getDefaultNewChoiceNotification()); pollBean.setNotifyMeHoursBeforePollEnds(pollenServiceConfig.getDefaultNotifyMeHoursBeforePollEnds()); // -- creator -- // @@ -309,19 +311,6 @@ public class PollService extends PollenServiceSupport { Poll savedPoll = savePoll(clonedPoll, clonedChoices); - //clone VoterList -// List<VoterListBean> clonedVoterList = toBeanList(VoterListBean.class, getVoterListService().getVoterLists0(poll)); -// for (VoterListBean voterList : clonedVoterList) { -// List<VoterListMemberBean> clonedVoterListMember = toBeanList(VoterListMemberBean.class, getVoterListService().getVoterListMembers0(voterList.toEntity())); -// -// voterList.setEntityId(null); -// VoterList savedVoterList = getVoterListService().saveVoterList(savedPoll, voterList); -// -// for (VoterListMemberBean member : clonedVoterListMember) { -// member.setEntityId(null); -// getVoterListService().saveVoterListMember(savedVoterList, member); -// } -// } commit(); getNotificationService().onPollCreated(savedPoll); @@ -467,6 +456,8 @@ public class PollService extends PollenServiceSupport { toSave.setChoiceType(poll.getChoiceType()); toSave.setWithMe(poll.isWithMe()); toSave.setVoteNotification(poll.isVoteNotification()); + toSave.setCommentNotification(poll.isCommentNotification()); + toSave.setNewChoiceNotification(poll.isNewChoiceNotification()); toSave.setNotifyMeHoursBeforePollEnds(poll.getNotifyMeHoursBeforePollEnds()); toSave.setNotificationLocale(poll.getNotificationLocale()); if (poll.withParticipants()) { 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 3878bd2e..aeb42167 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 @@ -1,11 +1,13 @@ PollenServicesConfig.description=Pollen Backend configuration pollen.configuration.data.directory=Directory where Pollen stores his data pollen.configuration.defaultChoiceType=Default choice type +pollen.configuration.defaultCommentNotification=Default notification type for the comments of a poll pollen.configuration.defaultCommentPageSize=Default number of comments per page pollen.configuration.defaultCommentVisibility=Default comment visibility pollen.configuration.defaultContinuousResults=Défault continuous results pollen.configuration.defaultFavoriteListMemberPageSize=Default number of participants per page pollen.configuration.defaultFavoriteListPageSize=Default number of favorite lists per page +pollen.configuration.defaultNewChoiceNotification=Default notification type for the new choices of a poll pollen.configuration.defaultNotifyMeHoursBeforePollEnds=Default time before the end of the poll to send the reminder email pollen.configuration.defaultPollChoiceType=Default choice type used when creating a new poll pollen.configuration.defaultPollCommentVisibility=Default Poll comment visibility used when creating a new poll 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 cba4a21c..5cd63aff 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 @@ -1,11 +1,13 @@ PollenServicesConfig.description=Configuration du backend de Pollen pollen.configuration.data.directory=Répertoire de données de l'application pollen.configuration.defaultChoiceType=Type de choix par défaut +pollen.configuration.defaultCommentNotification=Type de notification par défaut pour les commentaires pollen.configuration.defaultCommentPageSize=Nombre de commentaires par page pollen.configuration.defaultCommentVisibility=Visibilité des commentaires par défaut pollen.configuration.defaultContinuousResults=Voire les résultats en continue par défaut pollen.configuration.defaultFavoriteListMemberPageSize=Nomnre de participants par page pollen.configuration.defaultFavoriteListPageSize=Nombre de liste de favoris par page +pollen.configuration.defaultNewChoiceNotification=Type de notification par défaut pour les nouveaux choix pollen.configuration.defaultNotifyMeHoursBeforePollEnds=Combien de temps par défaut avant la fin du sondage envoyer le rappel pollen.configuration.defaultPollChoiceType=Type de choix par défaut lors de la création d'un nouveau sondage pollen.configuration.defaultPollCommentVisibility=Visibilité des commentaires par défaut lors de la création d'un nouveau sondage diff --git a/pollen-ui-riot-js/src/main/web/i18n.json b/pollen-ui-riot-js/src/main/web/i18n.json index 6584374d..b4d34d79 100644 --- a/pollen-ui-riot-js/src/main/web/i18n.json +++ b/pollen-ui-riot-js/src/main/web/i18n.json @@ -318,10 +318,11 @@ "poll_settings_freePoll": "Tout le monde peut voter (Sondage public)", "poll_settings_restrictedPoll": "Seul les invités peuvent voter (Sondage privé)", "poll_settings_restrictedPoll_withMe": "Je participe au sondage", - "poll_settings_voteNotification": "Recevoir des notifications", - "poll_settings_voteNotification_disabled": "Pour activer les notifications, vous devez renseigner votre courriel dans la partie 'Description'.", - "poll_settings_voteNotification_never": "Jamais", - "poll_settings_voteNotification_everyVote": "À chaque vote", + "poll_settings_notification": "Recevoir des notifications :", + "poll_settings_notification_disabled": "Pour activer les notifications, vous devez renseigner votre courriel dans la partie 'Description'.", + "poll_settings_voteNotification": "À chaque action sur les votes", + "poll_settings_commentNotification": "À chaque action sur les commentaires", + "poll_settings_newChoiceNotification": "À chaque ajout de choix", "poll_settings_notifyMeBeforePollEnds": "Recevoir une notification avant la fin des votes", "poll_settings_notifyMeBeforePollEnds_disabled": "Pour activer le rappel de la fin du sondage, vous devez renseigner votre courriel dans la partie 'Description', et choisir une date de fin pour le sondage en activant la période d'ouverture des votes.", "poll_settings_notifyMeHoursBeforePollEnds": "Combien d'heures avant ?", @@ -846,10 +847,11 @@ "poll_settings_freePoll": "Everybody can vote (Public poll)", "poll_settings_restrictedPoll": "Only invited people can vote (Private poll)", "poll_settings_restrictedPoll_withMe": "I also want to participate", - "poll_settings_voteNotification": "Receive notifications", - "poll_settings_voteNotification_disabled": "To enable the notifications, you need to enter you email address in the 'Description' part.", - "poll_settings_voteNotification_never": "Never", - "poll_settings_voteNotification_everyVote": "For every vote", + "poll_settings_notification": "Receive notifications:", + "poll_settings_notification_disabled": "To enable the notifications, you need to enter you email address in the 'Description' part.", + "poll_settings_voteNotification": "For every action on the votes", + "poll_settings_commentNotification": "For every action on the comments", + "poll_settings_newChoiceNotification": "For every new choice added", "poll_settings_notifyMeBeforePollEnds": "Receive a notification before the end of the votes", "poll_settings_notifyMeBeforePollEnds_disabled": "To enable the notifications, you need to enter you email address in the 'Description' part, and select an end date for the poll by enabling the vote opening period.", "poll_settings_notifyMeHoursBeforePollEnds": "How many hours before?", diff --git a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html index cebb6f6e..3b04d5bf 100644 --- a/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/poll/Settings.tag.html @@ -297,8 +297,12 @@ require("../components/date-time-picker.tag.html"); <div class="form-section"> <h4><i class="fa fa-paper-plane"></i> {__.nav_notification}</h4> - <div class="o-form-element"> - <label class="c-toggle c-toggle--info"> + <fieldset class="o-fieldset"> + <legend class="o-fieldset__legend"> + {__.notification} + <i class="fa fa-question-circle cursor-help warning" if="{!form.model.creatorEmail}" title="{__.notification_disabled}"></i> + </legend> + <label class="c-field c-field--choice c-toggle c-toggle--info"> {__.voteNotification} <input type="checkbox" ref="voteNotification" @@ -307,9 +311,28 @@ require("../components/date-time-picker.tag.html"); <div class="c-toggle__track"> <div class="c-toggle__handle"></div> </div> - <i class="fa fa-question-circle cursor-help warning" if="{!form.model.creatorEmail}" title="{__.voteNotification_disabled}"></i> </label> - </div> + <label class="c-field c-field--choice c-toggle c-toggle--info"> + {__.commentNotification} + <input type="checkbox" + ref="commentNotification" + checked={form.model.commentNotification} + disabled={!form.model.creatorEmail || opts.form.model.closed}> + <div class="c-toggle__track"> + <div class="c-toggle__handle"></div> + </div> + </label> + <label class="c-field c-field--choice c-toggle c-toggle--info"> + {__.newChoiceNotification} + <input type="checkbox" + ref="newChoiceNotification" + checked={form.model.newChoiceNotification} + disabled={!form.model.creatorEmail || opts.form.model.closed}> + <div class="c-toggle__track"> + <div class="c-toggle__handle"></div> + </div> + </label> + </fieldset> <div class="o-form-element"> <label class="c-toggle c-toggle--info"> {__.notifyMeBeforePollEnds} @@ -358,9 +381,6 @@ require("../components/date-time-picker.tag.html"); this.on("mount", () => { this.refs["voteCountingType" + this.form.model.voteCountingType].checked = true; this.refs.voteCountingType.value = this.form.model.voteCountingType; - if (!this.form.model.creatorEmail) { - this.refs.voteNotification.value = "NEVER"; - } this.updateVoteCountingTypeHelp(); }); @@ -463,6 +483,8 @@ require("../components/date-time-picker.tag.html"); this.form.model.continuousResults = this.refs.continuousResults.checked; this.form.model.voteNotification = this.refs.voteNotification.checked; + this.form.model.commentNotification = this.refs.commentNotification.checked; + this.form.model.newChoiceNotification = this.refs.newChoiceNotification.checked; this.form.model.notificationLocale = this.session.locale; if (this.notifyMeBeforePollEnds) { this.form.model.notifyMeHoursBeforePollEnds = this.refs.notifyMeHoursBeforePollEnds.value; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.