Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI for admin to create org and config messengers #2020

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

mattwr18
Copy link
Contributor

@mattwr18 mattwr18 commented Sep 9, 2024

Closes #1948

TODOs

Telegram

  • Add set webhook job
  • restart the server

Signal

  • Option to use voice in register step
  • Add job to set username and update organization with signal_complete_onboarding_link
  • Translate page

Organizations

  • Add field to change project name
  • Redirect after success

Gemfile.lock Outdated Show resolved Hide resolved
@mattwr18 mattwr18 force-pushed the 1948_add_ui_for_admin_to_create_org_config_messengers branch from 5e9ec73 to 5c60304 Compare September 9, 2024 19:08
whats_app_profile_about: Field::Text,
email_from_address: Field::Email,
telegram_bot_username: Field::String,
telegram_bot_api_key: Field::Password,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
telegram_bot_api_key: Field::Password,
telegram_bot_api_key: Field::String,

telegram_bot_username: Field::String,
telegram_bot_api_key: Field::Password,
threemarb_api_identity: Field::String,
threemarb_api_secret: Field::Password,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
threemarb_api_secret: Field::Password,
threemarb_api_secret: Field::String,

telegram_bot_api_key: Field::Password,
threemarb_api_identity: Field::String,
threemarb_api_secret: Field::Password,
threemarb_private: Field::Password,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
threemarb_private: Field::Password,
threemarb_private: Field::String,

whats_app_server_phone_number: Field::String,
twilio_account_sid: Field::String,
twilio_api_key_sid: Field::String,
twilio_api_key_secret: Field::Password
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
twilio_api_key_secret: Field::Password
twilio_api_key_secret: Field::String

@mattwr18 mattwr18 force-pushed the 1948_add_ui_for_admin_to_create_org_config_messengers branch 2 times, most recently from f60b7c8 to 0d787f8 Compare October 16, 2024 11:13
@mattwr18 mattwr18 force-pushed the 1948_add_ui_for_admin_to_create_org_config_messengers branch from d6d658a to bd8f027 Compare October 24, 2024 10:43
@mattwr18 mattwr18 force-pushed the 1948_add_ui_for_admin_to_create_org_config_messengers branch from 844b28c to 5e72aee Compare December 3, 2024 09:42
- there are only a few people who have access to adding this number and
  it causes flaky tests.
contact_person: Kontaktperson
email_from_address: E-Mail Adresse
telegram_bot_username: Telegram-Bot-Benutzername
threemarb_api_identity: Threema Id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
threemarb_api_identity: Threema Id
threemarb_api_identity: Threema Id
threemarb_api_secret: Threema API secret
threemarb_private: Threema private key

Copy link
Collaborator

@roschaefer roschaefer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

Comment on lines +8 to +9
response = SignalAdapter::RegisterPhoneNumberService.new(organization_id: @organization.id, register_data: register_data).call
case response
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
response = SignalAdapter::RegisterPhoneNumberService.new(organization_id: @organization.id, register_data: register_data).call
case response
case SignalAdapter::RegisterPhoneNumberService.call(organization_id: @organization.id, register_data: register_data)


def verify
token = params[:organization][:signal][:token]
response = SignalAdapter::VerifyPhoneNumberService.new(organization_id: @organization.id, token: token).call
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same ☝️

end
case response
when Net::HTTPSuccess
Rails.logger.debug 'Great!'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Rails.logger.debug 'Great!'
Rails.logger.debug 'Successfully set profile info job!'
# maybe more debug output like parts of the `response`?

Accept: 'application/json',
'Content-Type': 'application/json'
})
request.body = { username: organization.project_name.gsub(/[^\w\s]/, '').gsub(/\s+/, '').camelize }.to_json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Require a project name for every organization. The string must be validated according to signal's validations.

@@ -0,0 +1,4 @@
<p>Klicke hier, um dich zu registrieren, falls du noch nicht registriert bist.</p>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<p>Klicke hier, um dich zu registrieren, falls du noch nicht registriert bist.</p>
<p>Klicke hier, um dich zu registrieren, falls du noch nicht registriert bist.</p>

Localize this!

Comment on lines +130 to +132
create_table "data_migrations", primary_key: "version", id: :string, force: :cascade do |t|
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
create_table "data_migrations", primary_key: "version", id: :string, force: :cascade do |t|
end

let(:request) { create(:request, organization: create(:organization, signal_server_phone_number: 'SIGNAL_SERVER_PHONE_NUMBER')) }
let(:organization) do
build(:organization, signal_server_phone_number: 'SIGNAL_SERVER_PHONE_NUMBER').tap do |org|
org.save(validate: false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a dirty hack

required_params.deep_merge({ organization: signal_params })
end

it 'allows configuration of Twilio specific attrs' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it 'allows configuration of Twilio specific attrs' do
it 'allows configuration of Twilio specific attributes' do

end
end

context 'given the register is unsucessful' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context 'given the register is unsucessful' do
context 'given the registration is unsuccessful' do

expect { subject.call }.to have_enqueued_job(SignalAdapter::SetTrustModeJob).with(signal_server_phone_number: '+4912345678')
end

context 'given the verify is unsucessful' do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context 'given the verify is unsucessful' do
context 'given the verify is unsuccessful' do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add UI for admin creating organization/configuring messengers
3 participants