Skip to content

Commit ac35768

Browse files
committed
Fixing CI issues
1 parent db58ec8 commit ac35768

17 files changed

Lines changed: 46 additions & 36 deletions

‎.github/workflows/dev-setup.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ jobs:
2020
uses: docker/setup-buildx-action@v3
2121

2222
- name: Prepare dev env file
23-
run: cp .env.development.example .env.development
23+
run: |
24+
cp .env.development.example .env.development
25+
# Dev env requires Active Record encryption keys for OAuth token storage.
26+
for key in RAILS_AR_ENCRYPTION_PRIMARY_KEY RAILS_AR_ENCRYPTION_DETERMINISTIC_KEY RAILS_AR_ENCRYPTION_SALT; do
27+
value=$(ruby -rsecurerandom -e 'puts SecureRandom.alphanumeric(32)')
28+
sed -i "s|^${key}=.*|${key}=${value}|" .env.development
29+
done
2430
2531
- name: Start dev stack
2632
run: make dev-detach

‎Containerfile.dev‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ RUN apt-get update -qq && \
1212
WORKDIR /app
1313

1414
COPY Gemfile Gemfile.lock ./
15-
RUN bundle install --jobs=4 --retry=3
15+
RUN BUNDLER_VERSION="$(awk '/^BUNDLED WITH/{getline; gsub(/^ +/, ""); print}' Gemfile.lock)" && \
16+
gem install bundler -v "$BUNDLER_VERSION" && \
17+
bundle install --jobs=4 --retry=3
1618

1719
COPY . .
1820

‎Dockerfile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ RUN apt-get update -qq && \
1515
WORKDIR /app
1616

1717
COPY Gemfile Gemfile.lock ./
18-
RUN bundle install --jobs=4 --retry=3
18+
RUN BUNDLER_VERSION="$(awk '/^BUNDLED WITH/{getline; gsub(/^ +/, ""); print}' Gemfile.lock)" && \
19+
gem install bundler -v "$BUNDLER_VERSION" && \
20+
bundle install --jobs=4 --retry=3
1921

2022
COPY . .
2123

‎app/controllers/drafts_controller.rb‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ def index
1010
@state = (params[:state].presence_in(%w[all in_progress sent failed]) || "all")
1111
scope = current_user.outgoing_drafts
1212
@drafts = case @state
13-
when "in_progress" then scope.where(status: %w[idle sending]).where(last_send_error: nil)
14-
when "sent" then scope.sent
15-
when "failed" then scope.idle.where.not(last_send_error: nil)
16-
else scope
17-
end
13+
when "in_progress" then scope.where(status: %w[idle sending]).where(last_send_error: nil)
14+
when "sent" then scope.sent
15+
when "failed" then scope.idle.where.not(last_send_error: nil)
16+
else scope
17+
end
1818
@drafts = @drafts
1919
.includes(:topic, :reply_to_message, :sender_alias, :sent_message)
2020
.order(Arel.sql("COALESCE(sent_at, updated_at) DESC"))

‎app/models/outgoing_draft.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class OutgoingDraft < ApplicationRecord
33
STATUS_SENDING = "sending"
44
STATUS_SENT = "sent"
55

6-
STATUSES = [STATUS_IDLE, STATUS_SENDING, STATUS_SENT].freeze
6+
STATUSES = [ STATUS_IDLE, STATUS_SENDING, STATUS_SENT ].freeze
77

88
belongs_to :user
99
belongs_to :topic
@@ -18,7 +18,7 @@ class OutgoingDraft < ApplicationRecord
1818
validates :user_id,
1919
uniqueness: {
2020
scope: :reply_to_message_id,
21-
conditions: -> { where(status: [STATUS_IDLE, STATUS_SENDING]) }
21+
conditions: -> { where(status: [ STATUS_IDLE, STATUS_SENDING ]) }
2222
},
2323
if: :active?
2424

‎app/services/outgoing/message_builder.rb‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def self.build(draft)
2121
message_id msg_id
2222
body draft.body
2323
end
24-
mail.content_type 'text/plain; charset=UTF-8'
25-
mail.in_reply_to = draft.reply_to_message.message_id.to_s.gsub(/[<>]/, '')
24+
mail.content_type "text/plain; charset=UTF-8"
25+
mail.in_reply_to = draft.reply_to_message.message_id.to_s.gsub(/[<>]/, "")
2626
mail.references = build_references(draft.reply_to_message)
2727

2828
Result.new(encoded: mail.encoded, message_id: msg_id,
@@ -35,7 +35,7 @@ def self.build_references(parent)
3535
cur = parent
3636
while cur && seen.add?(cur.id)
3737
if cur.message_id.present?
38-
chain.unshift(cur.message_id.to_s.gsub(/[<>]/, ''))
38+
chain.unshift(cur.message_id.to_s.gsub(/[<>]/, ""))
3939
end
4040
cur = cur.reply_to
4141
end

‎db/migrate/20260510103205_create_outgoing_drafts.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def change
1313
t.datetime :sending_started_at
1414
t.timestamps
1515
end
16-
add_index :outgoing_drafts, [:user_id, :reply_to_message_id], unique: true,
16+
add_index :outgoing_drafts, [ :user_id, :reply_to_message_id ], unique: true,
1717
name: "idx_drafts_user_parent_unique"
1818
end
1919
end

‎db/migrate/20260512120000_create_user_features.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ def change
55
t.string :feature, null: false
66
t.datetime :created_at, null: false
77
end
8-
add_index :user_features, [:user_id, :feature], unique: true
8+
add_index :user_features, [ :user_id, :feature ], unique: true
99
end
1010
end

‎db/migrate/20260512120001_add_sent_state_to_outgoing_drafts.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ def up
55
add_column :outgoing_drafts, :sent_at, :datetime, null: true
66

77
remove_index :outgoing_drafts, name: :idx_drafts_user_parent_unique
8-
add_index :outgoing_drafts, [:user_id, :reply_to_message_id],
8+
add_index :outgoing_drafts, [ :user_id, :reply_to_message_id ],
99
unique: true,
1010
where: "status IN ('idle','sending')",
1111
name: :idx_drafts_user_parent_active_unique
1212
end
1313

1414
def down
1515
remove_index :outgoing_drafts, name: :idx_drafts_user_parent_active_unique
16-
add_index :outgoing_drafts, [:user_id, :reply_to_message_id],
16+
add_index :outgoing_drafts, [ :user_id, :reply_to_message_id ],
1717
unique: true, name: :idx_drafts_user_parent_unique
1818

1919
remove_column :outgoing_drafts, :sent_at

‎spec/initializers/omniauth_setup_spec.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
OMNIAUTH_SETUP_PROC.call(env_with_query)
1616
expect(options[:scope]).to include('gmail.send')
1717
expect(options[:access_type]).to eq('offline')
18-
expect(options[:prompt]).to eq('consent')
18+
expect(options[:prompt]).to eq('consent')
1919
end
2020
end
2121

@@ -25,7 +25,7 @@
2525
OMNIAUTH_SETUP_PROC.call(env_with_query)
2626
expect(options[:scope]).to eq('email,profile')
2727
expect(options[:access_type]).to eq('online')
28-
expect(options[:prompt]).to eq('select_account')
28+
expect(options[:prompt]).to eq('select_account')
2929
end
3030
end
3131
end

0 commit comments

Comments
 (0)