-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into webpack-v5
- Loading branch information
Showing
16 changed files
with
117 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
FROM internetee/ruby:2.7 | ||
FROM internetee/ruby_base:3.0 | ||
LABEL org.opencontainers.image.source=https://github.com/internetee/auction_center | ||
ARG YARN_VER='1.22.10' | ||
ARG RAILS_ENV | ||
ARG SECRET_KEY_BASE | ||
|
||
ENV RAILS_ENV "$RAILS_ENV" | ||
ENV SECRET_KEY_BASE "$SECRET_KEY_BASE" | ||
|
||
RUN npm install -g yarn@"$YARN_VER" | ||
|
||
COPY Gemfile Gemfile.lock ./ | ||
RUN gem install bundler && bundle config set without 'development test' && bundle install --jobs 20 --retry 5 | ||
RUN yarn install --check-files | ||
|
||
COPY . . | ||
|
||
RUN bundle exec rails assets:precompile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class UnsubscribeController < ApplicationController | ||
def unsubscribe | ||
user = Rails.application.message_verifier(:unsubscribe).verify(params[:id]) | ||
@user = User.find(user) | ||
end | ||
|
||
def update | ||
@user = User.find(params[:id]) | ||
if @user.update(user_params) | ||
flash[:notice] = 'Subscription Cancelled' | ||
redirect_to root_url | ||
else | ||
flash[:alert] = 'Something wrong' | ||
render :unsubscribe | ||
end | ||
end | ||
|
||
private | ||
|
||
def user_params | ||
params.require(:user).permit(:daily_summary) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% content_for :hero do %> | ||
<div class="hero orange"> | ||
<h1><%= t('header_text') %></h1> | ||
</div> | ||
<% end %> | ||
|
||
<div class="u-container"> | ||
<div class="margin-block"> | ||
<%= form_for(@user, url: unsubscribe_update_path(id: @user.id)) do |f| %> | ||
<h3><%= t('unsubscribe_text') %></h3> | ||
<%= f.hidden_field(:daily_summary, value: false) %> | ||
<%= f.submit t('unsubscribe_btn'), class: "ui button big primary red" %> | ||
<%= link_to t('cancel_btn'), root_url, class: "ui button big secondary" %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
en: | ||
header_text: "Unsubscribe" | ||
unsubscribe_text: "Please confirm that you no longer wish to receive daily summary" | ||
unsubscribe_btn: "Unsubscribe" | ||
cancel_btn: "Cancel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
et: | ||
header_text: "Tellimusest loobumine" | ||
unsubscribe_text: "Palun kinnita et Sa ei soovi enam saada oksjonil olevate domeenide nimekirja" | ||
unsubscribe_btn: "Loobun nimekirjast" | ||
cancel_btn: "Mõtlesin ümber" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require 'application_system_test_case' | ||
|
||
class UnsubscribeTest < ApplicationSystemTestCase | ||
def setup | ||
@participant = users(:participant) | ||
@unsubscribe = Rails.application.message_verifier(:unsubscribe).generate(@participant.id) | ||
end | ||
|
||
def test_unsubscribe_user | ||
@participant.daily_summary = true | ||
@participant.save | ||
|
||
assert_equal(@participant.daily_summary, true) | ||
|
||
visit(unsubscribe_unsubscribe_url(id: @unsubscribe)) | ||
assert_text 'Please confirm that you no longer wish to receive daily summary' | ||
|
||
click_link_or_button('Unsubscribe') | ||
assert_text 'Subscription Cancelled' | ||
|
||
@participant.reload | ||
assert_equal(@participant.daily_summary, false) | ||
end | ||
end |