diff --git a/app/components/chat/chat.html.erb b/app/components/chat/chat.html.erb
deleted file mode 100644
index 9977ce063..000000000
--- a/app/components/chat/chat.html.erb
+++ /dev/null
@@ -1,23 +0,0 @@
-
- <%= c 'stack' do %>
- <%= c 'contributor_row', contributor: contributor %>
-
- <%= c 'chat_messages', messages: messages %>
-
- <%= c 'stack' do %>
-
- <% if active_request? %>
- <%= c 'chat_form', contributor: contributor %>
- <% else %>
-
- <%= t 'components.chat.outdated_request' %>
-
- <%= c 'button',
- label: t('components.chat.link_to_active_request'),
- link: active_conversation_path
- %>
- <% end %>
-
- <% end %>
- <% end %>
-
diff --git a/app/components/chat_messages_group/chat_messages_group.rb b/app/components/chat_messages_group/chat_messages_group.rb
index c9c6d14bf..ecb507b47 100644
--- a/app/components/chat_messages_group/chat_messages_group.rb
+++ b/app/components/chat_messages_group/chat_messages_group.rb
@@ -16,10 +16,6 @@ def id
"contributor-#{@contributor.id}"
end
- def conversation_link
- messages.first.conversation_link
- end
-
def add_message_link
new_message_path(contributor_id: @contributor, request_id: @request)
end
diff --git a/app/components/search_result/search_result.rb b/app/components/search_result/search_result.rb
index ab7f13eb7..60dba7e56 100644
--- a/app/components/search_result/search_result.rb
+++ b/app/components/search_result/search_result.rb
@@ -12,10 +12,6 @@ def initialize(result: nil)
attr_reader :result
- def link
- helpers.contributor_request_path(contributor_id: result.contributor_id, id: result.request_id)
- end
-
def type
result.model_name.name
end
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 583798b6b..8dc88d81b 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -14,7 +14,7 @@ def create
content_type: 'text/plain'
)
if @message.save!
- redirect_to contributor_request_path(contributor_id: @contributor, id: @request), flash: { success: I18n.t('message.create.success') }
+ redirect_to @message.chat_message_link, flash: { success: I18n.t('message.create.success') }
else
render :new_message, flash: { error: I18n.t('message.create.error') }
end
@@ -24,7 +24,7 @@ def edit; end
def update
if @message.update(text: params[:message][:text], creator: current_user)
- redirect_to contributor_request_path(contributor_id: @contributor, id: @request), flash: { success: I18n.t('message.edit.success') }
+ redirect_to @message.chat_message_link, flash: { success: I18n.t('message.edit.success') }
else
flash.now[:error] = I18n.t('message.edit.error')
render :edit
diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb
index b3c39ca87..f89b36585 100644
--- a/app/controllers/requests_controller.rb
+++ b/app/controllers/requests_controller.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
class RequestsController < ApplicationController
- before_action :set_request, only: %i[show show_contributor_messages edit update notifications destroy messages_by_contributor stats]
- before_action :set_contributor, only: %i[show_contributor_messages]
+ before_action :set_request, only: %i[show edit update notifications destroy messages_by_contributor stats]
before_action :notifications_params, only: :notifications
before_action :disallow_edit, only: %i[edit update]
before_action :disallow_destroy, only: :destroy
@@ -65,10 +64,6 @@ def destroy
end
end
- def show_contributor_messages
- @chat_messages = @contributor.conversation_about(@request)
- end
-
def notifications
last_updated_at = Time.zone.parse(params[:last_updated_at])
message_count = @request.replies.where('created_at >= ?', last_updated_at).count
diff --git a/app/models/message.rb b/app/models/message.rb
index 41498c530..2557b6d3e 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -52,10 +52,6 @@ def contributor
recipient || sender # If there is no recipient, then the message must be inbound and the sender must be a contributor
end
- def conversation_link
- Rails.application.routes.url_helpers.contributor_request_path(id: request.id, contributor_id: contributor.id)
- end
-
def chat_message_link
Rails.application.routes.url_helpers.conversations_contributor_path(id: contributor, anchor: "message-#{id}")
end
diff --git a/app/views/requests/show_contributor_messages.html.erb b/app/views/requests/show_contributor_messages.html.erb
deleted file mode 100644
index c27a9d4f8..000000000
--- a/app/views/requests/show_contributor_messages.html.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-<%= c 'main' do %>
- <%= c 'page_header' do %>
- <% c 'heading' do %>
- <%= I18n.t 'conversation.conversation', count: 1 %>
- <% end %>
- <% end %>
-
- <%= c 'section' do %>
- <%= c 'chat', contributor: @contributor, messages: @chat_messages, request: @request %>
- <% end %>
-<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 3611054b4..a5479a1b8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -73,8 +73,6 @@
end
resources :contributors, only: %i[index show edit update], concerns: :paginatable do
- resources :requests, only: %i[show], to: 'requests#show_contributor_messages'
-
member do
get 'conversations'
post 'message'
diff --git a/spec/models/message_spec.rb b/spec/models/message_spec.rb
index ea35d8f4f..99aff2e8c 100644
--- a/spec/models/message_spec.rb
+++ b/spec/models/message_spec.rb
@@ -65,20 +65,6 @@
let(:request) { create(:request, id: 6) }
let(:message) { create(:message, request: request, **params) }
- describe '#conversation_link' do
- subject { message.conversation_link }
-
- describe 'given a recipient' do
- let(:params) { { sender: nil, recipient: contributor, broadcasted: true } }
- it { should eq('/contributors/7/requests/6') }
- end
-
- describe 'given an inbound message' do
- let(:params) { { recipient: nil, sender: contributor } }
- it { should eq('/contributors/7/requests/6') }
- end
- end
-
describe '#chat_message_link' do
subject { message.chat_message_link }
let(:params) { { id: 8, recipient: nil, sender: contributor } }
diff --git a/spec/requests/contributors_spec.rb b/spec/requests/contributors_spec.rb
index 4c24156a1..cef70e01c 100644
--- a/spec/requests/contributors_spec.rb
+++ b/spec/requests/contributors_spec.rb
@@ -22,13 +22,6 @@
end
end
- describe 'GET /requests/:id' do
- it 'should be successful' do
- get contributor_request_path(id: the_request.id, contributor_id: contributor.id, as: user)
- expect(response).to be_successful
- end
- end
-
describe 'GET /count' do
let!(:teachers) { create_list(:contributor, 2, tag_list: 'teacher') }
diff --git a/spec/requests/messages_spec.rb b/spec/requests/messages_spec.rb
index a30cd5b3f..9d28cbb8c 100644
--- a/spec/requests/messages_spec.rb
+++ b/spec/requests/messages_spec.rb
@@ -23,7 +23,7 @@
it 'redirects to the conversation link the message belongs to' do
subject.call
- expect(response).to redirect_to(contributor_request_path(id: request.id, contributor_id: contributor.id))
+ expect(response).to redirect_to(Message.first.chat_message_link)
end
it 'shows success notification' do
@@ -51,7 +51,7 @@
it 'redirects to the conversation link the message belongs to' do
subject.call
- expect(response).to redirect_to(contributor_request_path(id: message.request_id, contributor_id: message.sender_id))
+ expect(response).to redirect_to(message.chat_message_link)
end
context 'not manually created message' do