Skip to content

Commit

Permalink
Fix broken request notifications (#2036)
Browse files Browse the repository at this point in the history
scope url by organization

Fixes #2034

---------

Co-authored-by: Samuel Oey <samuel.oey@gmail.com>
Co-authored-by: Samuel Oey <so@capinside.com>
  • Loading branch information
3 people authored Sep 23, 2024
1 parent 347a810 commit 38f949a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div
class="RequestNotification"
data-controller="request-notification"
data-request-notification-id-value="<%= request_for_info.id %>"
data-request-notification-last-updated-at-value="<%= last_updated_at %>"
data-request-notification-message-template-value="<%= t('components.request_notification.message_template').to_json %>"
data-request-notification-fetch-messages-url-value="<%= notifications_organization_request_path(request_for_info.organization, request_for_info) %>"
hidden
>
<%= c 'notification', show_close: false do %>
Expand Down
4 changes: 2 additions & 2 deletions app/components/request_notification/request_notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const POLLING_INTERVAL = 1000 * 30;
export default class extends Controller {
static targets = ['text'];
static values = {
id: String,
lastUpdatedAt: String,
messageTemplate: String,
fetchMessagesUrl: String,
};

connect() {
Expand All @@ -25,7 +25,7 @@ export default class extends Controller {

fetchMessages() {
Rails.ajax({
url: `/requests/${this.idValue}/notifications`,
url: this.fetchMessagesUrlValue,
type: 'GET',
data: new URLSearchParams({
last_updated_at: this.lastUpdatedAtValue,
Expand Down
2 changes: 1 addition & 1 deletion spec/components/request_notification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
subject { render_inline(described_class.new(**params)) }

let(:params) { { request_for_info: request_for_info } }
let(:request_for_info) { build(:request) }
let(:request_for_info) { create(:request) }

it { should have_css('.RequestNotification', visible: :hidden) }
end

0 comments on commit 38f949a

Please sign in to comment.