Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
Sync main -> api (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
reesericci authored Jan 18, 2024
1 parent fe62127 commit 02ff092
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ gem "standard", "~> 1.33"

gem "standard-rails", "~> 1.0"

gem "syntax_suggest", "~> 2.0"
gem "doorkeeper", "~> 5.6"
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ GEM
stimulus-rails (1.3.0)
railties (>= 6.0.0)
stringio (3.1.0)
syntax_suggest (2.0.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tailwindcss-rails (2.1.0-x86_64-darwin)
Expand Down Expand Up @@ -473,6 +474,7 @@ DEPENDENCIES
standard (~> 1.33)
standard-rails (~> 1.0)
stimulus-rails
syntax_suggest (~> 2.0)
tailwindcss-rails (~> 2.1)
tapioca
turbo-rails
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def register
end

def create
if !User::User.find_by(email: params[:email])
if User::User.find_by(email: params[:email]).verified == false
if User::User.find_by(email: params[:email])
if !User::User.find_by(email: params[:email]).verified
user = User::User.find_by(email: params[:email])
session[:current_user_id] = user.id
session[:new_user] = true
Expand Down
11 changes: 6 additions & 5 deletions app/models/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def self.filter_dnsimple_host(host, domains)
domain = Domain.find_by(host: host)
Rails.cache.fetch([domain, "records"], expires_in: 1.week) do
records = []
domains.each |r|
domains.each do |r|
if r.domain_id == domain.id
records.push(r)
end
Expand All @@ -66,7 +66,6 @@ def self.dnsimple_to_record(obj)
domain = cap[3]
domain_obj = Domain.find_by(host: domain)

puts domain_obj
Record.new(
_id: obj.id,
_persisted: true,
Expand All @@ -92,7 +91,7 @@ def save

broadcast_replace_to("records:main", partial: "records/record")
Rails.cache.delete("records")
domain.update(updated_at: Time.now)
domain.update!(updated_at: Time.now) # standard:disable all
end

def persisted?
Expand All @@ -109,7 +108,7 @@ def destroy!
end

def self.destroy_all_host!(host)
for r in where_host(host)
where_host(host).each do |r|
r.destroy!
end
end
Expand All @@ -130,9 +129,10 @@ def self.all
records.push(record)
end
end
end
end

records

end
end

Expand Down Expand Up @@ -259,4 +259,5 @@ def destroy_record
@_persisted = false
true
end

end

0 comments on commit 02ff092

Please sign in to comment.