Chore: Update the usage of available_name instead of name (#1110)

Update the usage of available_name instead of the name
This commit is contained in:
Pranav Raj S 2020-08-01 18:30:47 +05:30 committed by GitHub
parent 1dd3573c39
commit 6d4cfcceba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 13 deletions

View file

@ -30,10 +30,6 @@
/>
</p>
</div>
<!-- <img
src="https://randomuser.me/api/portraits/women/94.jpg"
class="sender--thumbnail"
/> -->
</li>
</template>
<script>

View file

@ -114,8 +114,10 @@ export default {
if (this.message.message_type === MESSAGE_TYPE.TEMPLATE) {
return 'Bot';
}
return this.message.sender ? this.message.sender.name : 'Bot';
if (this.message.sender) {
return this.message.sender.available_name || this.message.sender.name;
}
return 'Bot';
},
avatarUrl() {
// eslint-disable-next-line

View file

@ -7,7 +7,7 @@ class AgentNotifications::ConversationNotificationsMailer < ApplicationMailer
@agent = agent
@conversation = conversation
subject = "#{@agent.name}, A new conversation [ID - #{@conversation.display_id}] has been created in #{@conversation.inbox&.name}."
subject = "#{@agent.available_name}, A new conversation [ID - #{@conversation.display_id}] has been created in #{@conversation.inbox&.name}."
mail(to: @agent.email, subject: subject)
end
@ -16,6 +16,6 @@ class AgentNotifications::ConversationNotificationsMailer < ApplicationMailer
@agent = agent
@conversation = conversation
mail(to: @agent.email, subject: "#{@agent.name}, A new conversation [ID - #{@conversation.display_id}] has been assigned to you.")
mail(to: @agent.email, subject: "#{@agent.available_name}, A new conversation [ID - #{@conversation.display_id}] has been assigned to you.")
end
end

View file

@ -1,4 +1,4 @@
<p>Hi <%= @agent.name %>,</p>
<p>Hi <%= @agent.available_name %>,</p>
<p>Time to save the world. A new conversation has been assigned to you</p>

View file

@ -1,4 +1,4 @@
<p>Hi <%= @agent.name %>,</p>
<p>Hi <%= @agent.available_name %>,</p>
<p>Time to save the world. A new conversation has been created in <%= @conversation.inbox.name %></p>

View file

@ -5,7 +5,7 @@
<% @messages.each do |message| %>
<tr>
<td>
<b><%= message.incoming? ? 'You' : message.sender.available_name %></b>
<b><%= message.incoming? ? 'You' : message.sender&.available_name || message.sender&.name %></b>
</td>
</tr>
<tr>

View file

@ -16,7 +16,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
let(:mail) { described_class.conversation_creation(conversation, agent).deliver_now }
it 'renders the subject' do
expect(mail.subject).to eq("#{agent.name}, A new conversation [ID - #{conversation
expect(mail.subject).to eq("#{agent.available_name}, A new conversation [ID - #{conversation
.display_id}] has been created in #{conversation.inbox&.name}.")
end
@ -29,7 +29,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
let(:mail) { described_class.conversation_assignment(conversation, agent).deliver_now }
it 'renders the subject' do
expect(mail.subject).to eq("#{agent.name}, A new conversation [ID - #{conversation.display_id}] has been assigned to you.")
expect(mail.subject).to eq("#{agent.available_name}, A new conversation [ID - #{conversation.display_id}] has been assigned to you.")
end
it 'renders the receiver email' do