Skip to content

Commit 60bad60

Browse files
authored
Merge branch 'master' into feat/borrel-weekoverzicht-location
2 parents 95aec8c + e0b14c9 commit 60bad60

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

app/controllers/api/activities_controller.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,19 @@ def index
1212
params[:date],
1313
params[:date]
1414
).order(:start_date).limit(params[:limit] ||= 10).offset(params[:offset] ||= 0)
15-
1615
else
17-
@activities = Activity.where('(end_date IS NULL AND start_date >= ?) OR end_date >= ?',
18-
Date.today, Date.today).order(:start_date).where(is_viewable: true)
19-
@activities.limit!(params[:limit]).offset(params[:offset] ||= 0) if params[:limit].present?
20-
@activities = @activities.reject(&:ended?)
16+
from = params[:from].present? ? Date.parse(params[:from]) : Date.today
17+
@activities = Activity.where('start_date >= ?', from)
18+
.order(:start_date)
19+
.where(is_viewable: true)
20+
21+
# Allow nil to mean no limit on the end date
22+
@activities = @activities.where('end_date <= ?', Date.parse(params[:to])) if params[:to].present?
23+
24+
@activities = @activities.limit!(params[:limit]).offset(params[:offset] ||= 0) if params[:limit].present?
25+
26+
@activities = @activities.reject(&:ended?) if params[:from].blank?
27+
@activities
2128
end
2229
end
2330

app/mailers/mailings/devise.rb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ class Devise < ApplicationMailer
66

77
def confirmation_instructions(record, token, _opts = {})
88
url = confirmation_url(record, confirmation_token: token)
9-
# FIXME: confirmation_url might occassionaly return an url to the activation page. We don't know why
10-
url = url.sub("/activate", "/confirmation")
119

1210
if Rails.env.development?
1311
Rails.logger.debug { "Sending confirmation instructions to #{ record.credentials.name } <#{ record.unconfirmed_email }> with activation URL #{ url }" }
@@ -99,17 +97,6 @@ def activation_instructions(record, token, _opts = {})
9997
mail(record.email, nil, "#{ I18n.t('mailings.devise.activation_instructions.welcome') } | #{ I18n.t('mailings.devise.confirmation_instructions.activate_account') }", html, text)
10098
end
10199

102-
private
103-
104-
def whatsapp_promo_link
105-
if I18n.locale == :en
106-
"https://svsticky.nl/promochannel"
107-
else
108-
# Fallback is NL
109-
"https://svsticky.nl/promokanaal"
110-
end
111-
end
112-
113100
def reset_password_instructions(record, token, _opts = {})
114101
Rails.logger.debug(edit_password_url(record, reset_password_token: token)) if Rails.env.development?
115102

@@ -133,6 +120,17 @@ def reset_password_instructions(record, token, _opts = {})
133120
return mail(record.email, nil, "#{ I18n.t('mailings.devise.reset_passwords_instructions.reset_password') } Sticky", html, text)
134121
end
135122

123+
private
124+
125+
def whatsapp_promo_link
126+
if I18n.locale == :en
127+
"https://svsticky.nl/promochannel"
128+
else
129+
# Fallback is NL
130+
"https://svsticky.nl/promokanaal"
131+
end
132+
end
133+
136134
def forced_confirm_email(record, current_user, _opts = {})
137135
if Rails.env.development?
138136
Rails.logger.debug { "#{ record.user.unconfirmed_email } #{ I18n.t('mailings.removed') }" }

0 commit comments

Comments
 (0)