Skip to content
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

Fix blog notifications still optional #310

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions grails-app/services/au/org/ala/alerts/UserService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,15 @@ class UserService {
log.error(it)
}
}
// new user gets "Blogs and News" weekly by default (opt out)
def notificationInstance = new Notification()
notificationInstance.query = Query.findByName(messageSource.getMessage("query.ala.blog.title", null, siteLocale))
notificationInstance.user = user
if (!notificationInstance.save(flush: true)) {
notificationInstance.errors.allErrors.each {
log.error(it)
if (grailsApplication.config.getProperty('useBlogsAlerts', Boolean, true)) {
// new user gets "Blogs and News" weekly by default (opt out)
def notificationInstance = new Notification()
notificationInstance.query = Query.findByName(messageSource.getMessage("query.ala.blog.title", null, siteLocale))
notificationInstance.user = user
if (!notificationInstance.save(flush: true)) {
notificationInstance.errors.allErrors.each {
log.error(it)
}
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions grails-app/views/admin/index.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@
</ul>
</div>

<div class="panel-heading">
<h3>Alerts for News and Blogs</h3>
<ul>
<li class="controller"><a href="${request.contextPath}/admin/previewBlogAlerts">Preview alerts for the five most recent blogs</a></li>
</ul>
</div>
<g:if test="${grailsApplication.config.getProperty('useBlogsAlerts', Boolean, true)}">
<div class="panel-heading">
<h3>Alerts for News and Blogs</h3>
<ul>
<li class="controller"><a href="${request.contextPath}/admin/previewBlogAlerts">Preview alerts for the five most recent blogs</a></li>
</ul>
</div>
</g:if>

<div class="panel-heading">
<h3>Application Management </h3>
Expand Down