mirror of
https://github.com/rickbarrette/redmine_qbo_reminders.git
synced 2026-11-17 21:00:36 -05:00
Separate permission for turning customer reminders off; fix the Compose recipe
- Send appointment reminders now covers only Send now / Send again; the new "Turn appointment reminders off/on for customers" permission covers the customer page's button - README's Compose service runs the task through the image's entrypoint, which installs the plugins' gems first (running bundle exec rake directly failed with Bundler::GemNotFound, since the Redmine container installs them at start) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
4 files changed
+18
-13
No files matched your search
@@ -25,7 +25,10 @@ cd ..
|
|||||||
bundle exec rake redmine:plugins:migrate
|
bundle exec rake redmine:plugins:migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
Restart Redmine, then set it up under **Administration » Plugins » Redmine QBO Reminders plugin » Configure**, and give the roles that should send reminders or turn them off for customers the **Send appointment reminders** permission.
|
Restart Redmine, then set it up under **Administration » Plugins » Redmine QBO Reminders plugin » Configure**, and give roles the permissions they need (administrators always have both):
|
||||||
|
|
||||||
|
* **Send appointment reminders**: the **Send now** / **Send again** button on an appointment.
|
||||||
|
* **Turn appointment reminders off/on for customers**: the **Turn off** / **Turn on** button on a customer.
|
||||||
|
|
||||||
## Sending through Google Workspace
|
## Sending through Google Workspace
|
||||||
|
|
||||||
@@ -70,7 +73,7 @@ To send them whether or not anyone is using Redmine, run the rake task every 15
|
|||||||
*/15 * * * * cd /path/to/redmine && bundle exec rake redmine:appointment_reminders:send RAILS_ENV=production
|
*/15 * * * * cd /path/to/redmine && bundle exec rake redmine:appointment_reminders:send RAILS_ENV=production
|
||||||
```
|
```
|
||||||
|
|
||||||
In Docker Compose, a small service running the same Redmine image can do it, with no cron and no Docker socket: it shares Redmine's volume and database, runs the task, sleeps 15 minutes, and repeats.
|
In Docker Compose, a small service running the same Redmine image can do it, with no cron and no Docker socket. It goes through the image's own start-up script each time, which installs the plugins' gems (as the Redmine container does when it starts), so the task finds everything Redmine uses; that script skips database migrations for rake tasks.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
redmine-reminders:
|
redmine-reminders:
|
||||||
@@ -78,20 +81,19 @@ In Docker Compose, a small service running the same Redmine image can do it, wit
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- redmine
|
- redmine
|
||||||
user: "1000:1000" # whoever owns Redmine's files in the volume
|
entrypoint: ["/bin/sh", "-c"]
|
||||||
working_dir: /usr/src/redmine
|
|
||||||
entrypoint: ["/bin/sh", "-c"] # skip the image's start-up (database setup, migrations, the web server)
|
|
||||||
command:
|
command:
|
||||||
- |
|
- |
|
||||||
sleep 120
|
sleep 120
|
||||||
while true; do
|
while true; do
|
||||||
bundle exec rake redmine:appointment_reminders:send || echo "Appointment reminders: run failed"
|
/docker-entrypoint.sh rake redmine:appointment_reminders:send || echo "Appointment reminders: run failed"
|
||||||
sleep 900
|
sleep 900
|
||||||
done
|
done
|
||||||
environment:
|
environment: # the Redmine service's, without REDMINE_PLUGINS_MIGRATE
|
||||||
HOME: /tmp
|
REDMINE_DB_MYSQL: <database host>
|
||||||
RAILS_ENV: production # the same as the Redmine service
|
REDMINE_DB_PASSWORD: <database password>
|
||||||
REDMINE_SECRET_KEY_BASE: ${REDMINE_SECRET_KEY_BASE}
|
REDMINE_SECRET_KEY_BASE: ${REDMINE_SECRET_KEY_BASE}
|
||||||
|
RAILS_ENV: production
|
||||||
TZ: America/New_York
|
TZ: America/New_York
|
||||||
RAILS_LOG_TO_STDOUT: "true"
|
RAILS_LOG_TO_STDOUT: "true"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -100,7 +102,7 @@ In Docker Compose, a small service running the same Redmine image can do it, wit
|
|||||||
- <the network the database is on>
|
- <the network the database is on>
|
||||||
```
|
```
|
||||||
|
|
||||||
Each run prints its result (e.g. `Appointment reminders: 2 sent, 0 failed, 0 skipped`) in that service's log.
|
`/docker-entrypoint.sh` is the official Redmine image's start-up script (`docker inspect --format '{{json .Config.Entrypoint}}' <image>` shows yours). The first run takes longer while it installs the gems. Each run prints its result (e.g. `Appointment reminders: 2 sent, 0 failed, 0 skipped`) in that service's log.
|
||||||
|
|
||||||
(Use the `RAILS_ENV` your Redmine runs in.) The task is safe to run alongside page-load checks.
|
(Use the `RAILS_ENV` your Redmine runs in.) The task is safe to run alongside page-load checks.
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<i class="fa-regular fa-envelope"></i>
|
<i class="fa-regular fa-envelope"></i>
|
||||||
<strong><%= l(:label_appointment_reminders) %>:</strong>
|
<strong><%= l(:label_appointment_reminders) %>:</strong>
|
||||||
<%= off ? l(:text_customer_reminders_off) : l(:text_customer_reminders_on) %>
|
<%= off ? l(:text_customer_reminders_off) : l(:text_customer_reminders_on) %>
|
||||||
<% if User.current.allowed_to?(:send_appointment_reminders, nil, global: true) %>
|
<% if User.current.allowed_to?(:manage_customer_reminders, nil, global: true) %>
|
||||||
<%= button_to (off ? l(:button_reminders_on) : l(:button_reminders_off)),
|
<%= button_to (off ? l(:button_reminders_on) : l(:button_reminders_off)),
|
||||||
(off ? customer_reminders_on_path(customer) : customer_reminders_off_path(customer)),
|
(off ? customer_reminders_on_path(customer) : customer_reminders_off_path(customer)),
|
||||||
method: :post, form_class: 'customer-reminders-toggle' %>
|
method: :post, form_class: 'customer-reminders-toggle' %>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
en:
|
en:
|
||||||
permission_send_appointment_reminders: "Send appointment reminders"
|
permission_send_appointment_reminders: "Send appointment reminders"
|
||||||
|
permission_manage_customer_reminders: "Turn appointment reminders off/on for customers"
|
||||||
|
|
||||||
label_appointment_reminder: "Reminder email"
|
label_appointment_reminder: "Reminder email"
|
||||||
label_appointment_reminders: "Appointment reminders"
|
label_appointment_reminders: "Appointment reminders"
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ Redmine::Plugin.register :redmine_qbo_reminders do
|
|||||||
|
|
||||||
settings default: RedmineQboReminders::Settings::DEFAULTS.dup, partial: 'settings/appointment_reminders'
|
settings default: RedmineQboReminders::Settings::DEFAULTS.dup, partial: 'settings/appointment_reminders'
|
||||||
|
|
||||||
# Sending a reminder from the appointment page, and turning reminders on or off for a customer
|
# The Send now / Send again button on an appointment
|
||||||
permission :send_appointment_reminders, { appointment_reminders: [:send_now, :opt_out, :opt_in] }, global: true
|
permission :send_appointment_reminders, { appointment_reminders: [:send_now] }, global: true
|
||||||
|
# The Turn off / Turn on button on a customer
|
||||||
|
permission :manage_customer_reminders, { appointment_reminders: [:opt_out, :opt_in] }, global: true
|
||||||
end
|
end
|
||||||
|
|
||||||
RedmineQboReminders.setup
|
RedmineQboReminders.setup
|
||||||
Reference in new issue
Block a user