From 0f1532aee098049b17ad6b7ecb1d083c856f1d64 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Fri, 10 Jan 2020 23:04:14 -0600 Subject: add option for changing the monsterfork api exposure level, defaulting to `full` - if this gives your app indigestion change it to back to `basic` in preferences --- app/controllers/settings/preferences_controller.rb | 1 + app/models/user.rb | 3 +++ app/serializers/rest/status_serializer.rb | 2 +- app/views/settings/preferences/show.html.haml | 8 +++++--- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/controllers/settings/preferences_controller.rb b/app/controllers/settings/preferences_controller.rb index ce3c84f77..2e364bbc8 100644 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@ -51,6 +51,7 @@ class Settings::PreferencesController < Settings::BaseController :filter_undescribed, :invert_filters, :filter_timelines_only, + :monsterpit_api, chosen_languages: [] ) end diff --git a/app/models/user.rb b/app/models/user.rb index b519e9b15..c7b002024 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -46,6 +46,7 @@ # media_only :boolean default(FALSE), not null # filter_undescribed :boolean default(FALSE), not null # filters_enabled :boolean default(FALSE), not null +# monsterfork_api :integer default("full"), not null # class User < ApplicationRecord @@ -81,6 +82,8 @@ class User < ApplicationRecord include PamAuthenticable include LdapAuthenticable + enum monsterfork_api: [:vanilla, :basic, :full] + belongs_to :account, inverse_of: :user belongs_to :invite, counter_cache: :uses, optional: true belongs_to :created_by_application, class_name: 'Doorkeeper::Application', optional: true diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb index cb584e1d6..bec2a836b 100644 --- a/app/serializers/rest/status_serializer.rb +++ b/app/serializers/rest/status_serializer.rb @@ -72,7 +72,7 @@ class REST::StatusSerializer < ActiveModel::Serializer def visibility if object.limited_visibility? 'private' - elsif object.local_visibility? + elsif current_user.monsterfork_api != 'full' && object.local_visibility? 'unlisted' else object.visibility diff --git a/app/views/settings/preferences/show.html.haml b/app/views/settings/preferences/show.html.haml index fdb5fea3f..babc57470 100644 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@ -46,9 +46,6 @@ = f.input :setting_boost_interval_from, collection: [1, 2, 3, 4, 5, 6, 10, 15, 30, 60, 120, 180, 300, 360, 720, 1440], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.boost_interval.#{item}")]) }, selected: current_user.boost_interval_from = f.input :setting_boost_interval_to, collection: [1, 2, 3, 4, 5, 6, 10, 15, 30, 60, 120, 180, 300, 360, 720, 1440], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.boost_interval.#{item}")]) }, selected: current_user.boost_interval_to - - - %hr#settings_other/ .fields-group @@ -70,6 +67,11 @@ %hr/ + .fields-group + = f.input :monsterfork_api, collection: [:vanilla, :basic, :full], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.monsterfork_api.#{item}")]) }, selected: current_user.monsterfork_api + + %hr/ + .fields-group = f.input :setting_hide_network, as: :boolean, wrapper: :with_label = f.input :setting_hide_interactions, as: :boolean, wrapper: :with_label -- cgit