Module: TurboChat::ChatMessage::Formatting
- Extended by:
- ActiveSupport::Concern
- Included in:
- TurboChat::ChatMessage
- Defined in:
- app/models/turbo_chat/chat_message/formatting.rb
Instance Method Summary collapse
- #edited? ⇒ Boolean
- #formatted_participant_role ⇒ Object
- #formatted_timestamp ⇒ Object
- #formatted_updated_timestamp ⇒ Object
- #participant_display_name ⇒ Object
- #participant_membership_role ⇒ Object
Instance Method Details
#edited? ⇒ Boolean
18 19 20 21 22 |
# File 'app/models/turbo_chat/chat_message/formatting.rb', line 18 def edited? return false if created_at.blank? || updated_at.blank? updated_at > created_at end |
#formatted_participant_role ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/models/turbo_chat/chat_message/formatting.rb', line 31 def formatted_participant_role membership = participant_membership return nil if membership.nil? role = membership.effective_role_key formatter = TurboChat::Configuration.config_value(:role_formatter, default: nil, chat: chat) formatted = apply_formatter(formatter, role, self) return formatted if formatted.present? membership.effective_role_name end |
#formatted_timestamp ⇒ Object
10 11 12 |
# File 'app/models/turbo_chat/chat_message/formatting.rb', line 10 def formatted_time_for(created_at) end |
#formatted_updated_timestamp ⇒ Object
14 15 16 |
# File 'app/models/turbo_chat/chat_message/formatting.rb', line 14 def formatted_time_for(updated_at) end |
#participant_display_name ⇒ Object
6 7 8 |
# File 'app/models/turbo_chat/chat_message/formatting.rb', line 6 def participant_display_name TurboChat::ParticipantIdentity.display_name(participant) end |
#participant_membership_role ⇒ Object
24 25 26 27 28 29 |
# File 'app/models/turbo_chat/chat_message/formatting.rb', line 24 def participant_membership_role membership = participant_membership return nil if membership.nil? membership.effective_role_key end |