decidim-core 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/append_redirect_url_to_modals.js.es6 +1 -1
- data/app/assets/javascripts/decidim/data_picker.js.es6 +32 -28
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +2 -2
- data/app/assets/javascripts/decidim/foundation.js.es6 +1 -2
- data/app/assets/stylesheets/decidim/_decidim.scss +6 -1
- data/app/assets/stylesheets/decidim/modules/_address.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_block-banner.scss +39 -0
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +76 -1
- data/app/assets/stylesheets/decidim/modules/_callout.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +117 -16
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +19 -0
- data/app/assets/stylesheets/decidim/modules/_data-picker.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_docs-manager.scss +16 -0
- data/app/assets/stylesheets/decidim/modules/_icons.scss +13 -4
- data/app/assets/stylesheets/decidim/modules/_margins.scss +39 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +26 -0
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +49 -0
- data/app/assets/stylesheets/decidim/modules/_reveal.scss +39 -0
- data/app/assets/stylesheets/decidim/modules/_typography.scss +45 -0
- data/app/assets/stylesheets/decidim/modules/_wizard-steps.scss +45 -0
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +14 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +34 -0
- data/app/assets/stylesheets/decidim/utils/_settings.scss +6 -3
- data/app/commands/decidim/create_report.rb +2 -2
- data/app/controllers/decidim/devise/invitations_controller.rb +1 -1
- data/app/controllers/decidim/features/base_controller.rb +1 -1
- data/app/controllers/decidim/locales_controller.rb +1 -1
- data/app/forms/decidim/registration_form.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +26 -1
- data/app/helpers/decidim/meta_tags_helper.rb +2 -0
- data/app/helpers/decidim/resource_reference_helper.rb +24 -0
- data/app/helpers/decidim/scopes_helper.rb +22 -4
- data/app/helpers/decidim/view_hooks_helper.rb +6 -3
- data/app/mailers/decidim/messaging/conversation_mailer.rb +2 -0
- data/app/models/decidim/abilities/base_ability.rb +1 -1
- data/app/models/decidim/action_log.rb +57 -0
- data/app/models/decidim/area.rb +25 -0
- data/app/models/decidim/area_type.rb +20 -0
- data/app/models/decidim/attachment.rb +3 -0
- data/app/models/decidim/attachment_collection.rb +16 -0
- data/app/models/decidim/authorization.rb +1 -0
- data/app/models/decidim/categorization.rb +2 -0
- data/app/models/decidim/category.rb +8 -0
- data/app/models/decidim/feature.rb +6 -1
- data/app/models/decidim/moderation.rb +7 -0
- data/app/models/decidim/newsletter.rb +7 -0
- data/app/models/decidim/organization.rb +9 -0
- data/app/models/decidim/participatory_process_user_role.rb +9 -0
- data/app/models/decidim/resource_link.rb +8 -1
- data/app/models/decidim/scope.rb +7 -0
- data/app/models/decidim/static_page.rb +7 -0
- data/app/models/decidim/user.rb +5 -1
- data/app/models/decidim/user_group.rb +7 -0
- data/app/presenters/decidim/admin_log/feature_presenter.rb +43 -0
- data/app/presenters/decidim/admin_log/moderation_presenter.rb +48 -0
- data/app/presenters/decidim/admin_log/newsletter_presenter.rb +47 -0
- data/app/presenters/decidim/admin_log/newsletter_resource_presenter.rb +18 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +84 -0
- data/app/presenters/decidim/admin_log/scope_presenter.rb +54 -0
- data/app/presenters/decidim/admin_log/static_page_presenter.rb +48 -0
- data/app/presenters/decidim/admin_log/static_page_resource_presenter.rb +18 -0
- data/app/presenters/decidim/admin_log/user_group_presenter.rb +31 -0
- data/app/presenters/decidim/admin_log/user_presenter.rb +59 -0
- data/app/presenters/decidim/area_presenter.rb +14 -0
- data/app/presenters/decidim/area_type_presenter.rb +14 -0
- data/app/presenters/decidim/category_presenter.rb +14 -0
- data/app/presenters/decidim/log/base_presenter.rb +253 -0
- data/app/presenters/decidim/log/diff_presenter.rb +120 -0
- data/app/presenters/decidim/log/resource_presenter.rb +71 -0
- data/app/presenters/decidim/log/space_presenter.rb +63 -0
- data/app/presenters/decidim/log/user_presenter.rb +85 -0
- data/app/presenters/decidim/log/value_types/area_presenter.rb +28 -0
- data/app/presenters/decidim/log/value_types/date_presenter.rb +20 -0
- data/app/presenters/decidim/log/value_types/default_presenter.rb +43 -0
- data/app/presenters/decidim/log/value_types/locale_presenter.rb +20 -0
- data/app/presenters/decidim/log/value_types/percentage_presenter.rb +21 -0
- data/app/presenters/decidim/log/value_types/scope_presenter.rb +28 -0
- data/app/presenters/decidim/log/value_types/scope_type_presenter.rb +28 -0
- data/app/presenters/decidim/user_presenter.rb +1 -1
- data/app/services/decidim/action_authorizer.rb +1 -1
- data/app/services/decidim/action_logger.rb +108 -0
- data/app/services/decidim/events_manager.rb +1 -1
- data/app/services/decidim/log/diff_changeset_calculator.rb +135 -0
- data/app/services/decidim/resource_search.rb +2 -8
- data/app/services/decidim/settings_change.rb +31 -0
- data/app/services/decidim/traceability.rb +57 -11
- data/app/types/decidim/core/component_type.rb +12 -0
- data/app/types/decidim/core/date_time_type.rb +12 -0
- data/app/types/decidim/core/date_type.rb +13 -0
- data/app/types/decidim/core/decidim_type.rb +23 -0
- data/app/types/decidim/core/localized_string_type.rb +14 -0
- data/app/types/decidim/core/organization_type.rb +20 -0
- data/app/types/decidim/core/participatory_space_type.rb +12 -0
- data/app/types/decidim/core/session_type.rb +19 -0
- data/app/types/decidim/core/statistic_type.rb +22 -0
- data/app/types/decidim/core/translated_field_type.rb +45 -0
- data/app/types/decidim/core/user_group_type.rb +39 -0
- data/app/types/decidim/core/user_type.rb +41 -0
- data/app/validators/etiquette_validator.rb +1 -1
- data/app/views/decidim/application/_attachments.html.erb +4 -0
- data/app/views/decidim/application/_collection.html.erb +14 -0
- data/app/views/decidim/application/_document.html.erb +19 -0
- data/app/views/decidim/application/_documents.html.erb +8 -23
- data/app/views/decidim/shared/_announcement.html.erb +3 -2
- data/app/views/decidim/shared/_tags.html.erb +1 -0
- data/app/views/decidim/widgets/_data_picker.html.erb +6 -0
- data/app/views/layouts/decidim/mailer.html.erb +2 -2
- data/config/initializers/devise.rb +3 -3
- data/config/locales/ca.yml +65 -11
- data/config/locales/en.yml +64 -10
- data/config/locales/es.yml +66 -12
- data/config/locales/eu.yml +61 -10
- data/config/locales/fi.yml +64 -10
- data/config/locales/fr.yml +64 -10
- data/config/locales/gl.yml +64 -10
- data/config/locales/it.yml +64 -10
- data/config/locales/nl.yml +64 -10
- data/config/locales/pl.yml +60 -10
- data/config/locales/pt-BR.yml +64 -10
- data/config/locales/pt.yml +64 -10
- data/config/locales/sv.yml +64 -10
- data/config/locales/uk.yml +72 -0
- data/db/migrate/20170215115407_add_organization_custom_reference.rb +1 -1
- data/db/migrate/20170313095436_add_available_authorizations_to_organization.rb +1 -1
- data/db/migrate/20171207182729_create_decidim_attachment_collections.rb +12 -0
- data/db/migrate/20180130093153_add_action_log.rb +18 -0
- data/db/migrate/20180206143340_fix_reference_for_all_resources.rb +13 -0
- data/db/migrate/20180215104821_create_decidim_area_types.rb +11 -0
- data/db/migrate/20180215104945_create_decidim_areas.rb +12 -0
- data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
- data/db/migrate/20180226140756_add_version_to_action_logs.rb +19 -0
- data/db/migrate/20180314085339_rename_maximum_votes_per_proposal_to_threshold_per_proposal.rb +27 -0
- data/db/migrate/20180326075746_change_event_name_and_class_to_rename_to_publish_proposal_event.rb +17 -0
- data/db/seeds.rb +28 -0
- data/lib/decidim/abilities/participatory_process_role_ability.rb +2 -2
- data/lib/decidim/api/author_interface.rb +25 -0
- data/lib/decidim/api/component_interface.rb +16 -0
- data/lib/decidim/api/participatory_space_interface.rb +38 -0
- data/lib/decidim/authorable.rb +8 -0
- data/lib/decidim/core.rb +27 -9
- data/lib/decidim/core/engine.rb +3 -4
- data/lib/decidim/core/test.rb +2 -0
- data/lib/decidim/core/test/factories.rb +62 -6
- data/lib/decidim/core/test/shared_examples/announcements_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +47 -5
- data/lib/decidim/core/test/shared_examples/component_type.rb +7 -0
- data/lib/decidim/core/test/shared_examples/has_attachment_collections.rb +63 -0
- data/lib/decidim/core/test/shared_examples/has_attachments.rb +21 -0
- data/lib/decidim/core/test/shared_examples/has_reference.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +27 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/author_event.rb +1 -1
- data/lib/decidim/events/base_event.rb +1 -1
- data/lib/decidim/events/simple_event.rb +21 -0
- data/lib/decidim/exporters/excel.rb +1 -1
- data/lib/decidim/feature_manifest.rb +2 -0
- data/lib/decidim/form_builder.rb +37 -3
- data/lib/decidim/has_attachment_collections.rb +18 -0
- data/lib/decidim/has_attachments.rb +14 -0
- data/lib/decidim/has_category.rb +5 -0
- data/lib/decidim/has_reference.rb +4 -4
- data/lib/decidim/loggable.rb +32 -0
- data/lib/decidim/participable.rb +0 -2
- data/lib/decidim/participatory_space_manifest.rb +2 -0
- data/lib/decidim/publicable.rb +2 -2
- data/lib/decidim/query_extensions.rb +46 -14
- data/lib/decidim/resourceable.rb +15 -6
- data/lib/decidim/scopable.rb +35 -1
- data/lib/decidim/scopable_feature.rb +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ca.js +0 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.es.js +0 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.eu.js +0 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fi.js +0 -0
- data/vendor/assets/javascripts/leaflet.markercluster.js +0 -0
- metadata +91 -38
- data/app/commands/decidim/remove_admin.rb +0 -25
- data/app/helpers/decidim/feature_reference_helper.rb +0 -25
- data/lib/decidim/core/api.rb +0 -13
- data/lib/decidim/core/api/author_interface.rb +0 -18
- data/lib/decidim/core/api/decidim_type.rb +0 -17
- data/lib/decidim/core/api/localized_string_type.rb +0 -12
- data/lib/decidim/core/api/process_step_type.rb +0 -19
- data/lib/decidim/core/api/process_type.rb +0 -17
- data/lib/decidim/core/api/session_type.rb +0 -17
- data/lib/decidim/core/api/translated_field_type.rb +0 -43
- data/lib/decidim/core/api/user_group_type.rb +0 -37
- data/lib/decidim/core/api/user_type.rb +0 -39
- data/lib/decidim/devise_failure_app.rb +0 -36
- data/lib/decidim/has_scope.rb +0 -25
- data/lib/decidim/i18n_exceptions.rb +0 -15
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# A command to remove the admin privilege to an user.
|
5
|
-
class RemoveAdmin < Rectify::Command
|
6
|
-
# Public: Initializes the command.
|
7
|
-
#
|
8
|
-
# form - A form object with the params.
|
9
|
-
def initialize(user)
|
10
|
-
@user = user
|
11
|
-
end
|
12
|
-
|
13
|
-
def call
|
14
|
-
return broadcast(:invalid) unless user
|
15
|
-
|
16
|
-
user.update_attributes!(admin: false)
|
17
|
-
|
18
|
-
broadcast(:ok)
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
attr_reader :user
|
24
|
-
end
|
25
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# Helper to print Feature references.
|
5
|
-
module FeatureReferenceHelper
|
6
|
-
# Displays the localized reference for the given feature.
|
7
|
-
#
|
8
|
-
# feature - the Feature that has the reference to display.
|
9
|
-
# options - An optional hash of options
|
10
|
-
# * class: A string of extra css classes
|
11
|
-
#
|
12
|
-
# Returns a String.
|
13
|
-
def feature_reference(feature, options = {})
|
14
|
-
return unless feature.reference
|
15
|
-
@reference = feature.reference
|
16
|
-
"<div class='tech-info #{options[:class]}'>#{localized_reference}</div>".html_safe
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def localized_reference
|
22
|
-
I18n.t("reference", reference: @reference, scope: "decidim.shared.reference")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/decidim/core/api.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
autoload :AuthorInterface, "decidim/core/api/author_interface"
|
5
|
-
autoload :TranslatedFieldType, "decidim/core/api/translated_field_type"
|
6
|
-
autoload :LocalizedStringType, "decidim/core/api/localized_string_type"
|
7
|
-
autoload :ProcessStepType, "decidim/core/api/process_step_type"
|
8
|
-
autoload :ProcessType, "decidim/core/api/process_type"
|
9
|
-
autoload :SessionType, "decidim/core/api/session_type"
|
10
|
-
autoload :UserGroupType, "decidim/core/api/user_group_type"
|
11
|
-
autoload :UserType, "decidim/core/api/user_type"
|
12
|
-
autoload :DecidimType, "decidim/core/api/decidim_type"
|
13
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This interface represents an author who owns a resource.
|
5
|
-
AuthorInterface = GraphQL::InterfaceType.define do
|
6
|
-
name "Author"
|
7
|
-
description "An author"
|
8
|
-
|
9
|
-
field :name, !types.String, "The author's name"
|
10
|
-
field :nickname, !types.String, "The author's nickname"
|
11
|
-
|
12
|
-
field :avatarUrl, !types.String, "The author's avatar url"
|
13
|
-
field :profilePath, !types.String, "The author's profile path"
|
14
|
-
field :badge, !types.String, "The author's badge icon"
|
15
|
-
|
16
|
-
field :deleted, !types.Boolean, "Whether the author's account has been deleted or not"
|
17
|
-
end
|
18
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a Decidim's global property.
|
5
|
-
DecidimType = GraphQL::ObjectType.define do
|
6
|
-
name "Decidim"
|
7
|
-
description "Decidim's framework-related properties."
|
8
|
-
|
9
|
-
field :version, !types.String, "The current decidim's version of this deployment." do
|
10
|
-
resolve ->(obj, _args, _ctx) { obj.version }
|
11
|
-
end
|
12
|
-
|
13
|
-
field :application_name, !types.String, "The current installation's name." do
|
14
|
-
resolve ->(obj, _args, _ctx) { obj.application_name }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a localized string in a single language.
|
5
|
-
LocalizedStringType = GraphQL::ObjectType.define do
|
6
|
-
name "LocalizedString"
|
7
|
-
description "Represents a particular translation of a LocalizedStringType"
|
8
|
-
|
9
|
-
field :locale, !types.String, "The standard locale of this translation."
|
10
|
-
field :text, types.String, "The content of this translation."
|
11
|
-
end
|
12
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a step on a participatory process.
|
5
|
-
ProcessStepType = GraphQL::ObjectType.define do
|
6
|
-
name "ProcessStep"
|
7
|
-
description "A participatory process step"
|
8
|
-
|
9
|
-
field :id, !types.ID, "The unique ID of this step."
|
10
|
-
|
11
|
-
field :process do
|
12
|
-
type !ProcessType
|
13
|
-
description "The participatory process in which this step belongs to."
|
14
|
-
property :participatory_process
|
15
|
-
end
|
16
|
-
|
17
|
-
field :title, !TranslatedFieldType, "The title of this step"
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a ParticipatoryProcess.
|
5
|
-
ProcessType = GraphQL::ObjectType.define do
|
6
|
-
name "Process"
|
7
|
-
description "A participatory process"
|
8
|
-
|
9
|
-
field :id, !types.ID, "The Process' unique ID"
|
10
|
-
|
11
|
-
field :title, !TranslatedFieldType, "The title of this process."
|
12
|
-
|
13
|
-
connection :steps, ProcessStepType.connection_type do
|
14
|
-
description "All the steps of this process."
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents the current user session.
|
5
|
-
SessionType = GraphQL::ObjectType.define do
|
6
|
-
name "Session"
|
7
|
-
description "The current session"
|
8
|
-
|
9
|
-
field :user, UserType, "The current user" do
|
10
|
-
resolve ->(obj, _args, _ctx) { obj }
|
11
|
-
end
|
12
|
-
|
13
|
-
field :verifiedUserGroups, !types[!UserGroupType], "The current user verified user groups" do
|
14
|
-
resolve ->(obj, _args, _ctx) { obj.user_groups.verified }
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a translated field in multiple languages.
|
5
|
-
TranslatedFieldType = GraphQL::ObjectType.define do
|
6
|
-
name "TranslatedField"
|
7
|
-
description "A translated field"
|
8
|
-
|
9
|
-
field :locales do
|
10
|
-
type types[!types.String]
|
11
|
-
description "Lists all the locales in which this translation is available"
|
12
|
-
resolve ->(obj, _args, _ctx) { obj.keys }
|
13
|
-
end
|
14
|
-
|
15
|
-
field :translations do
|
16
|
-
type !types[!LocalizedStringType]
|
17
|
-
description "All the localized strings for this translation."
|
18
|
-
|
19
|
-
argument :locales do
|
20
|
-
type types[!types.String]
|
21
|
-
description "A list of locales to scope the translations to."
|
22
|
-
end
|
23
|
-
|
24
|
-
resolve lambda { |obj, args, _ctx|
|
25
|
-
translations = obj.stringify_keys
|
26
|
-
translations = translations.slice(*args["locales"]) if args["locales"]
|
27
|
-
|
28
|
-
translations.map { |locale, text| OpenStruct.new(locale: locale, text: text) }
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
field :translation do
|
33
|
-
type types.String
|
34
|
-
description "Returns a single translation given a locale."
|
35
|
-
argument :locale, !types.String, "A locale to search for"
|
36
|
-
|
37
|
-
resolve lambda { |obj, args, _ctx|
|
38
|
-
translations = obj.stringify_keys
|
39
|
-
translations[args["locale"]]
|
40
|
-
}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a UserGroup
|
5
|
-
UserGroupType = GraphQL::ObjectType.define do
|
6
|
-
name "UserGroup"
|
7
|
-
description "A user group"
|
8
|
-
|
9
|
-
interfaces [
|
10
|
-
Decidim::AuthorInterface
|
11
|
-
]
|
12
|
-
|
13
|
-
field :id, !types.ID, "The user group's id"
|
14
|
-
|
15
|
-
field :name, !types.String, "The user group's name"
|
16
|
-
|
17
|
-
field :nickname, !types.String, "User groups have no nickname" do
|
18
|
-
resolve ->(obj, _args, _ctx) { UserGroupPresenter.new(obj).nickname }
|
19
|
-
end
|
20
|
-
|
21
|
-
field :avatarUrl, !types.String, "The user's avatar url" do
|
22
|
-
resolve ->(obj, _args, _ctx) { UserGroupPresenter.new(obj).avatar_url }
|
23
|
-
end
|
24
|
-
|
25
|
-
field :profilePath, !types.String, "The user's profile url" do
|
26
|
-
resolve ->(obj, _args, _ctx) { UserGroupPresenter.new(obj).profile_path }
|
27
|
-
end
|
28
|
-
|
29
|
-
field :deleted, !types.Boolean, "Whether the user group's has been deleted or not" do
|
30
|
-
resolve ->(obj, _args, _ctx) { UserGroupPresenter.new(obj).deleted? }
|
31
|
-
end
|
32
|
-
|
33
|
-
field :badge, !types.String, "A badge for the user group" do
|
34
|
-
resolve ->(obj, _args, _ctx) { UserGroupPresenter.new(obj).badge }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This type represents a User.
|
5
|
-
UserType = GraphQL::ObjectType.define do
|
6
|
-
name "User"
|
7
|
-
description "A user"
|
8
|
-
|
9
|
-
interfaces [
|
10
|
-
Decidim::AuthorInterface
|
11
|
-
]
|
12
|
-
|
13
|
-
field :name, !types.String, "The user's name"
|
14
|
-
|
15
|
-
field :nickname, !types.String, "The user's nickname" do
|
16
|
-
resolve ->(obj, _args, _ctx) { UserPresenter.new(obj).nickname }
|
17
|
-
end
|
18
|
-
|
19
|
-
field :avatarUrl, !types.String, "The user's avatar url" do
|
20
|
-
resolve ->(obj, _args, _ctx) { UserPresenter.new(obj).avatar_url(:thumb) }
|
21
|
-
end
|
22
|
-
|
23
|
-
field :profilePath, !types.String, "The user's profile url" do
|
24
|
-
resolve ->(obj, _args, _ctx) { UserPresenter.new(obj).profile_path }
|
25
|
-
end
|
26
|
-
|
27
|
-
field :organizationName, !types.String, "The user's organization name" do
|
28
|
-
resolve ->(obj, _args, _ctx) { obj.organization.name }
|
29
|
-
end
|
30
|
-
|
31
|
-
field :deleted, !types.Boolean, "Whether the user's account has been deleted or not" do
|
32
|
-
resolve ->(obj, _args, _ctx) { UserPresenter.new(obj).deleted? }
|
33
|
-
end
|
34
|
-
|
35
|
-
field :badge, !types.String, "A badge for the user group" do
|
36
|
-
resolve ->(obj, _args, _ctx) { UserPresenter.new(obj).badge }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# We've provided a custom class in order to be able to deactivate the
|
5
|
-
# script_name hack that doesn't seem to be affecting us (it is actually
|
6
|
-
# introducing a bug).
|
7
|
-
class DeviseFailureApp < ::Devise::FailureApp
|
8
|
-
def scope_url
|
9
|
-
opts = {}
|
10
|
-
|
11
|
-
# Initialize script_name with nil to prevent infinite loops in
|
12
|
-
# authenticated mounted engines in rails 4.2 and 5.0
|
13
|
-
|
14
|
-
# The line below is what we commented LOL ^^
|
15
|
-
# opts[:script_name] = nil
|
16
|
-
|
17
|
-
route = route(scope)
|
18
|
-
|
19
|
-
opts[:locale] = params[:locale] if params[:locale]
|
20
|
-
opts[:format] = request_format unless skip_format?
|
21
|
-
|
22
|
-
opts[:script_name] = relative_url_root if relative_url_root?
|
23
|
-
|
24
|
-
router_name = ::Devise.mappings[scope].router_name || ::Devise.available_router_name
|
25
|
-
context = send(router_name)
|
26
|
-
|
27
|
-
if context.respond_to?(route)
|
28
|
-
context.send(route, opts)
|
29
|
-
elsif respond_to?(:root_url)
|
30
|
-
root_url(opts)
|
31
|
-
else
|
32
|
-
"/"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/decidim/has_scope.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Decidim
|
6
|
-
# A concern with the features needed when you want a model to have a scope.
|
7
|
-
module HasScope
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
included do
|
11
|
-
belongs_to :scope,
|
12
|
-
foreign_key: "decidim_scope_id",
|
13
|
-
class_name: "Decidim::Scope",
|
14
|
-
optional: true
|
15
|
-
validate :scope_belongs_to_organization
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def scope_belongs_to_organization
|
20
|
-
return if !scope || !feature
|
21
|
-
errors.add(:scope, :invalid) unless feature.scopes.where(id: scope.id).exists?
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
unless Rails.env.production?
|
4
|
-
module I18n
|
5
|
-
class JustRaiseExceptionHandler < ExceptionHandler
|
6
|
-
def call(exception, locale, key, options)
|
7
|
-
raise exception.to_exception if exception.is_a?(MissingTranslationData) || exception.is_a?(MissingTranslation)
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
I18n.exception_handler = I18n::JustRaiseExceptionHandler.new
|
15
|
-
end
|