Browse Source

Display customized mascot in web UI and fix admin form for it (#8964)

Follow-up to #8766
pull/4/head
Eugen Rochko 5 years ago
committed by GitHub
parent
commit
9d4541c612
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 1 deletions
  1. +2
    -1
      app/javascript/mastodon/features/compose/index.js
  2. +1
    -0
      app/javascript/mastodon/initial_state.js
  3. +7
    -0
      app/serializers/initial_state_serializer.rb
  4. +2
    -0
      app/views/admin/settings/edit.html.haml

+ 2
- 1
app/javascript/mastodon/features/compose/index.js View File

@ -13,6 +13,7 @@ import spring from 'react-motion/lib/spring';
import SearchResultsContainer from './containers/search_results_container';
import { changeComposing } from '../../actions/compose';
import elephantUIPlane from '../../../images/elephant_ui_plane.svg';
import { mascot } from '../../initial_state';
const messages = defineMessages({
start: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
@ -107,7 +108,7 @@ class Compose extends React.PureComponent {
<ComposeFormContainer />
{multiColumn && (
<div className='drawer__inner__mastodon'>
<img alt='' draggable='false' src={elephantUIPlane} />
<img alt='' draggable='false' src={mascot || elephantUIPlane} />
</div>
)}
</div>}

+ 1
- 0
app/javascript/mastodon/initial_state.js View File

@ -14,5 +14,6 @@ export const me = getMeta('me');
export const searchEnabled = getMeta('search_enabled');
export const invitesEnabled = getMeta('invites_enabled');
export const version = getMeta('version');
export const mascot = getMeta('mascot');
export default initialState;

+ 7
- 0
app/serializers/initial_state_serializer.rb View File

@ -16,6 +16,7 @@ class InitialStateSerializer < ActiveModel::Serializer
search_enabled: Chewy.enabled?,
version: Mastodon::Version.to_s,
invites_enabled: Setting.min_invite_role == 'user',
mascot: instance_presenter.mascot&.file&.url,
}
if object.current_account
@ -56,4 +57,10 @@ class InitialStateSerializer < ActiveModel::Serializer
def media_attachments
{ accept_content_types: MediaAttachment::IMAGE_FILE_EXTENSIONS + MediaAttachment::VIDEO_FILE_EXTENSIONS + MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES }
end
private
def instance_presenter
@instance_presenter ||= InstancePresenter.new
end
end

+ 2
- 0
app/views/admin/settings/edit.html.haml View File

@ -26,6 +26,8 @@
= f.input :thumbnail, as: :file, wrapper: :with_block_label, label: t('admin.settings.thumbnail.title'), hint: t('admin.settings.thumbnail.desc_html')
.fields-row__column.fields-row__column-6.fields-group
= f.input :hero, as: :file, wrapper: :with_block_label, label: t('admin.settings.hero.title'), hint: t('admin.settings.hero.desc_html')
.fields-row
.fields-row__column.fields-row__column-6.fields-group
= f.input :mascot, as: :file, wrapper: :with_block_label, label: t('admin.settings.mascot.title'), hint: t('admin.settings.mascot.desc_html')

Loading…
Cancel
Save