Class: UserStatus

Inherits:
ApplicationRecord show all
Includes:
CacheMarkdownField
Defined in:
app/models/user_status.rb

Constant Summary collapse

DEFAULT_EMOJI =
'speech_balloon'
CLEAR_STATUS_QUICK_OPTIONS =
{
  '30_minutes' => 30.minutes,
  '3_hours' => 3.hours,
  '8_hours' => 8.hours,
  '1_day' => 1.day,
  '3_days' => 3.days,
  '7_days' => 7.days,
  '30_days' => 30.days
}.freeze

Constants included from CacheMarkdownField

CacheMarkdownField::INVALIDATED_BY

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Constants included from HasCheckConstraints

HasCheckConstraints::NOT_NULL_CHECK_PATTERN

Constants included from ResetOnColumnErrors

ResetOnColumnErrors::MAX_RESET_PERIOD

Instance Attribute Summary

Attributes included from CacheMarkdownField

#skip_markdown_cache_validation

Instance Method Summary collapse

Methods included from CacheMarkdownField

#attribute_invalidated?, #banzai_render_context, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #mentionable_attributes_changed?, #mentioned_filtered_user_ids_for, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #store_mentions!, #store_mentions_after_commit?, #updated_cached_html_for

Methods inherited from ApplicationRecord

===, cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, nullable_column?, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from ResetOnColumnErrors

#reset_on_union_error, #reset_on_unknown_attribute_error

Methods included from Gitlab::SensitiveSerializableHash

#serializable_hash

Instance Method Details

#clear_status_afterObject



32
33
34
# File 'app/models/user_status.rb', line 32

def clear_status_after
  clear_status_at
end

#clear_status_after=(value) ⇒ Object



36
37
38
# File 'app/models/user_status.rb', line 36

def clear_status_after=(value)
  self.clear_status_at = CLEAR_STATUS_QUICK_OPTIONS[value]&.from_now
end

#customized?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/user_status.rb', line 40

def customized?
  message.present? || emoji != UserStatus::DEFAULT_EMOJI
end