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

Issue with business users #911

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8adcee3
fix: Allow unsafe redirect to external host in notifications controller
distich Nov 16, 2024
b1a0864
feat: Enable SSL in Puma configuration for local development
distich Nov 16, 2024
15f359f
fix: Update comment to clarify SSL configuration in puma.rb
distich Nov 16, 2024
9b855dd
feat: Configure Puma to use SSL with verify_mode set to none
distich Nov 16, 2024
a798982
fix: Update Puma SSL binding to 0.0.0.0 on port 3001
distich Nov 16, 2024
98440e8
feat: Update Procfile.dev to use SSL port 3001 for Rails server
distich Nov 16, 2024
292d077
chore: Update Procfile.dev to enable SSL for the Rails server
distich Nov 16, 2024
0ef10d5
fix: Remove allow_other_host option from redirect_to in notifications…
distich Nov 16, 2024
b1620a3
fix: Update default_url_options to use correct host and port for URLs
distich Nov 16, 2024
86e4494
fix: Update default_url_options to use request settings for URLs
distich Nov 16, 2024
4839e03
fix: Correct URL construction in NotificationsController redirect
distich Nov 16, 2024
e7a1501
fix: Correct URL construction in NotificationsController redirect logic
distich Nov 16, 2024
a0927d1
fix: Use correct base URL for redirect in NotificationsController
distich Nov 16, 2024
63c3d9e
fix: Correct URL construction for redirection in NotificationsController
distich Nov 16, 2024
96bfa65
fix: Update URL redirection logic in NotificationsController to use b…
distich Nov 16, 2024
1aa094e
fix: Correct URL construction in NotificationsController redirection …
distich Nov 16, 2024
a7956b0
fix: Ensure redirection only occurs for valid notification URLs
distich Nov 16, 2024
2b902a0
fix: Redirect to specific notification message instead of notificatio…
distich Nov 16, 2024
4b91947
fix: Redirect to the correct conversation path in NotificationsContro…
distich Nov 16, 2024
383f6b3
fix: Resolve undefined method by accessing conversation ID correctly
distich Nov 16, 2024
fbde076
fix: Update Stripe webhook port to match application port 3001
distich Nov 16, 2024
7745063
fix: Change application and Stripe webhook ports back to 3000
distich Nov 16, 2024
892a04c
feat: Add middleware to redirect HTTP traffic to HTTPS in development…
distich Nov 16, 2024
6578f37
fix: Replace Rack::SSL with config.force_ssl in development environment
distich Nov 16, 2024
5cee038
fix: Handle missing conversation method in NotificationsController
distich Nov 16, 2024
7cacf40
fix: Handle missing conversation ID in notifications redirect logic
distich Nov 16, 2024
c96ef36
chore: Add logging for conversation redirection in NotificationsContr…
distich Nov 16, 2024
6da5e96
fix: Add logging for missing conversation or conversation ID in notif…
distich Nov 16, 2024
a4a8b49
fix: Ensure valid conversation ID before redirecting in Notifications…
distich Nov 16, 2024
764f3b9
fix: Handle missing conversation ID in notifications redirection logic
distich Nov 16, 2024
7051d38
fix: Ensure locale is set for conversation path redirection in notifi…
distich Nov 16, 2024
d22266d
Fixed some issues with admin notifications
distich Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
web: bin/rails server -p 3000
web: bin/rails server -b 'ssl://0.0.0.0:3000?key=./localhost-key.pem&cert=./localhost.pem'
worker: bundle exec sidekiq
js: yarn build --watch
css: yarn build:css --watch
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/locales.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def set_locale(&action)
end

def default_url_options(options = {})
options.merge({locale: resolve_locale})
options.merge({locale: resolve_locale, host: request.host, port: request.port, protocol: request.protocol})
end

def resolve_locale(locale = I18n.locale)
Expand Down
15 changes: 12 additions & 3 deletions app/controllers/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ def show
notification = current_user.notifications.find(params[:id])
notification.mark_as_read!

if (url = notification.to_notification.url)
redirect_to url
if notification.to_notification.respond_to?(:conversation)
conversation = notification.to_notification.conversation
if conversation.present? && conversation.id.present?
Rails.logger.info "Redirecting to conversation with ID: #{conversation.id}"
redirect_to conversation_path(conversation, locale: I18n.locale)
else
Rails.logger.error "Missing conversation or conversation ID. Notification ID: #{notification.id}, Notification Type: #{notification.to_notification.class.name}"
redirect_to notifications_path(locale: I18n.locale), alert: t(".missing_conversation")
end
elsif notification.to_notification.respond_to?(:url)
redirect_to notification.to_notification.url
else
redirect_to notifications_path, notice: t(".notice")
redirect_to notifications_path(locale: I18n.locale), notice: t(".notice")
end
end
end
2 changes: 1 addition & 1 deletion app/notifications/admin/new_conversation_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def email_subject
end

def url
conversation_url(conversation)
conversation_url(conversation, locale: I18n.locale)
end

def conversation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def plan
end

def url
admin_business_conversations_url(business)
admin_business_conversations_url(business, locale: I18n.locale)
end

def business
Expand Down
2 changes: 1 addition & 1 deletion app/notifications/new_message_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def ios_subject
end

def url
conversation_url(conversation)
conversation_url(conversation, locale: I18n.locale)
end

def message
Expand Down
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

# Redirect HTTP to HTTPS
config.force_ssl = true

# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
Expand Down
7 changes: 6 additions & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
# Ensure SSL is enabled with mkcert certificates.
#
port ENV.fetch("PORT", 3000)
ssl_bind '0.0.0.0', '3000', {
key: "./localhost-key.pem",
cert: "./localhost.pem",
verify_mode: "none"
}

# Specifies the `environment` that Puma will run in.
#
Expand Down
Loading