From 272f05204893b86706cff2673039968dad5e6ee8 Mon Sep 17 00:00:00 2001 From: Christoph Werner Date: Wed, 18 Dec 2024 23:05:29 +0100 Subject: [PATCH] Fix HTML formatting in emails --- .devcontainer/Dockerfile | 10 ---------- .devcontainer/devcontainer.json | 5 +++++ .devcontainer/docker-compose.yml | 7 +++++-- .env.development.template | 13 ++----------- Dockerfile | 2 -- .../mailer/confirmation_instructions.html.erb | 2 +- .../mailer/reset_password_instructions.html.erb | 2 +- .../subscription_mailer/trial_expiring.html.erb | 4 ++-- app/views/user_mailer/invite.html.erb | 2 +- app/views/user_mailer/welcome.html.erb | 2 +- docker-compose.yml | 1 - package.json | 5 +---- 12 files changed, 19 insertions(+), 36 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 6dace437..f8b5006f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,10 +1,6 @@ FROM ruby:2.7.5-bullseye SHELL ["/bin/bash", "-c"] -EXPOSE 3000 -EXPOSE 3011 -EXPOSE 1080 - ENV RAILS_ENV="development" ENV RAILS_ROOT /workspace @@ -66,9 +62,3 @@ RUN npm install -g yarn # Keep bash history between runs. RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/command-history/.bash_history" \ && echo $SNIPPET >> "/root/.bashrc" - -# Install mailcatcher. -# RUN gem install mailcatcher - -RUN echo 'alias ys="yarn start"' >> ~/.bashrc -RUN echo 'alias ysw="yarn start:watcher"' >> ~/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7aa72fb4..cc69cc83 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -10,6 +10,11 @@ "../docker-compose.yml", "docker-compose.yml" ], + "forwardPorts": [3000, 3030], + "portsAttributes": { + "3000": { "label": "App" }, + "3030": { "label": "MailHog" } + }, // The 'service' property is the name of the service for the container that VS Code should // use. Update this value and .devcontainer/docker-compose.yml to the real service name. diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 68cd1ab5..8a8dd7a1 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -57,8 +57,6 @@ services: ports: - "3000:3000" - - "3011:3011" - - "1080:1080" # Overrides default command so things don't shut down after the process ends. command: /bin/sh -c "while sleep 1000; do :; done" @@ -80,5 +78,10 @@ services: redis: image: redis:6.2.0-alpine + mail: + image: mailhog/mailhog:v1.0.1 + ports: + - "3030:8025" + volumes: txty-app-bash-history: diff --git a/.env.development.template b/.env.development.template index 28f4cfd9..9ddd873a 100644 --- a/.env.development.template +++ b/.env.development.template @@ -1,9 +1,8 @@ APP_HOST= ASSET_HOST= DEBUG_SECRET= - SMTP_AUTHENTICATION= -SMTP_ADDRESS=127.0.0.1 +SMTP_ADDRESS=mail SMTP_PORT=1025 SMTP_DOMAIN=127.0.0.1 SMTP_USERNAME= @@ -12,23 +11,15 @@ SMTP_FROM_EMAIL= SMTP_ENABLE_STARTTLS_AUTO= SMTP_OPENSSL_VERIFY_MODE= SMTP_TLS= - MAIL_RAISE_DELIVERY_ERRORS_DEV= -MAIL_PERFORM_DELIVERIES_DEV= - -# DB_TEST_HOST= -# DB_TEST_USERNAME= - +MAIL_PERFORM_DELIVERIES_DEV=true GOOGLE_CLOUD_PROJECT= GOOGLE_CLOUD_KEYFILE= GOOGLE_CLOUD_OTA_BUCKET_NAME= - SENTRY_SOURCE_MAPS_AUTH_TOKEN= SENTRY_SOURCE_MAPS_ORGANIZATION= SENTRY_SOURCE_MAPS_PROJECT= SENTRY_DSN_BACKEND= - DEEPL_API_TOKEN= - http_proxy= http_proxy_deepl= diff --git a/Dockerfile b/Dockerfile index b7b12fd0..785cedff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -85,8 +85,6 @@ FROM builder AS testing RUN bundle config --delete without RUN bundle install -# RUN gem install mailcatcher -v 0.8.2 RUN yarn install --production=false -# RUN apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb CMD ["bin/rails", "server"] diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index 20a20c6f..2a08d083 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,7 +1,7 @@ <% content_for :title do %>Confirmation instructions<% end %> <% content_for :preheader do %>Instructions to confirm your account<% end %> -

<%= t(:welcome).capitalize + ' ' + @resource.username %>

+

<%=h t(:welcome).capitalize + ' ' + @resource.username %>

<%= t '.confirm_link_msg' %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index 324ab503..44522331 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -2,7 +2,7 @@ <% content_for :preheader do %>Instructions to reset your password<% end %>

Reset your password

-

<%= t(:hello).capitalize %> <%= @resource.username %>,

+

<%=h t(:hello).capitalize %> <%=h @resource.username %>,

<%= t '.request_reset_link_msg' %>

diff --git a/app/views/subscription_mailer/trial_expiring.html.erb b/app/views/subscription_mailer/trial_expiring.html.erb index 727ac49b..29a79e76 100644 --- a/app/views/subscription_mailer/trial_expiring.html.erb +++ b/app/views/subscription_mailer/trial_expiring.html.erb @@ -3,9 +3,9 @@

Your trial is expiring

-

Hello <%= @username %>,

+

Hello <%=h @username %>,

-

the trial of your organization <%= @organization.name %> is expiring in <%= @organization.trial_days_left %> days.

+

the trial of your organization <%=h @organization.name %> is expiring in <%=h @organization.trial_days_left %> days.

You can manage your subscription by clicking here.

diff --git a/app/views/user_mailer/invite.html.erb b/app/views/user_mailer/invite.html.erb index dc09f257..3f65e181 100644 --- a/app/views/user_mailer/invite.html.erb +++ b/app/views/user_mailer/invite.html.erb @@ -5,7 +5,7 @@

Hello,

-

the user <%= @invite_from %> invited you to join Texterify and work together on their translations.

+

the user <%=h @invite_from %> invited you to join Texterify and work together on their translations.

<% if @on_premise %>

This is an invite to an on-premise instance of Texterify which can be found on <%= root_url %> and is not affiliated with the cloud version of Texterify over at texterify.com.

diff --git a/app/views/user_mailer/welcome.html.erb b/app/views/user_mailer/welcome.html.erb index 96b651e3..cfdcb400 100644 --- a/app/views/user_mailer/welcome.html.erb +++ b/app/views/user_mailer/welcome.html.erb @@ -3,7 +3,7 @@

Welcome to Texterify

-

Hello <%= @username %>,

+

Hello <%=h @username %>,

thank you for signing up.

diff --git a/docker-compose.yml b/docker-compose.yml index e7760895..0686499a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,6 +40,5 @@ services: - db - redis command: bundle exec sidekiq - redis: image: redis:6.2.0-alpine diff --git a/package.json b/package.json index a87f3ae8..f9221438 100644 --- a/package.json +++ b/package.json @@ -95,11 +95,8 @@ "format": "yarn format:frontend && yarn format:backend", "format:frontend": "prettier --write 'app/**/*.{js,ts,tsx}'", "format:backend": "prettier --write 'app/**/*.rb'", - "start": "yarn start:mailcatcher 2> /dev/null; rm /workspace/tmp/pids/server.pid 2> /dev/null; bundle exec sidekiq & bundle exec rails server -p 3000 -b \"0.0.0.0\"", - "start:no-container-webpacker": "WEBPACKER_DEV_SERVER_PORT=3012 WEBPACKER_DEV_SERVER_PUBLIC=host.docker.internal:3012 WEBPACKER_DEV_SERVER_HOST=host.docker.internal yarn start", + "start": "bundle exec sidekiq & bundle exec rails server -p 3000 -b \"0.0.0.0\"", "start:watcher": "./bin/webpack-dev-server", - "start:watcher:no-container-webpacker": "WEBPACKER_DEV_SERVER_PORT=3012 WEBPACKER_DEV_SERVER_PUBLIC=0.0.0.0:3012 ./bin/webpack-dev-server", - "start:mailcatcher": "mailcatcher --http-ip 0.0.0.0", "test": "yarn test:backend", "test:backend": "RAILS_ENV=test bundle exec rspec", "test:backend:update": "UPDATE_SNAPSHOTS=true RAILS_ENV=test bundle exec rspec",