summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/call_history.rb19
-rw-r--r--app/views/call_histories/_index_core.html.haml20
2 files changed, 23 insertions, 16 deletions
diff --git a/app/models/call_history.rb b/app/models/call_history.rb
index 81342bd..8ccf4e3 100644
--- a/app/models/call_history.rb
+++ b/app/models/call_history.rb
@@ -133,19 +133,14 @@ class CallHistory < ActiveRecord::Base
end
- def voicemail_message?
- begin
- return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).any?
- rescue
- return nil
- end
- end
-
def voicemail_message
- begin
- return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first
- rescue
- return nil
+ if self.callee_account_type.downcase == 'voicemailaccount'
+ voicemail_account = VoicemailAccount.where(:id => self.callee_account_id).first
+ if voicemail_account
+ return voicemail_account.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first
+ else
+ return nil
+ end
end
end
diff --git a/app/views/call_histories/_index_core.html.haml b/app/views/call_histories/_index_core.html.haml
index ef5654a..9c2cf39 100644
--- a/app/views/call_histories/_index_core.html.haml
+++ b/app/views/call_histories/_index_core.html.haml
@@ -41,17 +41,29 @@
%i{:class => 'icon-time'}
-elsif call_history.entry_type == 'forwarded'
- if call_history.callee_account_type.to_s.downcase == 'voicemailaccount'
- %i{:class => 'icon-envelope'}
+ - voicemail_message = call_history.voicemail_message
+ - if voicemail_message
+ - if voicemail_message.read_epoch > 0
+ %i{:class => 'icon-bullhorn'}
+ - else
+ %i{:class => 'icon-envelope'}
+ - else
+ %i{:class => 'icon-random'}
- else
%i{:class => 'icon-random'}
- else
%i{:class => 'icon-arrow-right'}
- if call_history.entry_type == 'forwarded'
- - if call_history.callee_account_type.to_s.downcase == 'phonenumber'
- = call_history.destination_number
- if call_history.callee_account_type.to_s.downcase == 'voicemailaccount'
- = VoicemailAccount.where(:id => call_history.callee_account_id).first.to_s
+ - if voicemail_message
+ %a.name{:href => voicemail_account_voicemail_messages_path(voicemail_message.voicemail_account, :anchor => "message_#{voicemail_message.uuid}")}
+ = voicemail_message.display_duration
+ /= VoicemailAccount.where(:id => call_history.callee_account_id).first.to_s
+ - else
+ = VoicemailAccount.where(:id => call_history.callee_account_id).first.to_s
+ - else
+ = call_history.destination_number
- elsif call_history.entry_type == 'dialed'
= call_history.caller_id_number
- else