Compare commits

...

68 Commits

Author SHA1 Message Date
04fdee223b Update bundler 2024-11-07 15:19:33 +00:00
6c59907d9e More updates 2024-11-07 15:13:23 +00:00
f56fa28f27 Bump dependencies 2024-11-07 14:49:13 +00:00
8610257446 Fix solid_queue scheduled jobs conflict 2024-11-07 13:06:58 +00:00
7295792d88 Extract IBAN 2024-06-25 11:53:43 +01:00
ec2909df60 Remove debugger lines 2024-03-28 11:39:00 +00:00
97c69097cd Improve dockerfile 2024-03-28 11:35:38 +00:00
1c4c93afd2 Add solid-queue 2024-03-28 11:04:46 +00:00
bc1342a10c Upgrade to rails 7.1 2024-03-28 10:06:50 +00:00
76df4d41b7 Redo notification system
Previously, saucy generated each member's future notification every day
(marked as scheduled). And every day saucy would deliver every unsent
notification scheduled for that day.

This means that each member with expiration date in the future had ~6
notifications scheduled for them in the database.

This was troublesome because if the cron job that delivers notification
was down or the server was down for more than 24h, notifications were
silently skipped and we had no easy way of detecting it: we had to check
every member for missing sent notifications.

It also had the disadvantage that we were deleting and recreating
hundreds of database entries for no good reason.

To fix this, the new system no longer stores future scheduled
notifications. Instead, it now only stores sent notifications and
notifications currently being delivered. Every day, the deliver task
checks every member if there's a notification that needs to be sent in
that day, by checking if we're past the date of sending a particular
notification type and checking if in that window of time no
notifications of that type have been sent.

Let's suppose we send 6 notifications, one per month starting 60 days
before the membership expires until 90 days after:

  -60d   -30d    t=0    30d    60d    90d
----|------|------|------|------|------|------
    A      B      C      D      E      F

If we're on day t=-60d, we need to deliver a notification of type A. But
first we check if no notifications of type A have been sent to that
member on that day.

From days t=-59d to t=-31d, we check if in the time range t=[-60d, -31d]
any notification of type A was sent to that member. If not, we need to
deliver it.

If we're on days t=[-30d, -1d], we do the same but for notification of
type B.
2024-03-23 15:31:32 +00:00
336550fcbb bundle update 2024-03-22 23:39:06 +00:00
333b7c02aa Implement button to remind members to pay their initial dues 2024-03-22 23:34:34 +00:00
931310657a Implement multibanco detection 2024-03-21 14:52:59 +00:00
c7a5f2a8e0 Fix ifthenpay callback 2024-02-01 09:16:02 +00:00
4eb6d2de05 Fix notifications#index when member is nil 2024-02-01 09:13:44 +00:00
b55142d9b8 Bump gems 2023-12-29 13:34:39 +00:00
f69e3ff01a Allow customizing whethere the cookie is secure or not 2023-11-13 09:08:12 +00:00
5c35572d29 Allow smtp port to be customizable via SMTP_PORT 2023-11-13 08:48:28 +00:00
066bf32e0c Fix sorting in members/index 2023-09-24 11:28:58 +01:00
d6bd26c76f Fix missing ifthenpaylink bug
If you added a member and they clicked on the payment link within 5
minutes, there was a possibility that the ifthenpay link hadn't been
generated yet.

This fixes that bug by generating the ifthenpay links on member
creation.
2023-09-20 14:20:18 +01:00
dcc6d1a991 Improve branding mechanisms 2023-09-20 14:19:35 +01:00
dccad36474 Add payment confirmation notifications 2023-08-07 13:50:50 +01:00
d3f6db5196 Adapta página de pagamento de acordo com estado de inscrição 2023-07-27 09:06:07 +01:00
9058ed98f7 Adds payment page
Instead of sending all the payment details by email, we're now sending
only a link to a page on this platform. This is to help reduce questions
of whether the emails are from scammers or real.
2023-07-12 19:13:08 +01:00
8b4e0c9d62 Comment out incoming feature 2023-07-11 18:53:52 +01:00
5a35a72ac4 Fix member creation when database is empty 2023-07-11 18:50:51 +01:00
ae4a3c62e4 Add initial setup step if the database is empty 2023-07-11 00:36:05 +01:00
f3a1def396 Fixes ransack upgrade to 4.0 2023-04-19 22:52:31 +01:00
e178f94ff7 Remove mandatory fields 2023-04-19 22:48:35 +01:00
3fa1ac101c Try to address the concurrency problem 2023-04-05 23:04:48 +01:00
eb8f60192f Add clearance pt locales 2023-03-31 16:49:39 +01:00
ca81e4813a Add query params to members#new 2023-03-31 02:35:11 +01:00
c00f7743b0 Bundle update 2023-03-31 02:25:48 +01:00
ee0dc75889 Add legal name and pronouns to members 2023-03-31 02:24:16 +01:00
f956a65100 Adds dues to navigation and fixes amount calculation 2023-03-23 18:15:45 +00:00
b4dda05575 Add page listing due contributions 2023-03-23 18:08:30 +00:00
1f8a04ec5a Show member number even when excluded 2023-03-19 18:56:26 +00:00
318b7878d8 Add contributions CSV export 2023-03-19 17:49:31 +00:00
a1be74ed2d Sort member contributions by payment date 2023-03-19 15:38:19 +00:00
c45beb877e Support forgotten members in contributions list 2023-03-19 15:24:56 +00:00
cd43a5c382 Adds contributions list page 2023-03-19 15:15:56 +00:00
a106bc0357 Support notifications for deleted users 2023-03-17 16:03:01 +00:00
e9318b23d8 Small UI improvements
- Don't show dead ifthenpay link if there isn't one
- Remove actions from members#index in favor of members#show
- Display result count in members#index
- Increase table width in members#index
2023-02-26 13:03:36 +00:00
bdf0d1d22a Add register contribution link to members#show 2023-01-25 14:33:08 +00:00
9b91ae8df7 Display notification sent date 2023-01-25 14:01:24 +00:00
da34afc882 Parameterize Member#regenerate_notifications 2023-01-24 23:06:12 +00:00
b3bc4bc411 Avoid sending duplicate notifications 2023-01-24 18:26:10 +00:00
f30859f991 Fix 60 days warning which was scheduled for 90 days instead 2022-10-18 11:29:15 +01:00
d8befb0ea3 Show member in sent notifications list 2022-10-06 15:53:27 +01:00
abaf80e5c4 Add notification index page 2022-10-06 15:50:38 +01:00
e0f76c7aba Show earlier notifications first 2022-10-06 15:17:57 +01:00
160c389981 Fix register member and contribution bugs 2022-10-06 15:05:30 +01:00
90541319f3 Add ifthenpay links to members/show 2022-10-02 13:48:06 +01:00
1a3ecad1eb Add default bcc 2022-10-02 13:05:37 +01:00
5182d99198 Precompile assets in entrypoint 2022-09-29 18:41:22 +01:00
897b48e377 Parameterize civicrm dump directory 2022-09-29 18:27:30 +01:00
0950c0dbb0 Add .git to dockerignore 2022-09-28 21:07:58 +01:00
e22f6e0a00 Add CiviCRM importer 2022-09-28 00:18:36 +01:00
9dfdf3675b Fix image in emails 2022-09-28 00:18:19 +01:00
e2bcdaec26 Remove duplicate address from members#show 2022-08-20 11:12:16 +01:00
24a01b964b Fix readme markdown 2022-08-20 11:12:06 +01:00
9e6649355c Add license file 2022-08-20 11:11:04 +01:00
5690f2d8a3 Write an actual README 2022-08-20 11:10:58 +01:00
ded65410d4 Fix payment text template 2022-08-20 11:10:41 +01:00
e9c32b2793 Ignore env files in docker 2022-08-03 14:51:13 +01:00
9f46baf52d Add example env and production initialization 2022-07-16 16:17:04 +01:00
bed4fee11b Add docker stuff 2022-07-16 11:27:56 +01:00
2705ad1611 Implement letter generation 2022-07-16 11:27:43 +01:00
108 changed files with 3467 additions and 582 deletions

30
.dockerignore Normal file
View File

@ -0,0 +1,30 @@
Dockerfile
.git
# Ignore bundler config.
/.bundle
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep
/public/assets
# Ignore master key for decrypting credentials and more.
/config/master.key
/.env*.local

View File

@ -1 +1 @@
ruby-3.1.2
ruby-3.3.5

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM ruby:3.3.5-alpine AS builder
RUN apk add build-base libpq-dev tzdata
WORKDIR /app
ADD Gemfile* ./
RUN bundle
ADD . ./
FROM ruby:3.3.5-alpine
RUN apk add libpq tzdata
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
COPY --from=builder /app /app
WORKDIR /app
CMD ["./entrypoint.sh"]

12
Gemfile
View File

@ -1,19 +1,23 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.2"
ruby "3.3.5"
gem "bootsnap", require: false
gem "clearance"
gem "combine_pdf"
gem "dotenv-rails"
gem "importmap-rails"
gem "nokogiri"
gem "paper_trail"
gem "pg", "~> 1.1"
gem "pg"
gem "propshaft"
gem "puma", "~> 5.0"
gem "puma"
gem "pundit"
gem "rails", "~> 7.0.3"
gem "rails", "~> 7.2"
gem "ransack"
gem "rubyzip"
gem "solid_queue"
group :development, :test do
gem "debug", platforms: %i[ mri mingw x64_mingw ]

View File

@ -1,80 +1,89 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
actioncable (7.2.2)
actionpack (= 7.2.2)
activesupport (= 7.2.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.3)
actionpack (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activesupport (= 7.0.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.3)
actionview (= 7.0.3)
activesupport (= 7.0.3)
rack (~> 2.0, >= 2.2.0)
zeitwerk (~> 2.6)
actionmailbox (7.2.2)
actionpack (= 7.2.2)
activejob (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
mail (>= 2.8.0)
actionmailer (7.2.2)
actionpack (= 7.2.2)
actionview (= 7.2.2)
activejob (= 7.2.2)
activesupport (= 7.2.2)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.2)
actionview (= 7.2.2)
activesupport (= 7.2.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.3)
actionpack (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.2)
actionpack (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.3)
activesupport (= 7.0.3)
actionview (7.2.2)
activesupport (= 7.2.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.3)
activesupport (= 7.0.3)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.2.2)
activesupport (= 7.2.2)
globalid (>= 0.3.6)
activemodel (7.0.3)
activesupport (= 7.0.3)
activerecord (7.0.3)
activemodel (= 7.0.3)
activesupport (= 7.0.3)
activestorage (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activesupport (= 7.0.3)
activemodel (7.2.2)
activesupport (= 7.2.2)
activerecord (7.2.2)
activemodel (= 7.2.2)
activesupport (= 7.2.2)
timeout (>= 0.4.0)
activestorage (7.2.2)
actionpack (= 7.2.2)
activejob (= 7.2.2)
activerecord (= 7.2.2)
activesupport (= 7.2.2)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
tzinfo (~> 2.0)
argon2 (2.1.1)
ffi (~> 1.14)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
argon2 (2.3.0)
ffi (~> 1.15)
ffi-compiler (~> 1.0)
bcrypt (3.1.18)
base64 (0.2.0)
bcrypt (3.1.20)
benchmark (0.3.0)
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.12.0)
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.2.4)
clearance (2.6.0)
builder (3.3.0)
clearance (2.9.1)
actionmailer (>= 5.0)
activemodel (>= 5.0)
activerecord (>= 5.0)
@ -82,149 +91,218 @@ GEM
bcrypt (>= 3.1.1)
email_validator (~> 2.0)
railties (>= 5.0)
concurrent-ruby (1.1.10)
combine_pdf (1.0.26)
matrix
ruby-rc4 (>= 0.1.5)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
debug (1.5.0)
irb (>= 1.3.6)
reline (>= 0.2.7)
digest (3.1.0)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
email_validator (2.2.3)
date (3.4.0)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
dotenv (3.1.4)
dotenv-rails (3.1.4)
dotenv (= 3.1.4)
railties (>= 6.1)
drb (2.2.1)
email_validator (2.2.4)
activemodel
erubi (1.10.0)
ffi (1.15.5)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
erubi (1.13.0)
et-orbi (1.2.11)
tzinfo
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-aarch64-linux-musl)
ffi (1.17.0-arm-linux-gnu)
ffi (1.17.0-arm-linux-musl)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86-linux-musl)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux-musl)
ffi-compiler (1.3.2)
ffi (>= 1.15.5)
rake
globalid (1.0.0)
activesupport (>= 5.0)
i18n (1.10.0)
fugit (1.11.1)
et-orbi (~> 1, >= 1.2.11)
raabro (~> 1.4)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
importmap-rails (1.1.2)
importmap-rails (2.0.3)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
io-console (0.5.11)
irb (1.4.1)
reline (>= 0.3.0)
loofah (2.18.0)
io-console (0.7.2)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
logger (1.6.1)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.16.0)
msgpack (1.5.2)
net-imap (0.2.3)
digest
net-imap
net-pop
net-smtp
marcel (1.0.4)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.25.1)
msgpack (1.7.3)
net-imap (0.5.0)
date
net-protocol
strscan
net-pop (0.1.1)
digest
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-protocol (0.1.3)
timeout
net-smtp (0.3.1)
digest
net-smtp (0.5.0)
net-protocol
timeout
nio4r (2.5.8)
nokogiri (1.13.6-x86_64-linux)
nio4r (2.7.4)
nokogiri (1.16.7-aarch64-linux)
racc (~> 1.4)
paper_trail (12.3.0)
activerecord (>= 5.2)
request_store (~> 1.1)
pg (1.4.0)
propshaft (0.6.4)
nokogiri (1.16.7-arm-linux)
racc (~> 1.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86-linux)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
paper_trail (15.2.0)
activerecord (>= 6.1)
request_store (~> 1.4)
pg (1.5.9)
propshaft (1.1.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
puma (5.6.4)
psych (5.2.0)
stringio
puma (6.4.3)
nio4r (~> 2.0)
pundit (2.2.0)
pundit (2.4.0)
activesupport (>= 3.0.0)
racc (1.6.0)
rack (2.2.3.1)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (7.0.3)
actioncable (= 7.0.3)
actionmailbox (= 7.0.3)
actionmailer (= 7.0.3)
actionpack (= 7.0.3)
actiontext (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activemodel (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
raabro (1.4.0)
racc (1.8.1)
rack (3.1.8)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.2.0)
rack (>= 3)
rails (7.2.2)
actioncable (= 7.2.2)
actionmailbox (= 7.2.2)
actionmailer (= 7.2.2)
actionpack (= 7.2.2)
actiontext (= 7.2.2)
actionview (= 7.2.2)
activejob (= 7.2.2)
activemodel (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
bundler (>= 1.15.0)
railties (= 7.0.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
railties (= 7.2.2)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
method_source
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.2.2)
actionpack (= 7.2.2)
activesupport (= 7.2.2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
ransack (3.2.1)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
ransack (4.2.1)
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
reline (0.3.1)
rdoc (6.7.0)
psych (>= 4.0.0)
reline (0.5.10)
io-console (~> 0.5)
request_store (1.5.1)
request_store (1.7.0)
rack (>= 1.4)
strscan (3.0.3)
thor (1.2.1)
timecop (0.9.5)
timeout (0.3.0)
tzinfo (2.0.4)
ruby-rc4 (0.1.5)
rubyzip (2.3.2)
securerandom (0.3.1)
solid_queue (1.0.0)
activejob (>= 7.1)
activerecord (>= 7.1)
concurrent-ruby (>= 1.3.1)
fugit (~> 1.11.0)
railties (>= 7.1)
thor (~> 1.3.1)
stringio (3.1.2)
thor (1.3.2)
timecop (0.9.10)
timeout (0.4.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
web-console (4.2.0)
useragent (0.16.10)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.0)
zeitwerk (2.7.1)
PLATFORMS
x86_64-linux
aarch64-linux
aarch64-linux-gnu
aarch64-linux-musl
arm-linux
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl
DEPENDENCIES
bootsnap
clearance
combine_pdf
debug
dotenv-rails
importmap-rails
nokogiri
paper_trail
pg (~> 1.1)
pg
propshaft
puma (~> 5.0)
puma
pundit
rails (~> 7.0.3)
rails (~> 7.2)
ransack
rubyzip
solid_queue
timecop
web-console
RUBY VERSION
ruby 3.1.2p20
ruby 3.3.5p100
BUNDLED WITH
2.3.16
2.5.23

661
LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Cyberscore
Copyright (C) 2022 The Cyberscore Authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

124
README.md
View File

@ -1,24 +1,122 @@
# README
# saucy
This README would normally document whatever steps are necessary to get the
application up and running.
Uma plataforma de gestão de sócies para associações. Desenvolvido e usado pela
[ANSOL - Associação Nacional para o Software Livre](https://ansol.org).
Things you may want to cover:
* Ruby version
## Licença
* System dependencies
saucy - Copyright (C) 2022 ANSOL
* Configuration
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.
* Database creation
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.
* Database initialization
See the LICENSE file for full details.
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
## Funcionalidades
* Deployment instructions
A plataforma tem o mínimo necessário para os requisitos da ANSOL:
* ...
- [x] Gestão da equipa da direçcão
- [x] Actualizar membros da direccao (desactivar, criar novos, etc)
- [x] Registar sócio (informação base, assumindo que falta o pagamento)
- [x] Endereço de email
- [x] Nome ("display name"/"preferred name")
- [x] Número de BI/CC/Passaporte
- [x] Morada completa, incluindo código postal/localidade
- [x] estudante/reformade/desempregade/empregade
- [x] Adicionar à mailing list?
- [x] Preferência de contacto: postal ou electrónico (comunicações das AGs)
- [x] Integração com ifthenpay para pagamento de quotas anuais
- [x] Lista de sócios, com filtros e ordenação
- [x] em cada sócio:
- [x] editar informacao base (incluindo end date)
- [x] poder registar nova contribuição, estendendo o end-date 1 ano
- [x] excluir sócio (eliminação de dados pessoais, mantendo historico de contribuições)
- [x] corrigir dados de/apagar contribuição
- [x] mandar lembretes de renovação de quotas, cada um com o seu texto
- [x] gestão de estado de inscrição automático:
- [x] pendente (pré-aprovação/pagamento)
- [x] activa (quotas em dia)
- [x] expirada (quotas expiradas)
- [x] excluída (90 dias após expiração / manualmente excluído)
## Contribuir
Obrigado pelo interesse em contribuir para o projecto `saucy`.
### Como reportar ou corrigir problemas
Se tiveres conta no git.ansol.org, basta criar um `Issue` ou `Pull Request` em
`https://git.ansol.org/ansol/saucy`. Caso não tenhas conta, envia um email para
`direccao@ansol.org` ou fala connosco na [sala de matrix comunitária da
ANSOL](https://matrix.to/#/#geral:ansol.org)
### Traduções
As traduções existentes encontram-se em `config/locales/{pt,en}.yml`. Caso haja
alguma mensagem que não seja traduzível, fala connosco para corrigirmos o
problema (ver ponto anterior).
### Introduzir funcionalidades novas
Novas funcionalidades muito distantes dos casos de uso da ANSOL podem ser
recusadas, por isso recomendamos que fales connosco antes de começar uma
funcionalidade grande.
Funcionalidades que gostaríamos de implementar mas ainda não tivemos tempo:
- Parameterização do `saucy` de modo a não haver referências à ANSOL no código;
- "Multitenancy", onde uma única instalação do `saucy` permite servir várias
instituições;
- Melhorias genéricas ao estilo da plataforma.
## Requisitos técnicos
Para o projecto funcionar a 100%, precisa de algumas dependências externas:
- Uma base de dados postgresql, onde são armazenados todos os dados;
- Configuração de SMTP, para enviar lembretes de pagamentos de quotas e
mensagens de recuperação de senha para a administração;
- Configuração [ifthenpay](https://www.ifthenpay.com), para suportar pagamentos
multibanco/mbway.
Todas estas coisas são configuráveis via variáveis de ambiente. A lista de
variáveis está disponível no ficheiro `env.example`.
**NOTA**: o projecto ainda não está pronto para ser personalizado à imagem de
outras associações, estando o contexto da ANSOL codificado em vários pontos da
aplicação. Alguns destes detalhes podem ser definidos em `app/lib/config.rb`.
## Pôr isto a dar
Para simplificar a instalação, disponibilizamos uma imagem `docker`:
```
docker pull git.ansol.org/ansol/saucy:latest
```
A imagem está configurada para lançar o servidor web no porto 3000. É
recomendado configurar um reverse-proxy, como o nginx ou o apache, à frente
deste serviço que trate de fazer o TLS.
Quando se acede à plataforma pela primeira vez, é-nos pedido um endereço de
email para criar a primeira conta de administração. Este endereço precisa de
conseguir receber mensagens para o processo de recuperação de senha funcionar.
Depois deste processo terminado, é possível gerir até 6 contas de
administração. Atenção que qualquer uma delas consegue apagar as restantes (e
até a si própria).

View File

@ -1,10 +1,35 @@
/* Application styles */
body {
max-width: 800px;
margin: 0 auto;
margin: 0px;
}
main, nav, footer {
margin: 0 auto;
max-width: 1000px;
}
main {
padding: 10px;
}
.banner {
width: 100%;
padding: 15px;
background-size: auto 30px;
background-repeat: no-repeat;
background-position: center;
}
footer {
border-top: 1px solid #aaa;
margin-top: 20px;
padding: 20px 10px;
}
footer div + div { margin-top: 10px; }
table {
border: 1px solid black;
border-collapse: collapse;
@ -23,3 +48,17 @@ ul {
}
li { padding: 5px 0px; }
table.noborder { border: 0; margin: 0; }
nav ul { display: flex; flex-wrap: wrap; padding: 10px; list-style-type: none; gap: 20px; }
nav ul li { margin: 0; padding: 0; }
.contribution-actions {
list-style-type: none;
padding: 0px;
display: flex;
flex-wrap: wrap;
gap: 0 20px;
}
.contribution-actions li { padding: 0; }

View File

@ -1,4 +1,14 @@
class ApplicationController < ActionController::Base
include Clearance::Controller
before_action :set_paper_trail_whodunnit
before_action :initial_setup_redirect
def initial_setup_redirect
redirect_to '/initial_setup' if requires_initial_setup?
end
def requires_initial_setup?
User.count.zero? && Member.unscoped.count.zero?
end
end

View File

@ -3,7 +3,7 @@ class BoardsController < ApplicationController
def edit
@users = User.where(active: true)
@users += Array.new(5 - @users.size) { User.new }
@users += Array.new(6 - @users.size) { User.new }
end
def update

View File

@ -0,0 +1,37 @@
module MemberFilter
extend ActiveSupport::Concern
def filtered_members
members = Member.all.order(sort_params.merge(number: :asc))
filters = params.permit(:prefers_postal, :display_name, :legal_name, :email, :identification_number, status: [], category: [])
status = filters.fetch(:status, []) - ['any', '']
category = filters.fetch(:category, []) - ['any', '']
members = members.where(prefers_postal: true) if filters[:prefers_postal] == 'yes'
members = members.where(prefers_postal: false) if filters[:prefers_postal] == 'no'
members = members.where(status: status) if status != []
members = members.where(category: category) if category != []
members.ransack(
display_name_i_cont: filters[:display_name],
legal_name_i_cont: filters[:legal_name],
email_i_cont: filters[:email],
identification_number_i_cont: filters[:identification_number],
).result
end
def sort_params
field, direction = params.fetch(:sort, "").split(".")
directions = %w[ asc desc ]
fields = %w[ number expires_on joined_on email status display_name legal_name ]
if directions.include?(direction) && fields.include?(field)
{ field => direction }
else
{ number: :asc }
end
end
end

View File

@ -3,32 +3,67 @@ class ContributionsController < ApplicationController
before_action :set_member, only: %i[ new create ]
before_action :set_contribution, only: %i[ edit update delete destroy ]
# GET /members/new
def to_csv(collection, keys)
csv = [keys].join(",") + "\n"
collection.each do |item|
csv << keys.map { |k| item.send(k) }.join(",") + "\n"
end
csv
end
# GET /contributions
def index
@contributions = Contribution.all.order(payment_on: 'DESC')
@contributions = @contributions.select {|c| c.payment_on.year == params[:year].to_i } if params[:year]
respond_to do |format|
format.html
format.csv { render plain: to_csv(@contributions, %i[payment_on member_number member_display_name amount payment_method]) }
end
end
# GET /contributions/due
def due
@due_members = Member.where(status: %i[expired cancelled]).to_a
@due_contributions = (2000..Date.today.year)
.to_a
.map do |year|
[year, @due_members.select {|m| m.expires_on < Date.new(year, 12, 31) }.map { |m|
OpenStruct.new(
member: m,
amount: m.employed? ? Config.regular_payment_value : Config.reduced_payment_value,
)
}]
end
.reject { |(_, m)| m.empty? }
end
# GET /contributions/new
def new
@contribution = Contribution.new
end
# GET /members/1/edit
# GET /contributions/1/edit
def edit
end
# POST /members
# POST /contributions
def create
@contribution = @member.contributions.build(contribution_params)
success = @member.register_contribution(
contribution_params,
params.dig(:contribution, :overriden_expires_on),
params.dig(:contribution, :should_send_notification) == "1")
Contribution.transaction do
if @contribution.save
@member.handle_new_contribution(@contribution, params.dig(:contribution, :overriden_expires_on))
@member.reset_status!
redirect_to @member, notice: "Contribution was successfully created."
else
render :new, status: :unprocessable_entity
end
if success
redirect_to @member, notice: "Contribution was successfully created."
else
render :new, status: :unprocessable_entity
end
end
# PATCH/PUT /members/1
# PATCH/PUT /contributions/1
def update
if @contribution.update(contribution_params)
redirect_to @contribution.member, notice: "Contribution was successfully updated."
@ -37,11 +72,11 @@ class ContributionsController < ApplicationController
end
end
#
# GET /members/1/delete
# GET /contributions/1/delete
def delete
end
# DELETE /members/1
# DELETE /contributions/1
def destroy
@member = @contribution.member
@contribution.destroy

View File

@ -0,0 +1,15 @@
class InitialSetupsController < ApplicationController
skip_before_action :initial_setup_redirect
before_action do
redirect_to("/") if !requires_initial_setup?
end
def show
end
def create
if User.count.zero?
@user = User.create!(email: params[:email], password: SecureRandom.hex(32))
end
end
end

View File

@ -0,0 +1,14 @@
class LettersController < ApplicationController
before_action :require_login
include MemberFilter
# POST /letters
def create
members = filtered_members
pdf = Letters.generate(params[:template], members)
send_data pdf, filename: "members.pdf", type: "application/pdf"
end
end

View File

@ -1,15 +1,13 @@
class MembersController < ApplicationController
before_action :require_login
before_action :set_member, only: %i[ show edit update delete destroy ]
before_action :set_member, only: %i[ show edit update delete destroy resend_registration ]
helper_method :sort_params
include MemberFilter
# GET /members
def index
params.delete(:status) if params[:status] == 'any'
params.delete(:category) if params[:category] == 'any'
@members = Member.all.order(sort_params.merge(number: :asc))
@members = @members.ransack(display_name_or_email_or_identification_number_i_cont: params[:q], status_cont: params[:status], category_cont: params[:category]).result
@members = filtered_members
end
# GET /members/1
@ -18,7 +16,7 @@ class MembersController < ApplicationController
# GET /members/new
def new
@member = Member.new
@member = Member.new(get_params)
end
# GET /members/1/edit
@ -27,16 +25,37 @@ class MembersController < ApplicationController
# POST /members
def create
@member = Member.new(member_params)
@member = Member.new(member_params.merge(number: (Member.maximum(:number) || 0) + 1))
if @member.save
@member.generate_missing_ifthenpay_links!
@member.reset_status!
NotificationMailer.with(member: @member).registration.deliver_now!
@member.notifications.create!(
template: "registration",
to_be_sent_on: Date.today,
sent_at: Time.current,
status: "sent",
)
redirect_to @member, notice: "Member was successfully created."
else
render :new, status: :unprocessable_entity
end
end
def resend_registration
NotificationMailer.with(member: @member).registration.deliver_now!
@member.notifications.create!(
template: "registration",
to_be_sent_on: Date.today,
sent_at: Time.current,
status: "sent",
)
redirect_to @member, notice: "Payment reminder sent."
end
# PATCH/PUT /members/1
def update
if @member.update(member_params)
@ -66,19 +85,10 @@ class MembersController < ApplicationController
# Only allow a list of trusted parameters through.
def member_params
params.fetch(:member, {}).permit(:display_name, :email, :identification_number, :category, :address, :joined_on, :expires_on, :wants_mailing_list, :prefers_postal)
params.fetch(:member, {}).permit(:display_name, :legal_name, :pronouns, :email, :identification_number, :category, :address, :joined_on, :expires_on, :wants_mailing_list, :prefers_postal)
end
def sort_params
field, direction = params.fetch(:sort, "").split(".")
directions = %w[ asc desc ]
fields = %w[ number expires_on joined_on email status display_name ]
if directions.include?(direction) && fields.include?(field)
{ field => direction }
else
{ number: :asc }
end
def get_params
params.permit(:display_name, :legal_name, :pronouns, :email, :identification_number, :category, :address, :joined_on, :expires_on, :wants_mailing_list, :prefers_postal)
end
end

View File

@ -0,0 +1,24 @@
class NotificationsController < ApplicationController
before_action :require_login
before_action :set_notification, only: [:deliver]
# GET /notifications
def index
@notifications = Notification.order(to_be_sent_on: :asc)
end
# POST /notifications/1/deliver
def deliver
@notification.deliver!
redirect_to @notification.member
end
private
# Use callbacks to share common setup or constraints between actions.
def set_notification
@notification = Notification.find(params[:id])
end
end

View File

@ -0,0 +1,44 @@
class PaymentsController < ApplicationController
def show
@payment = Payment.find(params[:id])
end
def callback
if ENV["IFTHENPAY_AP_KEY"] != params["key"]
render status: 403, json: { error: "invalid anti phishing key" }
else
member = Member.find_by(number: params["id"].to_i)
payment = IfThenPay
.payments(params["payment_datetime"])
.select { |p| p["Id"] == params["id"] }
.first
if payment.nil?
render status: 400, json: { error: "couldn't find payment" }
else
# TODO: handle double payments (impossible)
contribution_params = {
eurocents: payment["Valor"],
payment_method: {
IfThenPay.multibanco_account => "multibanco",
"MBWAY" => "mbway",
}.fetch(params["payment_method"]),
payment_on: params["payment_datetime"],
payment_reference: payment["Terminal"],
}
success = member.register_contribution(
contribution_params,
nil,
true
)
if success
render json: { ok: "yes" }
else
render status: 500, json: { error: "error registering payment" }
end
end
end
end
end

View File

@ -2,14 +2,15 @@ module MembersHelper
def link_to_current_with_sort text, default_sort
current_sort = stringify(sort_params)
pp [default_sort, current_sort]
current_params = request.params.except(:action, :controller)
if default_sort == current_sort
link_to text, members_path(sort: invert_sort_order(current_sort))
current_params.merge!(sort: invert_sort_order(current_sort))
else
link_to text, members_path(sort: default_sort)
current_params.merge!(sort: default_sort)
end
link_to text, members_path(current_params)
end
private

5
app/jobs/notify_job.rb Normal file
View File

@ -0,0 +1,5 @@
class NotifyJob < ApplicationJob
def perform
Notification.send_scheduled_for_today
end
end

5
app/jobs/sync_job.rb Normal file
View File

@ -0,0 +1,5 @@
class SyncJob < ApplicationJob
def perform
Member.reset_all_status!
end
end

13
app/lib/config.rb Normal file
View File

@ -0,0 +1,13 @@
module Config
class <<self
if ENV.fetch("BRANDING") == "d3"
include Config::D3
else
include Config::Ansol
end
def payment_iban
ENV.fetch("BRANDING_PAYMENT_IBAN")
end
end
end

56
app/lib/config/ansol.rb Normal file
View File

@ -0,0 +1,56 @@
module Config
module Ansol
def organization_short_name
"ANSOL"
end
def organization_full_name
"ANSOL - Associação Nacional para o Software Livre"
end
def organization_website
"https://ansol.org"
end
def regular_payment_value
30
end
def reduced_payment_value
6
end
def full_rights_vesting_period
6.months
end
def payment_pending_grace_period
90.days
end
def ifthenpay_payment_title
"Quotas ANSOL"
end
def payment_proof_email
"direccao@ansol.org"
end
def reduced_payment_description
"Caso queiras usufruir da quota reduzida de 6.00€ para estudantes, pessoas
desempregadas ou reformadas, envia-nos um comprovativo desse estatuto."
end
def header_color
"white"
end
def header_background_color
"#041952"
end
def organization_logo_url
"https://#{ENV['BASE_HOST']}/logo.png"
end
end
end

55
app/lib/config/d3.rb Normal file
View File

@ -0,0 +1,55 @@
module Config
module D3
def organization_short_name
"D3"
end
def organization_full_name
"Associação D3 - Defesa dos Direitos Digitais"
end
def organization_website
"https://direitosdigitais.pt"
end
def regular_payment_value
32
end
def reduced_payment_value
16
end
def full_rights_vesting_period
1.year
end
def payment_pending_grace_period
120.days
end
def ifthenpay_payment_title
"Quotas D3"
end
def payment_proof_email
"direccao@direitosdigitais.pt"
end
def reduced_payment_description
""
end
def header_color
"#60f163"
end
def header_background_color
"#424242"
end
def organization_logo_url
"https://direitosdigitais.pt/templates/g5_hydrogen/custom/images/d3/d3-logo/logo-d3-transparente.png"
end
end
end

View File

@ -16,4 +16,19 @@ module IfThenPay
JSON.parse(response.body)
end
def self.payments(date)
end_date = (Time.parse(date) + 1).strftime("%d-%m-%Y %H:%M:%S")
URI("https://ifthenpay.com/ifmbws/ifmbws.asmx/getPaymentsJson?chavebackoffice=#{ENV['IFTHENPAY_BO_KEY']}&entidade=&subentidade=&dtHrInicio=#{date}&dtHrFim=#{end_date}&referencia=&valor=&sandbox=0")
.then{|u| Net::HTTP.get(u)}
.then{|b| Nokogiri::XML(b).child.child.text}
.then{|x| JSON.parse(x)}
end
def self.multibanco_account
ENV['IFTHENPAY_ACCOUNTS']
.split(";")
.map { |acc| acc.split("|").first }
.find { |acc| acc.match?(/^\d+$/) }
end
end

67
app/lib/letters.rb Normal file
View File

@ -0,0 +1,67 @@
require 'zip'
require 'nokogiri'
require 'combine_pdf'
module Letters
def self.apply_template(io, params)
Zip::OutputStream.write_buffer do |out|
Zip::File.open(io) do |zip|
zip.each do |entry|
out.put_next_entry(entry.name)
if entry.name == "content.xml"
out.write apply_template_xml(entry.get_input_stream.read, params)
elsif !entry.directory?
out.write entry.get_input_stream.read
end
end
end
end
end
def self.apply_template_xml(xml, params)
doc = Nokogiri::XML(xml)
doc.xpath("//*[contains(text(), 'DISPLAY_NAME')]").each do |node|
node.content = node.content.gsub("DISPLAY_NAME", params["DISPLAY_NAME"])
end
address_lines = params['ADDRESS'].split("\n")
doc.xpath("//*[contains(text(), 'ADDRESS')]").each do |node|
newnodes = [node] + address_lines[1..].map do |line|
node.clone.tap do |c|
c.content = c.content.gsub("ADDRESS", line)
end
end
node.content = node.content.gsub("ADDRESS", address_lines.first)
newnodes.each_cons(2) do |p, n|
p.add_next_sibling(n)
end
end
doc.to_xml(save_with: 0)
end
def self.generate(template, members)
Dir.mktmpdir do |directory|
members.each do |member|
odt = apply_template(template, {
"DISPLAY_NAME" => member.display_name,
"ADDRESS" => member.address,
})
File.open("#{directory}/#{member.number}.odt", "wb") { |out| out.write(odt.string) }
end
`libreoffice --convert-to pdf --outdir #{directory} #{directory}/*.odt`
pdf = CombinePDF.new
Dir["#{directory}/*.pdf"].each do |file|
pdf << CombinePDF.load(file)
end
pdf.to_pdf
end
end
end

View File

@ -1,4 +1,5 @@
class ApplicationMailer < ActionMailer::Base
default from: email_address_with_name(ENV['SMTP_FROM_ADDRESS'], ENV['SMTP_FROM_NAME'])
default bcc: email_address_with_name(ENV['SMTP_FROM_ADDRESS'], ENV['SMTP_FROM_NAME'])
layout "mailer"
end

View File

@ -1,68 +1,64 @@
class NotificationMailer < ApplicationMailer
default to: ->() { @member.email }
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.notification_mailer.expiration_in_60d.subject
#
def expiration_in_60d
@notification = params[:notification]
mail to: params[:notification].member.email
set_member
mail
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.notification_mailer.expiration_in_30d.subject
#
def expiration_in_30d
@notification = params[:notification]
mail to: params[:notification].member.email
set_member
mail
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.notification_mailer.expired.subject
#
def expired
@notification = params[:notification]
mail to: params[:notification].member.email
set_member
mail
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.notification_mailer.expired_30d_ago.subject
#
def expired_30d_ago
@notification = params[:notification]
mail to: params[:notification].member.email
set_member
mail
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.notification_mailer.expired_60d_ago.subject
#
def expired_60d_ago
@notification = params[:notification]
mail to: params[:notification].member.email
set_member
mail
end
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.notification_mailer.cancelled.subject
#
def cancelled
@notification = params[:notification]
set_member
mail
end
mail to: params[:notification].member.email
def registration
set_member
mail
end
def first_payment_confirmation
set_contribution
mail
end
def payment_renewal_confirmation
set_contribution
mail
end
private
def set_contribution
@contribution = params[:contribution]
@member = @contribution.member
end
def set_member
@member = params[:member]
@payment = @member.create_payment
end
def default_i18n_subject
mailer_scope = self.class.mailer_name.tr("/", ".")
I18n.t(:subject, scope: [mailer_scope, action_name], organization_short_name: Config.organization_short_name)
end
end

View File

@ -1,4 +1,16 @@
class Contribution < ApplicationRecord
belongs_to :member
has_paper_trail
def member_number
Member.unscoped.find(member_id).number
end
def member_display_name
member&.display_name
end
def amount
eurocents
end
end

View File

@ -2,20 +2,40 @@ class Member < ApplicationRecord
default_scope { where(excluded: false) }
has_many :contributions
has_many :notifications
has_many :payments
has_paper_trail
def self.ransackable_attributes(auth_object = nil)
%w[display_name legal_name email identification_number]
end
def create_payment
payments.create(status: "pending")
end
def cancelled_on
expires_on + 90.days
expires_on + Config.payment_pending_grace_period
end
def obtains_full_rights_on
joined_on + Config.full_rights_vesting_period
end
def reset_status!
update(status: expected_status)
end
def employed?
# normal is deprecated, here for retrocompatibility reasons
category == "normal" || category == "employed"
end
def remove_personal_information!
update(
excluded: true,
display_name: "",
legal_name: "",
pronouns: "",
email: nil,
identification_number: "",
category: "",
@ -26,7 +46,7 @@ class Member < ApplicationRecord
def expected_status
if joined_on.nil?
:pending
elsif (joined_on + 6.months).future?
elsif obtains_full_rights_on.future?
:passive
elsif expires_on.future?
:active
@ -37,6 +57,48 @@ class Member < ApplicationRecord
end
end
def register_contribution(contribution_params, overriden_expires_on, should_send_notification)
Contribution.transaction do
is_first_contribution = self.contributions.empty?
contribution = self.contributions.build(contribution_params)
if contribution.save
self.handle_new_contribution(contribution, overriden_expires_on)
self.reset_status!
if should_send_notification
if is_first_contribution
NotificationMailer
.with(contribution: contribution)
.first_payment_confirmation
.deliver_now!
self.notifications.create!(
template: "first_payment_confirmation",
to_be_sent_on: Date.today,
sent_at: Time.current,
status: "sent",
)
else
NotificationMailer
.with(contribution: contribution)
.payment_renewal_confirmation
.deliver_now!
self.notifications.create!(
template: "payment_renewal_confirmation",
to_be_sent_on: Date.today,
sent_at: Time.current,
status: "sent",
)
end
end
true
else
false
end
end
end
def handle_new_contribution(contribution, overriden_expires_on)
if joined_on.nil?
self.joined_on = contribution.payment_on
@ -48,54 +110,49 @@ class Member < ApplicationRecord
save!
end
def regenerate_notifications
notifications.where(status: 'scheduled').delete_all
def todays_notification
candidate = Notification
.templates
.filter { |t| self.expires_on + t[:to_be_sent_on] <= Date.today }
.last
return if expires_on.nil?
if candidate
last_sent = self
.notifications
.where(status: 'sent', template: candidate[:template])
.where.not(sent_at: nil)
.order(:sent_at)
.last
[
{ to_be_sent_on: expires_on - 90.days, template: "expiration_in_60d" },
{ to_be_sent_on: expires_on - 30.days, template: "expiration_in_30d" },
{ to_be_sent_on: expires_on + 0.days, template: "expired" },
{ to_be_sent_on: expires_on + 30.days, template: "expired_30d_ago" },
{ to_be_sent_on: expires_on + 60.days, template: "expired_60d_ago" },
{ to_be_sent_on: expires_on + 90.days, template: "cancelled" },
].reject { |n| n[:to_be_sent_on].past? }.each do |n|
notifications.create(n.merge(status: "scheduled"))
if last_sent && self.expires_on + candidate[:to_be_sent_on] <= last_sent.sent_at
nil
else
self.notifications.new(
template: candidate[:template],
status: 'scheduled',
to_be_sent_on: Date.today,
)
end
end
end
def generate_missing_ifthenpay_links!
self.regular_ifthenpay_link = IfThenPay.generate_gateway_link(
id: number,
amount: "30.00",
description: "Quotas ANSOL",
amount: "%.2f" % Config.regular_payment_value,
description: Config.ifthenpay_payment_title,
) unless self.regular_ifthenpay_link.present?
self.reduced_ifthenpay_link = IfThenPay.generate_gateway_link(
id: number,
amount: "6.00",
description: "Quotas ANSOL",
amount: "%.2f" % Config.reduced_payment_value,
description: Config.ifthenpay_payment_title,
) unless self.reduced_ifthenpay_link.present?
save!
end
def self.reset_all_status!
Member.all.each do |member|
member.reset_status!
end
end
def self.generate_all_missing_ifthenpay_links!
Member.all.each do |member|
member.generate_missing_ifthenpay_links!
end
end
def self.regenerate_all_notifications
Member.all.each do |member|
member.regenerate_notifications
end
Member.all.each(&:reset_status!)
end
end

View File

@ -1,20 +1,29 @@
class Notification < ApplicationRecord
belongs_to :member
scope :scheduled_for_today, ->() { where(status: 'scheduled', to_be_sent_on: Date.today) }
def self.send_scheduled_for_today
scheduled_for_today.each do |n|
n.deliver!
end
Member
.where('expires_on < ?', Date.today - self.templates.first[:to_be_sent_on])
.filter_map(&:todays_notification)
.each(&:deliver!)
end
def self.templates
[
{ to_be_sent_on: -60.days, template: "expiration_in_60d" },
{ to_be_sent_on: -30.days, template: "expiration_in_30d" },
{ to_be_sent_on: 0.days, template: "expired" },
{ to_be_sent_on: 30.days, template: "expired_30d_ago" },
{ to_be_sent_on: 60.days, template: "expired_60d_ago" },
{ to_be_sent_on: Config.payment_pending_grace_period, template: "cancelled" },
]
end
def deliver!
# actually send the email.
NotificationMailer.with(notification: self).send(template).deliver_now!
update(status: 'sent', sent_at: Time.current)
rescue
# TODO: do something about failures
save!
NotificationMailer.with(member: self.member).send(template).deliver_now!
update(status: 'sent', sent_at: Time.current)
end
end

3
app/models/payment.rb Normal file
View File

@ -0,0 +1,3 @@
class Payment < ApplicationRecord
belongs_to :member
end

View File

@ -0,0 +1,31 @@
<h1><%= t 'contributions.due.title' %></h1>
<% @due_contributions.each do |(year, contributions)| %>
<h2><%= year %></h2>
<table class='zebra'>
<tr>
<th><%= t('members.attributes.display_name') %></th>
<th><%= t('members.attributes.expires_on') %></th>
<th><%= t('members.attributes.category') %></th>
<th><%= t('contributions.attributes.amount') %></th>
</tr>
<% contributions.each do |contribution| %>
<tr>
<td>
<%= link_to contribution.member do %><%= contribution.member.number %>. <%= contribution.member.display_name %><% end %>
</td>
<td><%= contribution.member.expires_on %></td>
<td><%= contribution.member.category %></td>
<td><%= number_to_currency(contribution.amount, unit: "€") %></td>
</tr>
<% end %>
<tfoot>
<tr>
<th>Total</th>
<th></th>
<th></th>
<th><%= number_to_currency(contributions.map(&:amount).sum, unit: "€") %></th>
</tr>
</tfoot>
</table>
<% end %>

View File

@ -0,0 +1,30 @@
<p style="color: green"><%= notice %></p>
<h1><%= t 'contributions.index.title' %></h1>
<table class='zebra'>
<tr>
<th><%= t('contributions.attributes.payment_on') %></th>
<th><%= t('members.attributes.display_name') %></th>
<th><%= t('contributions.attributes.amount') %></th>
<th><%= t('contributions.attributes.payment_method') %></th>
<th><%= t('members.index.actions.title') %></th>
</tr>
<% @contributions.each do |contribution| %>
<tr id="<%= dom_id contribution %>">
<td><%= contribution.payment_on %></td>
<td>
<% if contribution.member %>
<%= contribution.member.number %>. <%= contribution.member.display_name %>
<% else %>
---
<% end %>
</td>
<td><%= contribution.eurocents %></td>
<td><%= contribution.payment_method %></td>
<td>
<%= link_to t('members.index.actions.show'), contribution.member %>
</td>
</tr>
<% end %>
</table>

View File

@ -28,6 +28,10 @@
<td><label for="contribution_payment_reference"><%= t('contributions.attributes.payment_reference') %></label></td>
<td><%= form.text_field :payment_reference %></td>
</tr>
<tr>
<td><label for="contribution_should_send_notification"><%= t('contributions.attributes.should_send_notification') %></label></td>
<td><%= form.check_box :should_send_notification, checked: true %></td>
</tr>
<tr>
<td colspan=2>
<%= t('contributions.new.expires_on_warning') %>

View File

@ -0,0 +1,8 @@
<h1>Conta de administração criada!</h1>
<p>
Agora que o processo de criação de conta está terminado, basta usar o mecanismo
de recuperação de senha para definir uma senha nova:
</p>
<p style="text-align: center;"><%= link_to t('passwords.new.title'), new_password_path %></p>

View File

@ -0,0 +1,20 @@
<h1>Configurar o saucy</h1>
<p>
Esta instalação do ainda não foi configurada. Para terminar o processo de
configuração, é preciso criar uma conta de administração.
</p>
<p>
Depois deste processo terminado, é possível gerir até 5 contas de
administração. Atenção que qualquer uma delas consegue apagar as restantes (e
até a si própria).
</p>
<%= form_with(url: initial_setup_path) do |form| %>
<p><strong>Qual o endereço de correio electrónico que deve ser usado para criar a conta de administração?</strong></p>
<p>O endereço especificado tem de conseguir receber mensagens para o mecanismo de recuperação de senha funcionar.</p>
<%= form.email_field :email %>
<%= form.submit "Configurar" %>
<% end %>

View File

@ -11,11 +11,17 @@
</head>
<body>
<div class='banner' style="background-color: <%= Config.header_background_color %>;">
<img src="<%= Config.organization_logo_url %>" style="margin: 0px auto; max-width: 400px; display: block; color: <%= Config.header_color %>" alt="<%= Config.organization_full_name %>" />
</div>
<% if signed_in? %>
<nav>
<ul>
<li><%= link_to t('navigation.members'), members_path %></li>
<li><%= link_to t('navigation.board'), edit_board_path %></li>
<li><%= link_to t('navigation.notifications'), notifications_path %></li>
<li><%= link_to t('navigation.contributions'), contributions_path %></li>
<li><%= link_to t('navigation.due_contributions'), due_contributions_path %></li>
<li>
<%= button_to sign_out_path, method: :delete do %>
Sign out of <%= current_user.email %>
@ -25,6 +31,19 @@
</nav>
<% end %>
<%= yield %>
<main>
<%= yield %>
</main>
<footer>
<div>
<%= link_to Config.organization_full_name, Config.organization_website %>
</div>
<div>
<%= t('footer.description') %>
<%= t('footer.free_software_html') %>
</div>
</footer>
</body>
</html>

View File

@ -9,8 +9,8 @@
<body>
<div style="max-width: 600px;">
<div style="background-color: #041952; padding: 20px">
<img src="https://hugopeixoto.net/images/ansol-logo-white.png?xxx" style="margin: 0px auto; max-width: 400px; display: block; color: white" alt="ANSOL" />
<div style="background-color: <%= Config.header_background_color %>; padding: 20px; text-align: center;">
<img src="<%= Config.organization_logo_url %>" style="margin: 0px auto; max-width: 400px; display: block; color: <%= Config.header_color %>" alt="<%= Config.organization_full_name %>" />
</div>
<%= yield %>

View File

@ -18,6 +18,14 @@
<td><label><%= t('members.attributes.display_name') %></label></td>
<td><%= form.text_field :display_name, required: true %></label></td>
</tr>
<tr>
<td><label><%= t('members.attributes.legal_name') %></label></td>
<td><%= form.text_field :legal_name %></label></td>
</tr>
<tr>
<td><label><%= t('members.attributes.pronouns') %></label></td>
<td><%= form.text_field :pronouns %></label></td>
</tr>
<tr>
<td><label><%= t('members.attributes.email') %></label></td>
<td><%= form.email_field :email, required: true %></label></td>

View File

@ -2,18 +2,82 @@
<h1><%= t 'members.index.title' %></h1>
<%= link_to t('members.index.actions.new'), new_member_path %>
<p><%= link_to t('members.index.actions.new'), new_member_path %></p>
<%= form_with url: members_path, method: :get do |form| %>
<%= form.text_field :q %>
<%= form.select :status, %w[ any active passive pending expired cancelled ], selected: params[:status] %>
<%= form.select :category, %w[ any student employed unemployed retired ], selected: params[:category], multiple: true %>
<%= form.submit 'Search', name: '' %>
<% if params[:q].present? || params[:status].present? || params[:category].present? %>
<%= link_to t('members.index.actions.clear_search'), members_path %>
<% end %>
<fieldset>
<legend>Filtrar</legend>
<table class='noborder lined'>
<tr>
<td><%= t 'members.attributes.display_name' %></td>
<td><%= form.text_field :display_name, value: params[:display_name] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.legal_name' %></td>
<td><%= form.text_field :legal_name, value: params[:legal_name] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.email' %></td>
<td><%= form.text_field :email, value: params[:email] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.identification_number' %></td>
<td><%= form.text_field :identification_number, value: params[:identification_number] %></td>
</tr>
<tr>
<td><%= t 'members.attributes.status' %></td>
<td><%= form.select :status, %w[ any active passive pending expired cancelled ], { selected: params[:status] }, { multiple: true } %></td>
</tr>
<tr>
<td><%= t 'members.attributes.category' %></td>
<td>
<%= form.select :category, %w[ any student employed unemployed retired ], { selected: params[:category] }, { multiple: true } %>
</td>
</tr>
<tr>
<td><%= t 'members.attributes.prefers_postal' %></td>
<td>
<%= form.select :prefers_postal, %w[ any yes no ], selected: params[:prefers_postal] %>
</td>
</tr>
</td>
</tr>
</table>
<p><%= form.submit 'Search', name: '' %></p>
<% if params[:q].present? || params[:status].present? || params[:category].present? %>
<%= link_to t('members.index.actions.clear_search'), members_path %>
<% end %>
</fieldset>
<% end %>
<br>
<%= form_with url: letters_path do |form| %>
<fieldset>
<legend>Gerar PDF</legend>
<% (params.fetch(:status, []) - ['any', '']).each do |status| %>
<%= form.hidden_field 'status[]', value: status %>
<% end %>
<% (params.fetch(:category, []) - ['any', '']).each do |category| %>
<%= form.hidden_field 'category[]', value: category %>
<% end %>
<%= form.hidden_field :display_name, value: params[:display_name] %>
<%= form.hidden_field :email, value: params[:email] %>
<%= form.hidden_field :identification_number, value: params[:identification_number] %>
<%= form.hidden_field :prefers_postal, value: params[:prefers_postal] %>
<%= form.file_field :template, required: true %>
<%= form.submit 'Generate PDF' %>
</fieldset>
<% end %>
<p><%= t('members.index.results_count', count: @members.size) %></p>
<table class='zebra'>
<tr>
<th><%= link_to_current_with_sort t('members.attributes.number'), 'number.asc' %></th>
@ -33,12 +97,7 @@
<td><%= member.joined_on %></td>
<td><%= member.expires_on %></td>
<td>
<ul>
<li><%= link_to t('members.index.actions.show'), member %></li>
<li><%= link_to t('members.index.actions.edit'), edit_member_path(member) %></li>
<li><%= link_to t('members.index.actions.new_contribution'), new_member_contribution_path(member) %></li>
<li><%= link_to t('members.index.actions.delete'), delete_member_path(member) %></li>
</ul>
<%= link_to t('members.index.actions.show'), member %>
</td>
</tr>
<% end %>

View File

@ -15,8 +15,10 @@
<table>
<tr><td><label><%= t('members.attributes.display_name') %></label></td><td><%= form.text_field :display_name, required: true %></label></td></tr>
<tr><td><label><%= t('members.attributes.legal_name') %></label></td><td><%= form.text_field :legal_name, required: true %></label></td></tr>
<tr><td><label><%= t('members.attributes.pronouns') %></label></td><td><%= form.text_field :pronouns %></label></td></tr>
<tr><td><label><%= t('members.attributes.email') %></label></td><td><%= form.email_field :email, required: true %></label></td></tr>
<tr><td><label><%= t('members.attributes.category') %></label></td><td><%= form.select :category, %w{student retired unemployed employed} %></label></td></tr>
<tr><td><label><%= t('members.attributes.category') %></label></td><td><%= form.select :category, %w{student retired unemployed employed}, { include_blank: true }, { required: true } %></label></td></tr>
<tr><td><label><%= t('members.attributes.identification_number') %></label></td><td><%= form.text_field :identification_number %></label></td></tr>
<tr><td><label><%= t('members.attributes.address') %></label></td><td><%= form.text_area :address %></label></td></tr>
<tr><td><label><%= t('members.attributes.wants_mailing_list') %></label></td><td><%= form.check_box :wants_mailing_list %></label></td></tr>

View File

@ -3,22 +3,31 @@
<h1><%= t('members.show.title') %></h1>
<table class='lined'>
<tr><td><%= t('members.attributes.display_name') %></td><td><%= @member.display_name %></td></tr>
<tr><td><%= t('members.attributes.display_name') %></td><td><%= @member.number %>. <%= @member.display_name %></td></tr>
<tr><td><%= t('members.attributes.legal_name') %></td><td><%= @member.legal_name %></td></tr>
<tr><td><%= t('members.attributes.pronouns') %></td><td><%= @member.pronouns %></td></tr>
<tr><td><%= t('members.attributes.email') %></td><td><%= @member.email %></td></tr>
<tr><td><%= t('members.attributes.category') %></td><td><%= @member.category %></td></tr>
<tr><td><%= t('members.attributes.identification_number') %></td><td><%= @member.identification_number %></td></tr>
<tr><td><%= t('members.attributes.address') %></td><td><%= simple_format @member.address %></td></tr>
<tr><td><%= t('members.attributes.wants_mailing_list') %></td><td><%= bool_option @member.wants_mailing_list %></td></tr>
<tr><td><%= t('members.attributes.prefers_postal') %></td><td><%= bool_option @member.prefers_postal %></td></tr>
<tr><td><%= t('members.attributes.address') %></td><td><%= simple_format @member.address %></td></tr>
<tr><td><%= t('members.attributes.joined_on') %></td><td><%= @member.joined_on %></td></tr>
<tr><td><%= t('members.attributes.expires_on') %></td><td><%= @member.expires_on %></td></tr>
<tr><td><%= t('members.attributes.status') %></td><td><%= @member.status %></td></tr>
<tr><td><%= t('members.attributes.regular_ifthenpay_link') %></td><td><% if @member.regular_ifthenpay_link %><%= link_to @member.regular_ifthenpay_link, @member.regular_ifthenpay_link %><% end %></td></tr>
<tr><td><%= t('members.attributes.reduced_ifthenpay_link') %></td><td><% if @member.reduced_ifthenpay_link %><%= link_to @member.reduced_ifthenpay_link, @member.reduced_ifthenpay_link %><% end %></td></tr>
</table>
<div>
<%= link_to t('members.show.actions.edit'), edit_member_path(@member) %>
</div>
<div><%= link_to t('members.show.actions.edit'), edit_member_path(@member) %></div>
<div><%= link_to t('members.show.actions.delete'), delete_member_path(@member) %></div>
<%- if @member.status == "pending" %>
<div>
<%= form_with url: resend_registration_member_path(@member) do |form| %>
<%= form.submit t('members.show.actions.resend_registration') %>
<% end %>
</div>
<%- end %>
<h2><%= t('members.show.contribution_history') %></h2>
@ -29,14 +38,14 @@
<th><%= t('contributions.attributes.payment_reference') %></th>
<th><%= t('contributions.attributes.amount') %></th>
</tr>
<% @member.contributions.each do |contribution| %>
<% @member.contributions.order(payment_on: :asc).each do |contribution| %>
<tr>
<td><%= contribution.payment_on %></td>
<td><%= contribution.payment_method %></td>
<td><%= contribution.payment_reference %></td>
<td>€<%= contribution.eurocents %></td>
<td>
<ul>
<ul class='contribution-actions'>
<li><%= link_to t('members.show.actions.edit_contribution'), edit_contribution_path(contribution) %></div>
<li><%= link_to t('members.show.actions.delete_contribution'), delete_contribution_path(contribution) %></li>
</ul>
@ -45,7 +54,9 @@
<% end %>
</table>
<h2></h2>
<div>
<%= link_to t('members.index.actions.new_contribution'), new_member_contribution_path(@member) %>
</div>
<h2><%= t('members.show.notifications') %></h2>
@ -54,13 +65,27 @@
<th><%= t('notifications.attributes.to_be_sent_on') %></th>
<th><%= t('notifications.attributes.template') %></th>
<th><%= t('notifications.attributes.status') %></th>
<th><%= t('members.show.contribution_actions') %></th>
</tr>
<% @member.notifications.order(to_be_sent_on: :desc).each do |notification| %>
<% @member.notifications.order(to_be_sent_on: :asc).each do |notification| %>
<tr>
<td><%= notification.to_be_sent_on %></td>
<td><code><%= notification.template %></code></td>
<td><%= notification_status(notification.status) %></td>
<td>
<%= notification_status(notification.status) %>
<% if notification.status == 'sent' %>
(<%= notification.sent_at %>)
<% end %>
</td>
<td>
<% if notification.status == 'scheduled' %>
<%= form_with url: deliver_notification_path(notification) do |form| %>
<%= form.submit t('members.show.actions.deliver_notification') %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</table>
<%# link_to "Enviar email de confirmação de inscrição", new_member_message_path(@member, type: :welcome) %>

View File

@ -0,0 +1,4 @@
<p>
Saudações livres,<br>
Direcção da <%= Config.organization_short_name %>
</p>

View File

@ -0,0 +1,2 @@
Saudações livres,
Direcção da <%= Config.organization_short_name %>

View File

@ -0,0 +1,3 @@
<p>
<%= t('notification_mailer.greetings', display_name: member.display_name) %>
</p>

View File

@ -0,0 +1 @@
<%= t('notification_mailer.greetings', display_name: member.display_name) %>

View File

@ -3,20 +3,8 @@
MBWAY:
</p>
<ul>
<li>Valor: 30.00€</li>
<li>Transferência bancária: <strong>PT50 0035 2178 00027478430 14</strong></li>
<li>Multibanco ou MBWAY: <a href="<%= ifthenpay %>"><%= ifthenpay %></a></li>
</ul>
<p>
Caso queiras usufruir da quota reduzida de 6.00€ para estudantes,
desempregados e reformados, pedimos que nos envies um comprovativo desse
estatuto e faças o pagamento por transferência bancária.
</p>
<p>
Se optares pelo método de transferência bancária, pedimos que envies o
comprovativo de transferência em resposta a este email ou para o endereço
direccao@ansol.org.
</p>
<div align="center">
<a style="border: 1px solid #ccc; background-color: #eee; margin: 30px; display: inline-block; padding: 10px 20px; margin: 0px auto;" href="<%= payment_url(payment) %>">
<%= t('notification_mailer.payment_cta') %>
</a>
</div>

View File

@ -1,14 +1,3 @@
Aceitamos pagamento via transferência bancária, referência multibanco ou
MBWAY:
Aceitamos pagamento via transferência bancária, referência multibanco ou MBWAY:
* Valor: 30.00€
* Transferência bancária: <strong>PT50 0035 2178 00027478430 14</strong>
* Multibanco ou MBWAY: <a href="<%= @link %>"><%= @link %></a>
Caso queiras usufruir da quota reduzida de 6.00€ para estudantes,
desempregados e reformados, pedimos que nos envies um comprovativo desse
estatuto e faças o pagamento por transferência bancária.
Se optares pelo método de transferência bancária, pedimos que envies o
comprovativo de transferência em resposta a este email ou para o endereço
direccao@ansol.org.
<%= payment_url(payment) %>

View File

@ -1,10 +1,8 @@
<p>
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
</p>
<%= render partial: "greetings", locals: { member: @member } %>
<p>
Como não recebemos o pagamento anual das quotas da ANSOL, a tua inscrição foi
cancelada.
Como não recebemos o pagamento anual das quotas da <%= Config.organization_short_name %>,
a tua inscrição foi cancelada.
</p>
<p>
@ -24,7 +22,4 @@
rápido possível.
</p>
<p>
Saudações livres,<br>
Direcção da ANSOL
</p>
<%= render partial: "cheers" %>

View File

@ -1,7 +1,7 @@
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
<%= render partial: "greetings", locals: { member: @member } %>
Como não recebemos o pagamento anual das quotas da ANSOL, a tua inscrição foi
cancelada.
Como não recebemos o pagamento anual das quotas da <%= Config.organization_short_name %>,
a tua inscrição foi cancelada.
Vamos revogar em breve os teus acessos à infraestrutura da associação exclusiva
para membros (nextcloud, mailing list, sala de Matrix, etc).
@ -13,5 +13,4 @@ Caso consideres que estás a receber esta mensagem indevidamente, contacta-nos
através do endereço direccao@ansol.org para resolvermos a situação o mais
rápido possível.
Saudações livres,
Direcção da ANSOL
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<p><%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %></p>
<%= render partial: "greetings", locals: { member: @member } %>
<p>
A tua inscrição como membro da ANSOL expira em 30 dias.
@ -13,12 +13,9 @@
<p>
Para estender a tua inscrição por mais um ano, pedimos que faças o pagamento
das quotas até <strong><%= @notification.member.expires_on %></strong>.
das quotas até <strong><%= @member.expires_on %></strong>.
</p>
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
<p>
Saudações livres,<br>
Direcção da ANSOL
</p>
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
<%= render partial: "greetings", locals: { member: @member } %>
A tua inscrição como membro da ANSOL expira em 30 dias.
@ -8,9 +8,8 @@ nossas actividades, e gostaríamos de continuar a contar com a tua
participação.
Para estender a tua inscrição por mais um ano, pedimos que faças o pagamento
das quotas até <%= @notification.member.expires_on %>.
das quotas até <%= @member.expires_on %>.
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
Saudações livres,
Direcção da ANSOL
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<p><%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %></p>
<%= render partial: "greetings", locals: { member: @member } %>
<p>
A tua inscrição como membro da ANSOL expira em 60 dias.
@ -13,12 +13,9 @@
<p>
Para estender a tua inscrição por mais um ano, pedimos que faças o pagamento
das quotas até <strong><%= @notification.member.expires_on %></strong>.
das quotas até <strong><%= @member.expires_on %></strong>.
</p>
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
<p>
Saudações livres,<br>
Direcção da ANSOL
</p>
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
<%= render partial: "greetings", locals: { member: @member } %>
A tua inscrição como membro da ANSOL expira em 60 dias.
@ -8,9 +8,8 @@ nossas actividades, e gostaríamos de continuar a contar com a tua
participação.
Para estender a tua inscrição por mais um ano, pedimos que faças o pagamento
das quotas até <%= @notification.member.expires_on %>.
das quotas até <%= @member.expires_on %>.
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
Saudações livres,
Direcção da ANSOL
<%= render partial: "cheers" %>

View File

@ -1,6 +1,4 @@
<p>
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
</p>
<%= render partial: "greetings", locals: { member: @member } %>
<p>
A tua inscrição como membro da ANSOL vai ser cancelada dentro de 30 dias por
@ -12,15 +10,12 @@
nossas actividades. Gostaríamos de continuar a contar com a tua participação.
</p>
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
<p>
Caso não recebamos o pagamento até dia <%= @notification.member.cancelled_on
Caso não recebamos o pagamento até dia <%= @member.cancelled_on
%>, cancelaremos permanentemente a tua inscrição. Estamos disponíveis para
esclarecer qualquer dúvida através do endereço direccao@ansol.org.
</p>
<p>
Saudações livres,<br>
Direcção da ANSOL
</p>
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
<%= render partial: "greetings", locals: { member: @member } %>
A tua inscrição como membro da ANSOL expirou hoje e não recebemos a tua
contribuição anual.
@ -6,11 +6,10 @@ contribuição anual.
Dependemos exclusivamente da contribuição dos nossos membros para suportar as
nossas actividades. Gostaríamos de continuar a contar com a tua participação.
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
Caso não recebamos o pagamento até dia <%= @notification.member.cancelled_on
Caso não recebamos o pagamento até dia <%= @member.cancelled_on
%>, cancelaremos permanentemente a tua inscrição. Estamos disponíveis para
esclarecer qualquer dúvida através do endereço direccao@ansol.org.
Saudações livres,
Direcção da ANSOL
<%= render partial: "cheers" %>

View File

@ -1,6 +1,4 @@
<p>
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
</p>
<%= render partial: "greetings", locals: { member: @member } %>
<p>
A tua inscrição como membro da ANSOL expirou há um mês e ainda não recebemos
@ -12,15 +10,12 @@
nossas actividades. Gostaríamos de continuar a contar com a tua participação.
</p>
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
<p>
Caso não recebamos o pagamento até dia <%= @notification.member.cancelled_on
Caso não recebamos o pagamento até dia <%= @member.cancelled_on
%>, cancelaremos permanentemente a tua inscrição. Estamos disponíveis para
esclarecer qualquer dúvida através do endereço direccao@ansol.org.
</p>
<p>
Saudações livres,
Direcção da ANSOL
</p>
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
<%= render partial: "greetings", locals: { member: @member } %>
A tua inscrição como membro da ANSOL expirou há um mês e ainda não recebemos
a tua contribuição anual.
@ -6,11 +6,10 @@ a tua contribuição anual.
Dependemos exclusivamente da contribuição dos nossos membros para suportar as
nossas actividades. Gostaríamos de continuar a contar com a tua participação.
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
Caso não recebamos o pagamento até dia <%= @notification.member.cancelled_on
Caso não recebamos o pagamento até dia <%= @member.cancelled_on
%>, cancelaremos permanentemente a tua inscrição. Estamos disponíveis para
esclarecer qualquer dúvida através do endereço direccao@ansol.org.
Saudações livres,
Direcção da ANSOL
<%= render partial: "cheers" %>

View File

@ -1,6 +1,4 @@
<p>
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
</p>
<%= render partial: "greetings", locals: { member: @member } %>
<p>
A tua inscrição como membro da ANSOL vai ser cancelada dentro de 30 dias por
@ -12,15 +10,12 @@
nossas actividades. Gostaríamos de continuar a contar com a tua participação.
</p>
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
<p>
Caso não recebamos o pagamento até dia <%= @notification.member.cancelled_on
Caso não recebamos o pagamento até dia <%= @member.cancelled_on
%>, cancelaremos permanentemente a tua inscrição. Estamos disponíveis para
esclarecer qualquer dúvida através do endereço direccao@ansol.org.
</p>
<p>
Saudações livres,<br>
Direcção da ANSOL
</p>
<%= render partial: "cheers" %>

View File

@ -1,4 +1,4 @@
<%= t('notification_mailer.greetings', display_name: @notification.member.display_name) %>
<%= render partial: "greetings", locals: { member: @member } %>
A tua inscrição como membro da ANSOL expirou há 60 dias e ainda não recebemos
a tua contribuição anual.
@ -6,11 +6,10 @@ a tua contribuição anual.
Dependemos exclusivamente da contribuição dos nossos membros para suportar as
nossas actividades. Gostaríamos de continuar a contar com a tua participação.
<%= render partial: "payment", locals: { ifthenpay: @link } %>
<%= render partial: "payment", locals: { payment: @payment } %>
Caso não recebamos o pagamento até dia <%= @notification.member.cancelled_on
Caso não recebamos o pagamento até dia <%= @member.cancelled_on
%>, cancelaremos permanentemente a tua inscrição. Estamos disponíveis para
esclarecer qualquer dúvida através do endereço direccao@ansol.org.
Saudações livres,
Direcção da ANSOL
<%= render partial: "cheers" %>

View File

@ -0,0 +1,60 @@
<%= render partial: "greetings", locals: { member: @member } %>
<p>
Bem-vinde à ANSOL! Confirmamos que recebemos o teu pagamento, e tua inscrição
está válida até <strong><%= @contribution.member.expires_on %></strong>.
</p>
<p>Detalhes do pagamento:</p>
<ul>
<li><strong>Valor:</strong> <%= @contribution.eurocents %></li>
<li><strong>Método:</strong> <%= @contribution.payment_method %></li>
<li><strong>Data:</strong> <%= @contribution.payment_on %></li>
</ul>
<p>
Vamos inscrever-te na lista de discussão de sócios ansol-socios@ansol.org.
Quando o fizermos vais receber um email de confirmação. A maior parte de
comunicações que são enviadas são os relatórios trimestrais (disponíveis
também no nosso site em https://ansol.org/noticias/), convocatórias para as
assembleias gerais, e convites para participar na reunião mensal com a direcção.
</p>
<p>
Na primeira quarta feira de todos os meses às 22h a direcção faz uma reunião
aberta para que os sócios possam trazer assuntos / fazer perguntas / etc. As
reuniões são feitas no nosso Jitsi, em
<a href="https://jitsi.ansol.org/ansol-direccao">https://jitsi.ansol.org/ansol-direccao</a>.
</p>
<p>Temos uma sala da comunidade da ANSOL aberta ao público à qual podes aceder:</p>
<ul>
<li>Via Matrix: #geral:ansol.org, ou</li>
<li>Via Telegram: https://t.me/ansolgeral</li>
</ul>
<p>
Também temos uma sala de Matrix reservada a sócios (#socios:ansol.org).
Envia-nos o teu nome de utilizador de Matrix e nós adicionamos-te à sala.
Caso não conheças o Matrix, temos uma pequena introdução aqui:
<a href="https://gist.github.com/hugopeixoto/128a313ae33109f4b0a55f7242c660f0">
https://gist.github.com/hugopeixoto/128a313ae33109f4b0a55f7242c660f0
</a>
</p>
<p>Podes seguir as nossas actividades online através de várias plataformas:</p>
<ul>
<li><a href="https://floss.social/@ansol">Mastodon</a></li>
<li><a href="https://viste.pt/c/ansol/">Peertube</a></li>
<li><a href="https://git.ansol.org/ansol/">Git</a></li>
<li><a href="https://twitter.com/ANSOL">Twitter</a></li>
</ul>
<p>
Qualquer dúvida em relação às actividades actuais da ANSOL, não hesites em
mandar email.
</p>
<%= render partial: "cheers" %>

View File

@ -0,0 +1,42 @@
<%= render partial: "greetings", locals: { member: @member } %>
Bem-vinde à ANSOL! Confirmamos que recebemos o teu pagamento, e tua inscrição
está válida até <%= @contribution.member.expires_on %>.
Detalhes do pagamento:
* Valor: <%= @contribution.eurocents %>
* Método: <%= @contribution.payment_method %>
* Data: <%= @contribution.payment_on %>
Vamos inscrever-te na lista de discussão de sócios ansol-socios@ansol.org.
Quando o fizermos vais receber um email de confirmação. A maior parte de
comunicações que são enviadas são os relatórios trimestrais (disponíveis
também no nosso site em https://ansol.org/noticias/), convocatórias para as
assembleias gerais, e convites para participar na reunião mensal com a direcção.
Na primeira quarta feira de todos os meses às 22h a direcção faz uma reunião
aberta para que os sócios possam trazer assuntos / fazer perguntas / etc. As
reuniões são feitas no nosso Jitsi, em https://jitsi.ansol.org/ansol-direccao.
Temos uma sala da comunidade da ANSOL aberta ao público à qual podes aceder:
* Via Matrix: #geral:ansol.org, ou
* Via Telegram: https://t.me/ansolgeral
Também temos uma sala de Matrix reservada a sócios (#socios:ansol.org).
Envia-nos o teu nome de utilizador de Matrix e nós adicionamos-te à sala.
Caso não conheças o Matrix, temos uma pequena introdução aqui:
https://gist.github.com/hugopeixoto/128a313ae33109f4b0a55f7242c660f0
Podes seguir as nossas actividades online através de várias plataformas:
* Mastodon: https://floss.social/@ansol
* Peertube: https://viste.pt/c/ansol/
* Git: https://git.ansol.org/ansol/
* Twitter: https://twitter.com/ANSOL
Qualquer dúvida em relação às actividades actuais da ANSOL, não hesites em
mandar email.
<%= render partial: "cheers" %>

View File

@ -0,0 +1,16 @@
<%= render partial: "greetings", locals: { member: @member } %>
<p>
Recebemos o teu pagamento. Obrigado por continuares a apoiar a ANSOL. A tua
inscrição foi renovada e está válida até
<strong><%= @contribution.member.expires_on %></strong>.
</p>
<p>Detalhes do pagamento:</p>
<ul>
<li><strong>Valor:</strong> <%= @contribution.eurocents %></li>
<li><strong>Método:</strong> <%= @contribution.payment_method %></li>
<li><strong>Data:</strong> <%= @contribution.payment_on %></li>
</ul>
<%= render partial: "cheers" %>

View File

@ -0,0 +1,12 @@
<%= render partial: "greetings", locals: { member: @member } %>
Recebemos o teu pagamento. Obrigado por continuares a apoiar a ANSOL. A tua
inscrição foi renovada e está válida até <%= @contribution.member.expires_on %>.
Detalhes do pagamento:
* Valor: <%= @contribution.eurocents %>
* Método: <%= @contribution.payment_method %>
* Data: <%= @contribution.payment_on %>
<%= render partial: "cheers" %>

View File

@ -0,0 +1,22 @@
<%= render partial: "greetings", locals: { member: @member } %>
<p>
Obrigado pelo interesse em fazer parte da ANSOL. A tua candidatura foi
aprovada pela direcção.
</p>
<p>
Para finalizar o teu registo, falta apenas o pagamento da quota anual, no
valor de <%= number_with_precision(Config.regular_payment_value, precision: 2) %>€
(ou <%= number_with_precision(Config.reduced_payment_value, precision: 2) %>€
para pessoas reformadas, desempregadas, ou estudantes).
</p>
<%= render partial: "payment", locals: { payment: @payment } %>
<p>
Depois do pagamento estar confirmado, enviamos-te informações sobre os canais
de comunicação da associação, reuniões, etc.
</p>
<%= render partial: "cheers" %>

View File

@ -0,0 +1,16 @@
<%= render partial: "greetings", locals: { member: @member } %>
Obrigado pelo interesse em fazer parte da ANSOL. A tua candidatura foi aprovada
pela direcção.
Para finalizar o teu registo, falta apenas o pagamento da quota anual, no valor
de <%= number_with_precision(Config.regular_payment_value, precision: 2) %>€
(ou <%= number_with_precision(Config.reduced_payment_value, precision: 2) %>€
para pessoas reformadas, desempregadas, ou estudantes).
<%= render partial: "payment", locals: { payment: @payment } %>
Depois do pagamento estar confirmado, enviamos-te informações sobre os canais
de comunicação da associação, reuniões, etc.
<%= render partial: "cheers" %>

View File

@ -0,0 +1,32 @@
<h1><%= t('notifications.index.title') %></h1>
<table class='zebra'>
<tr>
<th><%= t('notifications.attributes.to_be_sent_on') %></th>
<th><%= t('notifications.attributes.status') %></th>
<th><%= t('notifications.attributes.template') %></th>
<th><%= t('notifications.attributes.member') %></th>
<th><%= t('members.show.contribution_actions') %></th>
</tr>
<% @notifications.each do |notification| %>
<tr>
<td><%= notification.to_be_sent_on %></td>
<td><%= notification.status %></td>
<td><code><%= notification.template %></code></td>
<td>
<% if notification.member %>
<%= link_to notification.member do %><%= notification.member.display_name %> &lt;<%= notification.member.email %>&gt;<% end %>
<% else %>
---
<% end %>
</td>
<td>
<% if notification.status == 'scheduled' %>
<%= form_with url: deliver_notification_path(notification) do |form| %>
<%= form.submit t('members.show.actions.deliver_notification') %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</table>

View File

@ -0,0 +1,74 @@
<h1>Pagamento de quotas</h1>
<% if @payment.member.status == "pending" %>
<p>
Olá <strong><%= @payment.member.display_name %></strong>.
Para concluir a tua inscrição, pedimos que faças o pagamento das quotas.
</p>
<% elsif @payment.member.status == "passive" || @payment.member.status == "active" %>
<p>
Olá <strong><%= @payment.member.display_name %></strong>.
Para estender a tua inscrição por
mais um ano, pedimos que faças o pagamento das quotas até
<strong><%= @payment.member.expires_on %></strong>.
</p>
<% else %>
<p>
Olá <strong><%= @payment.member.display_name %></strong>.
A tua inscrição expirou em <strong><%= @payment.member.expires_on %></strong>.
Para estender a tua inscrição por mais um ano, pedimos que faças o
pagamento das quotas.
</p>
<% end %>
<p><%= Config.reduced_payment_description %></p>
<p>Aceitamos pagamento via transferência bancária, referência multibanco ou MBWAY.</p>
<div>
<input class="show-hide-toggle" type='checkbox' id='regular' />
<label class="show-hide-button" for="regular">Pagamento normal (<%= number_with_precision(Config.regular_payment_value, precision: 2) %>€)</label>
<div class="show-hide-box">
<p>Valor: <%= number_with_precision(Config.regular_payment_value, precision: 2) %>€</p>
<p><%= link_to "Pagar por Multibanco ou MBWAY", @payment.member.regular_ifthenpay_link, class: 'button' %></p>
<p>Pagar por transferência bancária:</p>
<ul>
<li>IBAN: <strong><%= Config.payment_iban %></strong></li>
<li>obrigatório enviar comprovativo de pagamento para <%= Config.payment_proof_email %></li>
</ul>
</div>
</div>
<div style='margin-top: 10px;'>
<input class="show-hide-toggle" type='checkbox' id='reduced' />
<label class="show-hide-button" for="reduced">Pagamento reduzido (<%= number_with_precision(Config.reduced_payment_value, precision: 2) %>€)</label>
<div class="show-hide-box">
<p>Valor: <%= number_with_precision(Config.reduced_payment_value, precision: 2) %>€</p>
<p><%= link_to "Pagar por Multibanco ou MBWAY", @payment.member.reduced_ifthenpay_link, class: 'button' %></p>
<p>Pagar por transferência bancária:</p>
<ul>
<li>IBAN: <strong><%= Config.payment_iban %></strong></li>
<li>obrigatório enviar comprovativo de pagamento para <%= Config.payment_proof_email %></li>
</ul>
</div>
</div>
<style>
.button { border: 1px solid #ccc; background-color: #eee; cursor: pointer; padding: 4px 10px; display: inline-block; text-align: center; }
.show-hide-button { border: 1px solid #ccc; background-color: #eee; cursor: pointer; padding: 4px; display: block; text-align: center; }
.show-hide-toggle { display: none; }
.show-hide-toggle:not(:checked) ~ .show-hide-box { display: none; }
.show-hide-toggle:checked ~ .show-hide-box {
display: block;
overflow: auto;
padding: 10px 30px;
border: 1px solid #ccc;
border-top: 0;
}
.show-hide-box ul {
margin-left: 30px;
}
</style>

6
bin/jobs Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require_relative "../config/environment"
require "solid_queue/cli"
SolidQueue::Cli.start(ARGV)

View File

@ -5,7 +5,7 @@ require "fileutils"
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do

View File

@ -21,7 +21,12 @@ Bundler.require(*Rails.groups)
module Saucy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 7.1
# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))
# Configuration for the application, engines, and railties goes here.
#

View File

@ -6,7 +6,7 @@ Rails.application.configure do
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.enable_reloading = true
# Do not eager load code on boot.
config.eager_load = false
@ -45,18 +45,20 @@ Rails.application.configure do
config.action_mailer.smtp_settings = {
address: ENV['SMTP_ADDRESS'],
port: 587,
port: ENV.fetch('SMTP_PORT', "587").to_i,
domain: ENV['SMTP_DOMAIN'],
user_name: ENV['SMTP_USERNAME'],
password: ENV['SMTP_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true,
enable_starttls_auto: ENV.fetch("SMTP_STARTTLS", "true") == "true",
}
config.action_mailer.default_url_options = {
host: ENV['BASE_HOST'],
}
config.action_mailer.asset_host = "https://#{ENV['BASE_HOST']}"
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
@ -72,6 +74,11 @@ Rails.application.configure do
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
@ -79,6 +86,6 @@ Rails.application.configure do
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end

View File

@ -4,7 +4,7 @@ Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
config.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
@ -13,17 +13,22 @@ Rails.application.configure do
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
# Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
# Do not fall back to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.asset_host = "http://assets.example.com"
@ -34,21 +39,31 @@ Rails.application.configure do
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
# config.assume_ssl = true
# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :info
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Log to STDOUT by default
config.logger = ActiveSupport::Logger.new(STDOUT)
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# "info" includes generic and useful information about system operation, but avoids logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
# want to log everything, set the level to "debug".
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
config.active_job.queue_adapter = :solid_queue
# config.active_job.queue_name_prefix = "saucy_production"
config.action_mailer.perform_caching = false
@ -57,6 +72,22 @@ Rails.application.configure do
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = {
address: ENV['SMTP_ADDRESS'],
port: ENV.fetch('SMTP_PORT', "587").to_i,
domain: ENV['SMTP_DOMAIN'],
user_name: ENV['SMTP_USERNAME'],
password: ENV['SMTP_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: ENV.fetch("SMTP_STARTTLS", "true") == "true",
}
config.action_mailer.default_url_options = {
host: ENV['BASE_HOST'],
}
config.action_mailer.asset_host = "https://#{ENV['BASE_HOST']}"
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
@ -79,4 +110,12 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
# Enable DNS rebinding protection and other `Host` header attacks.
# config.hosts = [
# "example.com", # Allow requests from example.com
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
# ]
# Skip DNS rebinding protection for the default health check endpoint.
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
end

View File

@ -8,12 +8,13 @@ require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true
# While tests run files are not watched, reloading is not necessary.
config.enable_reloading = false
# Eager loading loads your whole application. When running a single test locally,
# this probably isn't necessary. It's a good idea to do in a continuous integration
# system, or in some way before deploying your code.
# Eager loading loads your entire application. When running a single test locally,
# this is usually not necessary, and can slow down your test suite. However, it's
# recommended that you enable it in continuous integration systems to ensure eager
# loading is working properly before deploying your code.
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
@ -23,12 +24,12 @@ Rails.application.configure do
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Render exception templates for rescuable exceptions and raise for other exceptions.
config.action_dispatch.show_exceptions = :rescuable
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
@ -57,4 +58,7 @@ Rails.application.configure do
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = true
end

View File

@ -2,7 +2,7 @@ Clearance.configure do |config|
config.allow_sign_up = false
config.mailer_sender = ENV['SMTP_FROM_ADDRESS']
config.rotate_csrf_on_sign_in = true
config.secure_cookie = true
config.secure_cookie = ENV.fetch("SECURE_COOKIE", "true") == "true"
config.signed_cookie = true
config.sign_in_guards = ["ActiveGuard"]
end

View File

@ -16,9 +16,9 @@
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap and inline scripts
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src)
# config.content_security_policy_nonce_directives = %w(script-src style-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true

View File

@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@ -0,0 +1,284 @@
# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.1 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `7.1`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
###
# No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able
# to manually require files that are managed by the autoloader, which you shouldn't do anyway.
#
# This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
# of the bootsnap cache if you use it.
#
# To set this configuration, add the following line to `config/application.rb` (NOT this file):
# config.add_autoload_paths_to_load_path = false
###
# Remove the default X-Download-Options headers since it is used only by Internet Explorer.
# If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`.
#++
# Rails.application.config.action_dispatch.default_headers = {
# "X-Frame-Options" => "SAMEORIGIN",
# "X-XSS-Protection" => "0",
# "X-Content-Type-Options" => "nosniff",
# "X-Permitted-Cross-Domain-Policies" => "none",
# "Referrer-Policy" => "strict-origin-when-cross-origin"
# }
###
# Do not treat an `ActionController::Parameters` instance
# as equal to an equivalent `Hash` by default.
#++
# Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false
###
# Active Record Encryption now uses SHA-256 as its hash digest algorithm.
#
# There are 3 scenarios to consider.
#
# 1. If you have data encrypted with previous Rails versions, and you have
# +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
# before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too:
#++
# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1
#
# 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default
# in 7.0), then you need to configure SHA-256 for Active Record Encryption:
#++
# Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256
#
# 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
# configure the default behavior starting 7.1+:
#++
# Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false
###
# No longer run after_commit callbacks on the first of multiple Active Record
# instances to save changes to the same database row within a transaction.
# Instead, run these callbacks on the instance most likely to have internal
# state which matches what was committed to the database, typically the last
# instance to save.
#++
# Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false
###
# Configures SQLite with a strict strings mode, which disables double-quoted string literals.
#
# SQLite has some quirks around double-quoted string literals.
# It first tries to consider double-quoted strings as identifier names, but if they don't exist
# it then considers them as string literals. Because of this, typos can silently go unnoticed.
# For example, it is possible to create an index for a non existing column.
# See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details.
#++
# Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
###
# Disable deprecated singular associations names.
#++
# Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
###
# Enable the Active Job `BigDecimal` argument serializer, which guarantees
# roundtripping. Without this serializer, some queue adapters may serialize
# `BigDecimal` arguments as simple (non-roundtrippable) strings.
#
# When deploying an application with multiple replicas, old (pre-Rails 7.1)
# replicas will not be able to deserialize `BigDecimal` arguments from this
# serializer. Therefore, this setting should only be enabled after all replicas
# have been successfully upgraded to Rails 7.1.
#++
# Rails.application.config.active_job.use_big_decimal_serializer = true
###
# Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
# `write` are given an invalid `expires_at` or `expires_in` time.
# Options are `true`, and `false`. If `false`, the exception will be reported
# as `handled` and logged instead.
#++
# Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
###
# Specify whether Query Logs will format tags using the SQLCommenter format
# (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format.
# Options are `:legacy` and `:sqlcommenter`.
#++
# Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
###
# Specify the default serializer used by `MessageEncryptor` and `MessageVerifier`
# instances.
#
# The legacy default is `:marshal`, which is a potential vector for
# deserialization attacks in cases where a message signing secret has been
# leaked.
#
# In Rails 7.1, the new default is `:json_allow_marshal` which serializes and
# deserializes with `ActiveSupport::JSON`, but can fall back to deserializing
# with `Marshal` so that legacy messages can still be read.
#
# In Rails 7.2, the default will become `:json` which serializes and
# deserializes with `ActiveSupport::JSON` only.
#
# Alternatively, you can choose `:message_pack` or `:message_pack_allow_marshal`,
# which serialize with `ActiveSupport::MessagePack`. `ActiveSupport::MessagePack`
# can roundtrip some Ruby types that are not supported by JSON, and may provide
# improved performance, but it requires the `msgpack` gem.
#
# For more information, see
# https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer
#
# If you are performing a rolling deploy of a Rails 7.1 upgrade, wherein servers
# that have not yet been upgraded must be able to read messages from upgraded
# servers, first deploy without changing the serializer, then set the serializer
# in a subsequent deploy.
#++
Rails.application.config.active_support.message_serializer = :json
###
# Enable a performance optimization that serializes message data and metadata
# together. This changes the message format, so messages serialized this way
# cannot be read by older versions of Rails. However, messages that use the old
# format can still be read, regardless of whether this optimization is enabled.
#
# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
# not yet been upgraded must be able to read messages from upgraded servers,
# leave this optimization off on the first deploy, then enable it on a
# subsequent deploy.
#++
# Rails.application.config.active_support.use_message_serializer_for_metadata = true
###
# Set the maximum size for Rails log files.
#
# `config.load_defaults 7.1` does not set this value for environments other than
# development and test.
#++
# if Rails.env.local?
# Rails.application.config.log_file_size = 100 * 1024 * 1024
# end
###
# Enable raising on assignment to attr_readonly attributes. The previous
# behavior would allow assignment but silently not persist changes to the
# database.
#++
# Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
###
# Enable validating only parent-related columns for presence when the parent is mandatory.
# The previous behavior was to validate the presence of the parent record, which performed an extra query
# to get the parent every time the child record was updated, even when parent has not changed.
#++
# Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
###
# Enable precompilation of `config.filter_parameters`. Precompilation can
# improve filtering performance, depending on the quantity and types of filters.
#++
# Rails.application.config.precompile_filter_parameters = true
###
# Enable before_committed! callbacks on all enrolled records in a transaction.
# The previous behavior was to only run the callbacks on the first copy of a record
# if there were multiple copies of the same record enrolled in the transaction.
#++
# Rails.application.config.active_record.before_committed_on_all_records = true
###
# Disable automatic column serialization into YAML.
# To keep the historic behavior, you can set it to `YAML`, however it is
# recommended to explicitly define the serialization method for each column
# rather than to rely on a global default.
#++
# Rails.application.config.active_record.default_column_serializer = nil
###
# Enable a performance optimization that serializes Active Record models
# in a faster and more compact way.
#
# To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
# not yet been upgraded must be able to read caches from upgraded servers,
# leave this optimization off on the first deploy, then enable it on a
# subsequent deploy.
#++
# Rails.application.config.active_record.marshalling_format_version = 7.1
###
# Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
# This matches the behaviour of all other callbacks.
# In previous versions of Rails, they ran in the inverse order.
#++
# Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
###
# Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`.
#++
# Rails.application.config.active_record.commit_transaction_on_non_local_return = true
###
# Controls when to generate a value for <tt>has_secure_token</tt> declarations.
#++
# Rails.application.config.active_record.generate_secure_token_on = :initialize
###
# ** Please read carefully, this must be configured in config/application.rb **
#
# Change the format of the cache entry.
#
# Changing this default means that all new cache entries added to the cache
# will have a different format that is not supported by Rails 7.0
# applications.
#
# Only change this value after your application is fully deployed to Rails 7.1
# and you have no plans to rollback.
# When you're ready to change format, add this to `config/application.rb` (NOT
# this file):
# config.active_support.cache_format_version = 7.1
###
# Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your
# platform.
#
# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action View to use HTML5-compliant
# sanitizers if they are supported, else fall back to HTML4 sanitizers.
#
# In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor.
#++
# Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
###
# Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your
# platform.
#
# `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action Text to use HTML5-compliant
# sanitizers if they are supported, else fall back to HTML4 sanitizers.
#
# In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor.
#++
# Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
###
# Configure the log level used by the DebugExceptions middleware when logging
# uncaught exceptions during requests.
#++
# Rails.application.config.action_dispatch.debug_exception_log_level = :error
###
# Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5
# parsers.
#
# Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4.
#
# In previous versions of Rails, these test helpers always used an HTML4 parser.
#++
# Rails.application.config.dom_testing_default_html_version = :html5

View File

@ -1,11 +1,13 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera :none
# policy.gyroscope :none
# policy.microphone :none
# policy.usb :none
# policy.fullscreen :self
# policy.payment :self, "https://secure.example.com"
# end

View File

@ -0,0 +1,21 @@
---
pt:
clearance:
models:
clearance_mailer:
change_password: Recuperação de senha
clearance_mailer:
change_password:
closing: Se não fizeste esse pedido, ignora esta mensagem. A tua senha não foi alterada.
link_text: Actualizar senha
opening: "Alguém requisitou o envio desta mensagem de recuperação de senha:"
passwords:
create:
description: Vais receber uma mensagem nos próximos minutos com instruções de como fazer a recuperação de senha.
new:
description: Introduz o teu endereço de correio electrónico para receberes uma mensagem com as instruções de recuperação de senha.
title: Recupera a tua senha
sessions:
form:
forgot_password: Esqueceste-te da senha?
sign_up: Registo

View File

@ -1,6 +1,16 @@
en:
option:
positive: Yes
negative: No
navigation:
members: "Member list"
board: "Board"
notifications: "Notificações"
contributions: "Contributions"
due_contributions: "Dues"
footer:
description: saucy Membership management platform.
free_software_html: It's <a href="https://git.ansol.org/ansol/saucy">Free Software</a>.
members:
index:
title: "Members"
@ -14,6 +24,7 @@ en:
title: "Member details"
actions:
edit: "Edit"
resend_registration: "Send initial payment email reminder"
edit:
title: "Edit member details"
actions:
@ -26,6 +37,8 @@ en:
status: "Status"
email: "Email address"
display_name: "Display name"
legal_name: "Legal name"
pronouns: "Pronouns"
joined_on: "Joined on"
expires_on: "Expires on"
category: "Category"
@ -45,6 +58,10 @@ en:
student: "Student"
retired: "Retired"
contributions:
attributes:
should_send_notification: Send payment receipt
due:
title: "Due contributions"
new:
expires_on_warning: |
Adding a contribution will automatically bump the membership expiration
@ -53,16 +70,23 @@ en:
year after that. You can override the expiration date by setting a date
below.
notification_mailer:
payment_cta: "Pay now"
expiration_in_60d:
subject: "ANSOL - Pagamento anual de quotas"
title: "Pagamento anual de quotas"
subject: "%{organization_short_name} - Yearly membership renewal"
expiration_in_30d:
subject: "ANSOL - Prazo para pagamento de quotas vence em 30 dias"
subject: "%{organization_short_name} - Your membership expires in 30 days"
expired:
subject: "ANSOL - Pagamento de quotas pendente"
subject: "%{organization_short_name} - Membership payment pending"
expired_30d_ago:
subject: "ANSOL - Pagamento de quotas em atraso"
subject: "%{organization_short_name} - Membership payment expired"
expired_60d_ago:
subject: "ANSOL - Suspensão de inscrição iminente"
subject: "%{organization_short_name} - Your membership is about to be suspended"
first_payment_confirmation:
subject: "%{organization_short_name} - Payment received: Welcome!"
payment_renewal_confirmation:
subject: "%{organization_short_name} - Payment received"
registration:
subject: "%{organization_short_name} - Registration approved: Payment required"
cancelled:
subject: "ANSOL - Inscrição cancelada"
subject: "%{organization_short_name} - Membership suspended"
greetings: "Dear %{display_name}"

View File

@ -4,6 +4,13 @@ pt:
negative: "Não"
navigation:
members: "Lista de membros"
board: "Direcção"
notifications: "Notificações"
contributions: "Contribuições"
due_contributions: "Dívidas"
footer:
description: saucy Plataforma de gestão de sócios.
free_software_html: É <a href="https://git.ansol.org/ansol/saucy">Software Livre</a>.
members:
delete:
confirmation_message: |
@ -17,6 +24,7 @@ pt:
go_back: "Cancelar"
index:
title: "Membros"
results_count: "A mostrar %{count} membros:"
actions:
new: "Registar novo membro"
clear_search: ""
@ -28,10 +36,14 @@ pt:
title: "Detalhes de membro"
actions:
edit: "Editar detalhes"
delete: "Apagar dados pessoais permanentemente"
edit_contribution: "Editar"
delete_contribution: "Apagar"
deliver_notification: "Enviar agora"
resend_registration: "Enviar lembrete para pagamento inicial"
contribution_history: "Histórico de contribuições"
notifications: "Notificações por correio electrónico"
contribution_actions: "Acções"
edit:
title: "Editar detalhes de membro"
actions:
@ -43,7 +55,9 @@ pt:
number: "#"
status: "Estado"
email: "Endereço de correio electrónico"
display_name: "Nome"
display_name: "Nome social"
legal_name: "Nome legal"
pronouns: "Pronomes"
joined_on: "Data de inscrição"
expires_on: "Data de expiração"
category: "Categoria"
@ -51,6 +65,8 @@ pt:
address: "Endereço postal"
wants_mailing_list: "Inscrição na lista de correio"
prefers_postal: "Prefere comunicação postal"
regular_ifthenpay_link: "Link ifthenpay normal"
reduced_ifthenpay_link: "Link ifthenpay reduzido"
status:
any: "Qualquer"
active: "Activo"
@ -64,20 +80,13 @@ pt:
unemployed: "Desempregado"
student: "Estudante"
retired: "Reformado"
notifications:
attributes:
to_be_sent_on: Data de envio
template: Modelo
status: Estado
status:
sent: Enviada
scheduled: Agendada
contributions:
attributes:
amount: Montante
payment_on: Data de pagamento
payment_method: Método de pagamento
payment_reference: Referência
should_send_notification: Enviar comprovativo de pagamento
edit:
member: "Membro"
title: "Editar dados de contribuição"
@ -92,20 +101,29 @@ pt:
data de inscrição é automaticamente definida como a data de pagamento,
e a data de expiração passa a ser um ano após essa data. Podes definir
uma data de expiração manualmente usando o próximo campo.
due:
title: "Contribuições em dívida"
notification_mailer:
payment_cta: "Pagar quotas"
expiration_in_60d:
subject: "ANSOL - Pagamento anual de quotas"
subject: "%{organization_short_name} - Pagamento anual de quotas"
expiration_in_30d:
subject: "ANSOL - Inscrição expira em 30 dias"
subject: "%{organization_short_name} - Inscrição expira em 30 dias"
expired:
subject: "ANSOL - Pagamento de quotas pendente"
subject: "%{organization_short_name} - Pagamento de quotas pendente"
expired_30d_ago:
subject: "ANSOL - Pagamento de quotas em atraso"
subject: "%{organization_short_name} - Pagamento de quotas em atraso"
expired_60d_ago:
subject: "ANSOL - Suspensão de inscrição iminente"
subject: "%{organization_short_name} - Suspensão de inscrição iminente"
first_payment_confirmation:
subject: "%{organization_short_name} - Pagamento recebido: Mensagem de boas vindas"
payment_renewal_confirmation:
subject: "%{organization_short_name} - Pagamento de quotas recebido"
registration:
subject: "%{organization_short_name} - Inscrição aprovada: Pagamento inicial de quotas"
cancelled:
subject: "ANSOL - Inscrição cancelada"
greetings: "Caro(a) %{display_name}"
subject: "%{organization_short_name} - Inscrição cancelada"
greetings: "Car(a/o/e) %{display_name}"
sessions:
new:
title: "Entrar"
@ -117,3 +135,16 @@ pt:
warning: |
Atenção: qualquer endereço que ficar omisso verá a sua conta suspensa e
deixará de poder aceder a este sistema.
notifications:
index:
title: "Notificações"
scheduled: "Agendadas"
sent: "Enviadas"
attributes:
to_be_sent_on: Data de envio
template: Modelo
status: Estado
member: Membro
status:
sent: Enviada
scheduled: Agendada

View File

@ -41,3 +41,4 @@ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
plugin :solid_queue

18
config/queue.yml Normal file
View File

@ -0,0 +1,18 @@
default: &default
dispatchers:
- polling_interval: 1
batch_size: 500
workers:
- queues: "*"
threads: 3
processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %>
polling_interval: 0.1
development:
<<: *default
test:
<<: *default
production:
<<: *default

13
config/recurring.yml Normal file
View File

@ -0,0 +1,13 @@
default: &default
sync:
class: SyncJob
schedule: every 5 minutes
#notify:
# class: NotifyJob
# schedule: every 2 hours
development:
<<: *default
production:
<<: *default

View File

@ -9,15 +9,35 @@ Rails.application.routes.draw do
resources :members do
member do
get :delete
post :resend_registration
end
resources :contributions, only: [:new, :create]
end
resources :contributions, only: [:edit, :update, :destroy] do
resources :contributions, only: [:index, :edit, :update, :destroy] do
collection do
get :due
end
member do
get :delete
end
end
resources :notifications, only: [:index] do
member do
post :deliver
end
end
resource :board, only: [:edit, :update]
resource :letters, only: [:create]
resources :payments, only: [:show] do
collection do
get :callback
end
end
resource :initial_setup, only: [:create, :show]
end

View File

@ -0,0 +1,8 @@
class AddMemberLegalNameAndPronouns < ActiveRecord::Migration[7.0]
def change
change_table :members do |t|
t.string :legal_name
t.string :pronouns
end
end
end

View File

@ -0,0 +1,11 @@
class CreatePayments < ActiveRecord::Migration[7.0]
def change
create_table :payments, id: :uuid do |t|
t.references :member, type: :uuid, foreign_key: true, null: false
t.string :status
t.timestamps
end
end
end

View File

@ -0,0 +1,22 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end
change_column :active_storage_blobs, :service_name, :string, null: false
end
end
def down
return unless table_exists?(:active_storage_blobs)
remove_column :active_storage_blobs, :service_name
end
end

View File

@ -0,0 +1,27 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
private
def primary_key_type
config = Rails.configuration.generators
config.options[config.orm][:primary_key_type] || :primary_key
end
def blobs_primary_key_type
pkey_name = connection.primary_key(:active_storage_blobs)
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
pkey_column.bigint? ? :bigint : pkey_column.type
end
end

View File

@ -0,0 +1,8 @@
# This migration comes from active_storage (originally 20211119233751)
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
change_column_null(:active_storage_blobs, :checksum, true)
end
end

View File

@ -0,0 +1,101 @@
# This migration comes from solid_queue (originally 20231211200639)
class CreateSolidQueueTables < ActiveRecord::Migration[7.0]
def change
create_table :solid_queue_jobs do |t|
t.string :queue_name, null: false
t.string :class_name, null: false, index: true
t.text :arguments
t.integer :priority, default: 0, null: false
t.string :active_job_id, index: true
t.datetime :scheduled_at
t.datetime :finished_at, index: true
t.string :concurrency_key
t.timestamps
t.index [ :queue_name, :finished_at ], name: "index_solid_queue_jobs_for_filtering"
t.index [ :scheduled_at, :finished_at ], name: "index_solid_queue_jobs_for_alerting"
end
create_table :solid_queue_scheduled_executions do |t|
t.references :job, index: { unique: true }, null: false
t.string :queue_name, null: false
t.integer :priority, default: 0, null: false
t.datetime :scheduled_at, null: false
t.datetime :created_at, null: false
t.index [ :scheduled_at, :priority, :job_id ], name: "index_solid_queue_dispatch_all"
end
create_table :solid_queue_ready_executions do |t|
t.references :job, index: { unique: true }, null: false
t.string :queue_name, null: false
t.integer :priority, default: 0, null: false
t.datetime :created_at, null: false
t.index [ :priority, :job_id ], name: "index_solid_queue_poll_all"
t.index [ :queue_name, :priority, :job_id ], name: "index_solid_queue_poll_by_queue"
end
create_table :solid_queue_claimed_executions do |t|
t.references :job, index: { unique: true }, null: false
t.bigint :process_id
t.datetime :created_at, null: false
t.index [ :process_id, :job_id ]
end
create_table :solid_queue_blocked_executions do |t|
t.references :job, index: { unique: true }, null: false
t.string :queue_name, null: false
t.integer :priority, default: 0, null: false
t.string :concurrency_key, null: false
t.datetime :expires_at, null: false
t.datetime :created_at, null: false
t.index [ :expires_at, :concurrency_key ], name: "index_solid_queue_blocked_executions_for_maintenance"
end
create_table :solid_queue_failed_executions do |t|
t.references :job, index: { unique: true }, null: false
t.text :error
t.datetime :created_at, null: false
end
create_table :solid_queue_pauses do |t|
t.string :queue_name, null: false, index: { unique: true }
t.datetime :created_at, null: false
end
create_table :solid_queue_processes do |t|
t.string :kind, null: false
t.datetime :last_heartbeat_at, null: false, index: true
t.bigint :supervisor_id, index: true
t.integer :pid, null: false
t.string :hostname
t.text :metadata
t.datetime :created_at, null: false
end
create_table :solid_queue_semaphores do |t|
t.string :key, null: false, index: { unique: true }
t.integer :value, default: 1, null: false
t.datetime :expires_at, null: false, index: true
t.timestamps
t.index [ :key, :value ], name: "index_solid_queue_semaphores_on_key_and_value"
end
add_foreign_key :solid_queue_blocked_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
add_foreign_key :solid_queue_claimed_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
add_foreign_key :solid_queue_failed_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
add_foreign_key :solid_queue_ready_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
add_foreign_key :solid_queue_scheduled_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
end
end

View File

@ -0,0 +1,6 @@
# This migration comes from solid_queue (originally 20240110143450)
class AddMissingIndexToBlockedExecutions < ActiveRecord::Migration[7.1]
def change
add_index :solid_queue_blocked_executions, [ :concurrency_key, :priority, :job_id ], name: "index_solid_queue_blocked_executions_for_release"
end
end

View File

@ -0,0 +1,15 @@
# This migration comes from solid_queue (originally 20240218110712)
class CreateRecurringExecutions < ActiveRecord::Migration[7.1]
def change
create_table :solid_queue_recurring_executions do |t|
t.references :job, index: { unique: true }, null: false
t.string :task_key, null: false
t.datetime :run_at, null: false
t.datetime :created_at, null: false
t.index [ :task_key, :run_at ], unique: true
end
add_foreign_key :solid_queue_recurring_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
end
end

View File

@ -0,0 +1,21 @@
# This migration comes from solid_queue (originally 20240719134516)
class CreateRecurringTasks < ActiveRecord::Migration[7.1]
def change
create_table :solid_queue_recurring_tasks do |t|
t.string :key, null: false, index: { unique: true }
t.string :schedule, null: false
t.string :command, limit: 2048
t.string :class_name
t.text :arguments
t.string :queue_name
t.integer :priority, default: 0
t.boolean :static, default: true, index: true
t.text :description
t.timestamps
end
end
end

View File

@ -0,0 +1,6 @@
# This migration comes from solid_queue (originally 20240811173327)
class AddNameToProcesses < ActiveRecord::Migration[7.1]
def change
add_column :solid_queue_processes, :name, :string
end
end

View File

@ -0,0 +1,17 @@
# This migration comes from solid_queue (originally 20240813160053)
class MakeNameNotNull < ActiveRecord::Migration[7.1]
def up
SolidQueue::Process.where(name: nil).find_each do |process|
process.name ||= [ process.kind.downcase, SecureRandom.hex(10) ].join("-")
process.save!
end
change_column :solid_queue_processes, :name, :string, null: false
add_index :solid_queue_processes, [ :name, :supervisor_id ], unique: true
end
def down
remove_index :solid_queue_processes, [ :name, :supervisor_id ]
change_column :solid_queue_processes, :name, :string, null: false
end
end

View File

@ -0,0 +1,6 @@
# This migration comes from solid_queue (originally 20240819165045)
class ChangeSolidQueueRecurringTasksStaticToNotNull < ActiveRecord::Migration[7.1]
def change
change_column_null :solid_queue_recurring_tasks, :static, false, true
end
end

140
db/schema.rb generated
View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_06_26_100610) do
ActiveRecord::Schema[7.2].define(version: 2024_11_07_142810) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
@ -43,6 +43,8 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_26_100610) do
t.boolean "excluded", default: false
t.boolean "wants_mailing_list", default: false, null: false
t.boolean "prefers_postal", default: false, null: false
t.string "legal_name"
t.string "pronouns"
t.index ["email"], name: "index_members_on_email", unique: true
t.index ["number"], name: "index_members_on_number", unique: true
end
@ -58,6 +60,135 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_26_100610) do
t.index ["member_id"], name: "index_notifications_on_member_id"
end
create_table "payments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "member_id", null: false
t.string "status"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["member_id"], name: "index_payments_on_member_id"
end
create_table "solid_queue_blocked_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.string "concurrency_key", null: false
t.datetime "expires_at", null: false
t.datetime "created_at", null: false
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
end
create_table "solid_queue_claimed_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.bigint "process_id"
t.datetime "created_at", null: false
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
end
create_table "solid_queue_failed_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.text "error"
t.datetime "created_at", null: false
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
end
create_table "solid_queue_jobs", force: :cascade do |t|
t.string "queue_name", null: false
t.string "class_name", null: false
t.text "arguments"
t.integer "priority", default: 0, null: false
t.string "active_job_id"
t.datetime "scheduled_at"
t.datetime "finished_at"
t.string "concurrency_key"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
end
create_table "solid_queue_pauses", force: :cascade do |t|
t.string "queue_name", null: false
t.datetime "created_at", null: false
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
end
create_table "solid_queue_processes", force: :cascade do |t|
t.string "kind", null: false
t.datetime "last_heartbeat_at", null: false
t.bigint "supervisor_id"
t.integer "pid", null: false
t.string "hostname"
t.text "metadata"
t.datetime "created_at", null: false
t.string "name", null: false
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
end
create_table "solid_queue_ready_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.datetime "created_at", null: false
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
end
create_table "solid_queue_recurring_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "task_key", null: false
t.datetime "run_at", null: false
t.datetime "created_at", null: false
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
end
create_table "solid_queue_recurring_tasks", force: :cascade do |t|
t.string "key", null: false
t.string "schedule", null: false
t.string "command", limit: 2048
t.string "class_name"
t.text "arguments"
t.string "queue_name"
t.integer "priority", default: 0
t.boolean "static", default: true, null: false
t.text "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
end
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.datetime "scheduled_at", null: false
t.datetime "created_at", null: false
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
end
create_table "solid_queue_semaphores", force: :cascade do |t|
t.string "key", null: false
t.integer "value", default: 1, null: false
t.datetime "expires_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
end
create_table "users", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
@ -83,4 +214,11 @@ ActiveRecord::Schema[7.0].define(version: 2022_06_26_100610) do
add_foreign_key "contributions", "members"
add_foreign_key "notifications", "members"
add_foreign_key "payments", "members"
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
end

5
entrypoint.sh Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
bin/rails db:migrate &&
bin/rails assets:precompile &&
bin/rails server

Some files were not shown because too many files have changed in this diff Show More