From: Thibaut Girka Date: Sun, 9 Dec 2018 12:28:09 +0000 (+0100) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=e7f1bfdc2d528f137299ba0c3ab2a30f2f91f53c;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts: - app/javascript/packs/public.js - app/models/user.rb - config/settings.yml - db/schema.rb Moved public.js changes to settings.js. --- e7f1bfdc2d528f137299ba0c3ab2a30f2f91f53c diff --cc app/controllers/settings/preferences_controller.rb index 5c5f31d2b,70e71b4a2..b70844b65 --- a/app/controllers/settings/preferences_controller.rb +++ b/app/controllers/settings/preferences_controller.rb @@@ -42,7 -46,9 +42,8 @@@ class Settings::PreferencesController :setting_reduce_motion, :setting_system_font_ui, :setting_noindex, - :setting_theme, :setting_hide_network, + :setting_aggregate_reblogs, notification_emails: %i(follow follow_request reblog favourite mention digest report), interactions: %i(must_be_follower must_be_following) ) diff --cc app/javascript/core/settings.js index 23a303747,000000000..af97fb25f mode 100644,000000..100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@@ -1,62 -1,0 +1,66 @@@ +// This file will be loaded on settings pages, regardless of theme. + ++import escapeTextContentForBrowser from 'escape-html'; +const { delegate } = require('rails-ujs'); +import emojify from '../mastodon/features/emoji/emoji'; + +delegate(document, '#account_display_name', 'input', ({ target }) => { + const name = document.querySelector('.card .display-name strong'); - + if (name) { - name.innerHTML = emojify(target.value); ++ if (target.value) { ++ name.innerHTML = emojify(escapeTextContentForBrowser(target.value)); ++ } else { ++ name.textContent = document.querySelector('#default_account_display_name').textContent; ++ } + } +}); + +delegate(document, '#account_avatar', 'change', ({ target }) => { + const avatar = document.querySelector('.card .avatar img'); + const [file] = target.files || []; + const url = file ? URL.createObjectURL(file) : avatar.dataset.originalSrc; + + avatar.src = url; +}); + +delegate(document, '#account_header', 'change', ({ target }) => { + const header = document.querySelector('.card .card__img img'); + const [file] = target.files || []; + const url = file ? URL.createObjectURL(file) : header.dataset.originalSrc; + + header.src = url; +}); + +delegate(document, '#account_locked', 'change', ({ target }) => { + const lock = document.querySelector('.card .display-name i'); + + if (target.checked) { + lock.style.display = 'inline'; + } else { + lock.style.display = 'none'; + } +}); + +delegate(document, '.input-copy input', 'click', ({ target }) => { + target.select(); +}); + +delegate(document, '.input-copy button', 'click', ({ target }) => { + const input = target.parentNode.querySelector('.input-copy__wrapper input'); + + input.focus(); + input.select(); + + try { + if (document.execCommand('copy')) { + input.blur(); + target.parentNode.classList.add('copied'); + + setTimeout(() => { + target.parentNode.classList.remove('copied'); + }, 700); + } + } catch (err) { + console.error(err); + } +}); diff --cc app/lib/feed_manager.rb index 0cdb178c1,f99df33e5..a1b186f1c --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@@ -42,11 -42,10 +42,11 @@@ class FeedManage def push_to_list(list, status) if status.reply? && status.in_reply_to_account_id != status.account_id should_filter = status.in_reply_to_account_id != list.account_id - should_filter &&= !ListAccount.where(list_id: list.id, account_id: status.in_reply_to_account_id).exists? + should_filter &&= !list.show_all_replies? + should_filter &&= !(list.show_list_replies? && ListAccount.where(list_id: list.id, account_id: status.in_reply_to_account_id).exists?) return false if should_filter end - return false unless add_to_feed(:list, list.id, status) + return false unless add_to_feed(:list, list.id, status, list.account.user&.aggregates_reblogs?) trim(:list, list.id) PushUpdateWorker.perform_async(list.account_id, status.id, "timeline:list:#{list.id}") if push_update_required?("timeline:list:#{list.id}") true diff --cc app/lib/user_settings_decorator.rb index e5b168502,19b854410..559e00d20 --- a/app/lib/user_settings_decorator.rb +++ b/app/lib/user_settings_decorator.rb @@@ -30,9 -29,9 +30,10 @@@ class UserSettingsDecorato user.settings['reduce_motion'] = reduce_motion_preference if change?('setting_reduce_motion') user.settings['system_font_ui'] = system_font_ui_preference if change?('setting_system_font_ui') user.settings['noindex'] = noindex_preference if change?('setting_noindex') - user.settings['theme'] = theme_preference if change?('setting_theme') + user.settings['flavour'] = flavour_preference if change?('setting_flavour') + user.settings['skin'] = skin_preference if change?('setting_skin') user.settings['hide_network'] = hide_network_preference if change?('setting_hide_network') + user.settings['aggregate_reblogs'] = aggregate_reblogs_preference if change?('setting_aggregate_reblogs') end def merged_notification_emails diff --cc app/models/user.rb index 704523d34,f4130d7b1..5a21419bf --- a/app/models/user.rb +++ b/app/models/user.rb @@@ -93,9 -93,9 +93,9 @@@ class User < ApplicationRecor has_many :session_activations, dependent: :destroy - delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :delete_modal, - :reduce_motion, :system_font_ui, :noindex, :theme, :display_media, :hide_network, + delegate :auto_play_gif, :default_sensitive, :unfollow_modal, :boost_modal, :favourite_modal, :delete_modal, + :reduce_motion, :system_font_ui, :noindex, :flavour, :skin, :display_media, :hide_network, - :expand_spoilers, :default_language, to: :settings, prefix: :setting, allow_nil: false + :expand_spoilers, :default_language, :aggregate_reblogs, to: :settings, prefix: :setting, allow_nil: false attr_reader :invite_code diff --cc app/views/settings/preferences/show.html.haml index 45f9fd178,a2c61c9a6..53390b6d1 --- a/app/views/settings/preferences/show.html.haml +++ b/app/views/settings/preferences/show.html.haml @@@ -39,12 -39,19 +39,15 @@@ .fields-group = f.input :setting_unfollow_modal, as: :boolean, wrapper: :with_label = f.input :setting_boost_modal, as: :boolean, wrapper: :with_label + = f.input :setting_favourite_modal, as: :boolean, wrapper: :with_label = f.input :setting_delete_modal, as: :boolean, wrapper: :with_label + .fields-group + = f.input :setting_aggregate_reblogs, as: :boolean, wrapper: :with_label + .fields-group = f.input :setting_auto_play_gif, as: :boolean, wrapper: :with_label + = f.input :setting_display_media, collection: ['default', 'show_all', 'hide_all'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_display_media_#{item}"), content_tag(:span, t("simple_form.hints.defaults.setting_display_media_#{item}"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li' = f.input :setting_expand_spoilers, as: :boolean, wrapper: :with_label = f.input :setting_reduce_motion, as: :boolean, wrapper: :with_label = f.input :setting_system_font_ui, as: :boolean, wrapper: :with_label diff --cc config/routes.rb index 446aad58b,262868413..6b33d8baf --- a/config/routes.rb +++ b/config/routes.rb @@@ -80,9 -80,13 +80,14 @@@ Rails.application.routes.draw d get '/interact/:id', to: 'remote_interaction#new', as: :remote_interaction post '/interact/:id', to: 'remote_interaction#create' + get '/explore', to: 'directories#index', as: :explore + get '/explore/popular', to: 'directories#index', as: :explore_popular + get '/explore/:id', to: 'directories#show', as: :explore_hashtag + get '/explore/:id/popular', to: 'directories#show', as: :explore_hashtag_popular + namespace :settings do resource :profile, only: [:show, :update] + resource :preferences, only: [:show, :update] resource :notifications, only: [:show, :update] resource :import, only: [:show, :create] diff --cc config/settings.yml index 48639e9a8,4036d419f..bfccd2cc7 --- a/config/settings.yml +++ b/config/settings.yml @@@ -33,8 -32,8 +33,9 @@@ defaults: &default reduce_motion: false system_font_ui: false noindex: false - theme: 'default' + flavour: 'glitch' + skin: 'default' + aggregate_reblogs: true notification_emails: follow: false reblog: false