Sha256: 71fe9da3b58352a7890fe4330aa6f02f35edefdd953debc1a2a84e4da30e595f

Contents?: true

Size: 556 Bytes

Versions: 12

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # The form object that handles the data behind updating a user's
  # interests in their profile page.
  class UserInterestsForm < Form
    mimic :user

    attribute :scopes, Array[UserInterestScopeForm]

    def newsletter_notifications_at
      return nil unless newsletter_notifications

      Time.current
    end

    def map_model(user)
      self.scopes = user.organization.scopes.top_level.map do |scope|
        UserInterestScopeForm.from_model(scope: scope, user: user)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.8 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.7 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.6 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.5 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.4 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.3 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.2 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.1 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.0 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.0.rc2 app/forms/decidim/user_interests_form.rb
decidim-core-0.27.0.rc1 app/forms/decidim/user_interests_form.rb