diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 05ef5629c..000000000 Binary files a/.DS_Store and /dev/null differ diff --git a/app/.DS_Store b/app/.DS_Store deleted file mode 100644 index 830c593b8..000000000 Binary files a/app/.DS_Store and /dev/null differ diff --git a/app/controllers/.DS_Store b/app/controllers/.DS_Store deleted file mode 100644 index a3eee7bc4..000000000 Binary files a/app/controllers/.DS_Store and /dev/null differ diff --git a/app/controllers/repp/.DS_Store b/app/controllers/repp/.DS_Store deleted file mode 100644 index fcb003e65..000000000 Binary files a/app/controllers/repp/.DS_Store and /dev/null differ diff --git a/app/controllers/repp/v1/.DS_Store b/app/controllers/repp/v1/.DS_Store deleted file mode 100644 index b22dad763..000000000 Binary files a/app/controllers/repp/v1/.DS_Store and /dev/null differ diff --git a/app/controllers/repp/v1/registrar/auth_controller.rb b/app/controllers/repp/v1/registrar/auth_controller.rb deleted file mode 100644 index 74737e5ca..000000000 --- a/app/controllers/repp/v1/registrar/auth_controller.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Repp - module V1 - module Registrar - class AuthController < BaseController - api :GET, 'repp/v1/registrar/auth' - desc 'check user auth info, track user last login datetime and return data' - - def index - registrar = current_user.registrar - - data = set_values_to_data(registrar: registrar) - - render_success(data: data) - end - - private - - def set_values_to_data(registrar:) - data = current_user.as_json(only: %i[id username roles]) - data[:registrar_name] = registrar.name - data - end - end - end - end -end \ No newline at end of file diff --git a/app/controllers/repp/v1/registrar/summary_controller.rb b/app/controllers/repp/v1/registrar/summary_controller.rb deleted file mode 100644 index dfb54931c..000000000 --- a/app/controllers/repp/v1/registrar/summary_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -module Repp - module V1 - module Registrar - class SummaryController < BaseController - api :GET, 'repp/v1/registrar/summary' - desc 'check user summary info and return data' - - def index - registrar = current_user.registrar - - data = evaluate_data(registrar: registrar) - - render_success(data: data) - end - - private - - def evaluate_data(registrar:) - data = current_user.as_json(only: %i[id username]) - data[:registrar_name] = registrar.name - data[:last_login_date] = last_login_date - data[:balance] = { amount: registrar.cash_account&.balance, - currency: registrar.cash_account&.currency } - data[:domains] = registrar.domains.count - data[:contacts] = registrar.contacts.count - data[:phone] = registrar.phone - data[:email] = registrar.email - data[:billing_email] = registrar.billing_email - data[:billing_address] = registrar.address - data - end - - def last_login_date - q = ApiLog::ReppLog.ransack({ request_path_eq: '/repp/v1/registrar/auth', - response_code_eq: '200', - api_user_name_cont: current_user.username, - request_method_eq: 'GET' }) - q.sorts = 'id desc' - q.result.offset(1).first&.created_at - end - end - end - end -end \ No newline at end of file diff --git a/app/models/action.rb b/app/models/action.rb index 12435f3f0..444e31bbf 100644 --- a/app/models/action.rb +++ b/app/models/action.rb @@ -3,7 +3,10 @@ class Action < ApplicationRecord belongs_to :user belongs_to :contact, optional: true - has_many :subactions, class_name: 'Action', foreign_key: 'bulk_action_id', dependent: :destroy + has_many :subactions, class_name: 'Action', + foreign_key: 'bulk_action_id', + inverse_of: :action, + dependent: :destroy belongs_to :bulk_action, class_name: 'Action', optional: true validates :operation, inclusion: { in: proc { |action| action.class.valid_operations } } @@ -36,3 +39,4 @@ class Action < ApplicationRecord end end end + diff --git a/app/models/bulk_action.rb b/app/models/bulk_action.rb index 1a8cad771..9c98ee2db 100644 --- a/app/models/bulk_action.rb +++ b/app/models/bulk_action.rb @@ -1,2 +1 @@ -class BulkAction < Action -end \ No newline at end of file +class BulkAction < Action; end diff --git a/app/models/registrant_user.rb b/app/models/registrant_user.rb index a1f6993af..a095b9b22 100644 --- a/app/models/registrant_user.rb +++ b/app/models/registrant_user.rb @@ -110,11 +110,12 @@ class RegistrantUser < User def last_name username.split.second end - + # rubocop:disable Metrics/MethodLength def update_related_contacts grouped_contacts = Contact.where(ident: ident, ident_country_code: country.alpha2) - .where('UPPER(name) != UPPER(?)', username) - .includes(:registrar).group_by { |c| c.registrar } + .where('UPPER(name) != UPPER(?)', username) + .includes(:registrar) + .group_by(&:registrar) grouped_contacts.each do |registrar, contacts| bulk_action, action = actions.create!(operation: :bulk_update) if contacts.size > 1 contacts.each do |c| @@ -125,7 +126,7 @@ class RegistrantUser < User registrar.notify(bulk_action || action) end end - + # rubocop:enable Metrics/MethodLength class << self def find_or_create_by_api_data(user_data = {}) return false unless user_data[:ident] diff --git a/app/views/epp/poll/_action.xml.builder b/app/views/epp/poll/_action.xml.builder index 838ae9aaf..37f2acccb 100644 --- a/app/views/epp/poll/_action.xml.builder +++ b/app/views/epp/poll/_action.xml.builder @@ -5,8 +5,6 @@ builder.extension do builder.tag!('changePoll:date', action.created_at.utc.xmlschema) builder.tag!('changePoll:svTRID', action.id) builder.tag!('changePoll:who', action.user) - if action.bulk_action? - builder.tag!('changePoll:reason', 'Auto-update according to official data') - end + builder.tag!('changePoll:reason', 'Auto-update according to official data') if action.bulk_action? end end diff --git a/üpõ.preinstalled_gems b/üpõ.preinstalled_gems deleted file mode 100644 index 0b8633422..000000000 --- a/üpõ.preinstalled_gems +++ /dev/null @@ -1,25 +0,0 @@ -FROM ghcr.io/internetee/registry:gems-latest -LABEL org.opencontainers.image.source=https://github.com/internetee/registry -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" - -RUN bash -c 'mkdir -pv -m776 {/opt/webapps/app/tmp/pids,/opt/ca,/opt/ca/newcerts}' -RUN echo -n 12 > /opt/ca/serial -RUN chmod 776 /opt/ca/serial -RUN echo '3A0e' > /opt/ca/crlnumber -RUN chmod 776 /opt/ca/crlnumber -RUN touch /opt/ca/index.txt -RUN chmod 776 /opt/ca/index.txt -WORKDIR /opt/webapps/app - -COPY . . - -RUN bundle exec rails assets:precompile - -EXPOSE 3000