1
0
mirror of https://github.com/funamitech/mastodon synced 2024-11-27 14:29:03 +09:00

Merge branch 'glitch-soc:main' into main

This commit is contained in:
Noa Himesaka 2023-04-08 21:20:58 +09:00 committed by GitHub
commit 20e02957d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 31 additions and 17 deletions

View File

@ -9,6 +9,5 @@
= stylesheet_pack_tag pack_path, media: 'all', crossorigin: 'anonymous'
- else
= stylesheet_pack_tag "skins/#{theme[:flavour]}/#{theme[:skin]}/#{theme[:pack]}", media: 'all', crossorigin: 'anonymous'
- if theme[:preload]
- theme[:preload].each do |link|
%link{ href: asset_pack_path("#{link}.js"), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/
- theme[:preload]&.each do |link|
%link{ href: asset_pack_path("#{link}.js"), crossorigin: 'anonymous', rel: 'preload', as: 'script' }/

View File

@ -39,7 +39,7 @@
= yield :header_tags
-# These must come after :header_tags to ensure our initial state has been defined.
-# These must come after :header_tags to ensure our initial state has been defined.
= render partial: 'layouts/theme', object: @core
= render partial: 'layouts/theme', object: @theme

View File

@ -12,7 +12,7 @@
%link{ rel: 'dns-prefetch', href: storage_host }/
= render_initial_state
= javascript_pack_tag "locales", crossorigin: 'anonymous'
= javascript_pack_tag 'locales', crossorigin: 'anonymous'
- if @theme
- if @theme[:supported_locales].include? I18n.locale.to_s
= javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", crossorigin: 'anonymous'

View File

@ -1,6 +1,6 @@
- content_for :header_tags do
= render_initial_state
= javascript_pack_tag "locales", crossorigin: 'anonymous'
= javascript_pack_tag 'locales', crossorigin: 'anonymous'
- if @theme
- if @theme[:supported_locales].include? I18n.locale.to_s
= javascript_pack_tag "locales/#{@theme[:flavour]}/#{I18n.locale}", crossorigin: 'anonymous'

View File

@ -5,7 +5,7 @@
= render 'shared/error_messages', object: current_user
- Themes.instance.flavour(@selected)['screenshot'].each do |screen|
%img.flavour-screen{ src: full_pack_url("media/#{screen}") }
%img.flavour-screen{ src: full_pack_url("media/#{screen}"), alt: '' }
.flavour-description
= t "flavours.#{@selected}.description", default: ''
@ -14,7 +14,7 @@
- if Themes.instance.skins_for(@selected).length > 1
.fields-group
= f.input :setting_skin, collection: Themes.instance.skins_for(@selected), label_method: lambda { |skin| I18n.t("skins.#{@selected}.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false
= f.input :setting_skin, collection: Themes.instance.skins_for(@selected), label_method: ->(skin) { I18n.t("skins.#{@selected}.#{skin}", default: skin) }, wrapper: :with_label, include_blank: false
.actions
= f.button :button, t('generic.use_this'), type: :submit

View File

@ -13,7 +13,7 @@ const { existsSync, readdirSync, writeFileSync } = require('fs');
const { join, resolve } = require('path');
const rimraf = require('rimraf');
const mkdirp = require('mkdirp');
const { flavours } = require('./configuration.js');
const { flavours } = require('./configuration');
module.exports = Object.keys(flavours).reduce(function (map, entry) {
const flavour = flavours[entry];
@ -43,13 +43,13 @@ module.exports = Object.keys(flavours).reduce(function (map, entry) {
// first try react-intl
`node_modules/react-intl/locale-data/${baseLocale}.js`,
// then check locales/locale-data
`app/javascript/locales/locale-data/${baseLocale}.js`,
`app/javascript/mastodon/locales/locale-data/${baseLocale}.js`,
// fall back to English (this is what react-intl does anyway)
'node_modules/react-intl/locale-data/en.js',
].filter(
filename => existsSync(filename)
filename => existsSync(filename),
).map(
filename => filename.replace(/(?:node_modules|app\/javascript)\//, '')
filename => filename.replace(/(?:node_modules|app\/javascript)\//, ''),
)[0];
const localeContent = `//
// locales/${entry}/${locale}.js

View File

@ -1,5 +1,15 @@
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
class AddHideNotificationsToMute < ActiveRecord::Migration[5.1]
def change
add_column :mutes, :hide_notifications, :boolean, default: false, null: false
include Mastodon::MigrationHelpers
disable_ddl_transaction!
def up
add_column_with_default :mutes, :hide_notifications, :boolean, default: true, allow_null: false
end
def down
remove_column :mutes, :hide_notifications
end
end

View File

@ -1,8 +1,13 @@
# frozen_string_literal: true
# This migration is glitch-soc-only because mutes were originally developed in
# glitch-soc and the default value changed when submitting the code upstream.
# This migration originally changed existing values to `true`, but this has
# been dropped as to not cause issues when migrating from upstream.
class DefaultExistingMutesToHidingNotifications < ActiveRecord::Migration[5.1]
def up
change_column_default :mutes, :hide_notifications, from: false, to: true
# Unfortunately if this is applied sometime after the one to add the table we lose some data, so this is irreversible.
Mute.update_all(hide_notifications: true)
end
end