diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-09-13 18:13:43 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-09-13 18:13:43 +0200 |
commit | 74c5b2bd08f844aac03ca6f9653bac4f4eea3a43 (patch) | |
tree | ef0f56bc549ae22b134c749decadbd69f783b7e4 /app/serializers | |
parent | c7f71b974f1a57cd93f86e5a678018d4aea8e728 (diff) | |
parent | 18331fefa2246facc818226043b1f9cc67cf6c1a (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - Gemfile - app/controllers/api/v1/search_controller.rb Conflict because we changed the number of default results to be configurable - app/lib/settings/scoped_settings.rb Addition of a new “noindex” site-wide setting, conflict due to our change of the two other site-wide settings (default flavour and skin instead of theme) - spec/controllers/application_controller_spec.rb Addition of a new “noindex” site-wide setting, conflict due to our change of the two other site-wide settings (default flavour and skin instead of theme)
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/manifest_serializer.rb | 2 | ||||
-rw-r--r-- | app/serializers/rest/featured_tag_serializer.rb | 9 | ||||
-rw-r--r-- | app/serializers/rest/marker_serializer.rb | 13 | ||||
-rw-r--r-- | app/serializers/rest/search_serializer.rb | 7 | ||||
-rw-r--r-- | app/serializers/rest/v2/search_serializer.rb | 7 |
5 files changed, 25 insertions, 13 deletions
diff --git a/app/serializers/manifest_serializer.rb b/app/serializers/manifest_serializer.rb index 28127437d..21ec0d4be 100644 --- a/app/serializers/manifest_serializer.rb +++ b/app/serializers/manifest_serializer.rb @@ -55,6 +55,8 @@ class ManifestSerializer < ActiveModel::Serializer { url_template: 'share?title={title}&text={text}&url={url}', action: 'share', + method: 'GET', + enctype: 'application/x-www-form-urlencoded', params: { title: 'title', text: 'text', diff --git a/app/serializers/rest/featured_tag_serializer.rb b/app/serializers/rest/featured_tag_serializer.rb new file mode 100644 index 000000000..08121ff16 --- /dev/null +++ b/app/serializers/rest/featured_tag_serializer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class REST::FeaturedTagSerializer < ActiveModel::Serializer + attributes :id, :name, :statuses_count, :last_status_at + + def id + object.id.to_s + end +end diff --git a/app/serializers/rest/marker_serializer.rb b/app/serializers/rest/marker_serializer.rb new file mode 100644 index 000000000..2eaf3d507 --- /dev/null +++ b/app/serializers/rest/marker_serializer.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class REST::MarkerSerializer < ActiveModel::Serializer + attributes :last_read_id, :version, :updated_at + + def last_read_id + object.last_read_id.to_s + end + + def version + object.lock_version + end +end diff --git a/app/serializers/rest/search_serializer.rb b/app/serializers/rest/search_serializer.rb index 157f543ae..ee9b421eb 100644 --- a/app/serializers/rest/search_serializer.rb +++ b/app/serializers/rest/search_serializer.rb @@ -1,12 +1,7 @@ # frozen_string_literal: true class REST::SearchSerializer < ActiveModel::Serializer - attributes :hashtags - has_many :accounts, serializer: REST::AccountSerializer has_many :statuses, serializer: REST::StatusSerializer - - def hashtags - object.hashtags.map(&:name) - end + has_many :hashtags, serializer: REST::TagSerializer end diff --git a/app/serializers/rest/v2/search_serializer.rb b/app/serializers/rest/v2/search_serializer.rb deleted file mode 100644 index cdb6b3a53..000000000 --- a/app/serializers/rest/v2/search_serializer.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class REST::V2::SearchSerializer < ActiveModel::Serializer - has_many :accounts, serializer: REST::AccountSerializer - has_many :statuses, serializer: REST::StatusSerializer - has_many :hashtags, serializer: REST::TagSerializer -end |