From: Thibaut Girka Date: Mon, 22 Apr 2019 18:40:04 +0000 (+0200) Subject: Merge branch 'master' into glitch-soc/merge-upstream X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=a9eaa780f56d9b10cc7ae9e8134a612cbc96b4f8;p=mastodon.git Merge branch 'master' into glitch-soc/merge-upstream Conflicts: - app/javascript/mastodon/features/compose/components/compose_form.js Upstream cleaned up a bit, including on lines in which we replaced the hardcoded 500 character limit with a maxChar constant. Applied the changes while keeping maxChar instead of 500. - app/javascript/packs/public.js Moved upstream's new animated avatar hover handling in app/javascript/core/public.js - app/javascript/styles/fonts/montserrat.scss Upstream fixed local font name, applied those changes. - app/javascript/styles/fonts/roboto.scss Upstream fixed local font name, applied those changes. - lib/mastodon/version.rb Upstream made repo URL configurable, did the same, but default to glitch-soc --- a9eaa780f56d9b10cc7ae9e8134a612cbc96b4f8 diff --cc app/javascript/core/public.js index f00709dad,000000000..4be75647a mode 100644,000000..100644 --- a/app/javascript/core/public.js +++ b/app/javascript/core/public.js @@@ -1,43 -1,0 +1,66 @@@ +// This file will be loaded on public pages, regardless of theme. + +import createHistory from 'history/createBrowserHistory'; +import ready from '../mastodon/ready'; + +const { delegate } = require('rails-ujs'); +const { length } = require('stringz'); + +delegate(document, '.webapp-btn', 'click', ({ target, button }) => { + if (button !== 0) { + return true; + } + window.location.href = target.href; + return false; +}); + +delegate(document, '.status__content__spoiler-link', 'click', ({ target }) => { + const contentEl = target.parentNode.parentNode.querySelector('.e-content'); + + if (contentEl.style.display === 'block') { + contentEl.style.display = 'none'; + target.parentNode.style.marginBottom = 0; + } else { + contentEl.style.display = 'block'; + target.parentNode.style.marginBottom = null; + } + + return false; +}); + +delegate(document, '.modal-button', 'click', e => { + e.preventDefault(); + + let href; + + if (e.target.nodeName !== 'A') { + href = e.target.parentNode.href; + } else { + href = e.target.href; + } + + window.open(href, 'mastodon-intent', 'width=445,height=600,resizable=no,menubar=no,status=no,scrollbars=yes'); +}); ++ ++const getProfileAvatarAnimationHandler = (swapTo) => { ++ //animate avatar gifs on the profile page when moused over ++ return ({ target }) => { ++ const swapSrc = target.getAttribute(swapTo); ++ //only change the img source if autoplay is off and the image src is actually different ++ if(target.getAttribute('data-autoplay') === 'false' && target.src !== swapSrc) { ++ target.src = swapSrc; ++ } ++ }; ++}; ++ ++delegate(document, 'img#profile_page_avatar', 'mouseover', getProfileAvatarAnimationHandler('data-original')); ++ ++delegate(document, 'img#profile_page_avatar', 'mouseout', getProfileAvatarAnimationHandler('data-static')); ++ ++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; ++}); diff --cc app/javascript/mastodon/features/compose/components/compose_form.js index d47b788ce,ddb610a89..13514fa0f --- a/app/javascript/mastodon/features/compose/components/compose_form.js +++ b/app/javascript/mastodon/features/compose/components/compose_form.js @@@ -86,10 -84,10 +85,10 @@@ class ComposeForm extends ImmutablePure } // Submit disabled: - const { is_submitting, is_changing_upload, is_uploading, anyMedia } = this.props; - const fulltext = [this.props.spoiler_text, countableText(this.props.text)].join(''); + const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; + const fulltext = [this.props.spoilerText, countableText(this.props.text)].join(''); - if (is_submitting || is_uploading || is_changing_upload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { - if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { ++ if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { return; } @@@ -163,9 -161,9 +162,9 @@@ render () { const { intl, onPaste, showSearch, anyMedia } = this.props; - const disabled = this.props.is_submitting; - const text = [this.props.spoiler_text, countableText(this.props.text)].join(''); - const disabledButton = disabled || this.props.is_uploading || this.props.is_changing_upload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia); + const disabled = this.props.isSubmitting; + const text = [this.props.spoilerText, countableText(this.props.text)].join(''); - const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia); ++ const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > maxChars || (text.length !== 0 && text.trim().length === 0 && !anyMedia); let publishText = ''; if (this.props.privacy === 'private' || this.props.privacy === 'direct') { diff --cc app/javascript/mastodon/initial_state.js index 6068246ae,74bcfee58..d74f5ceb1 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@@ -12,8 -12,9 +12,10 @@@ export const boostModal = getMeta('boos export const deleteModal = getMeta('delete_modal'); export const me = getMeta('me'); export const searchEnabled = getMeta('search_enabled'); +export const maxChars = (initialState && initialState.max_toot_chars) || 500; export const invitesEnabled = getMeta('invites_enabled'); + export const repository = getMeta('repository'); + export const source_url = getMeta('source_url'); export const version = getMeta('version'); export const mascot = getMeta('mascot'); export const profile_directory = getMeta('profile_directory'); diff --cc app/javascript/styles/fonts/montserrat.scss index 3d2b5a93f,8079dc6fc..80c2329b0 --- a/app/javascript/styles/fonts/montserrat.scss +++ b/app/javascript/styles/fonts/montserrat.scss @@@ -10,8 -10,8 +10,8 @@@ @font-face { font-family: 'mastodon-font-display'; - src: local('Montserrat'), + src: local('Montserrat Medium'), - url('../fonts/montserrat/Montserrat-Medium.ttf') format('truetype'); + url('~fonts/montserrat/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; } diff --cc app/javascript/styles/fonts/roboto.scss index 79034c018,f9c7c50fe..b75fdb927 --- a/app/javascript/styles/fonts/roboto.scss +++ b/app/javascript/styles/fonts/roboto.scss @@@ -1,32 -1,32 +1,32 @@@ @font-face { font-family: 'mastodon-font-sans-serif'; - src: local('Roboto'), + src: local('Roboto Italic'), - url('../fonts/roboto/roboto-italic-webfont.woff2') format('woff2'), - url('../fonts/roboto/roboto-italic-webfont.woff') format('woff'), - url('../fonts/roboto/roboto-italic-webfont.ttf') format('truetype'), - url('../fonts/roboto/roboto-italic-webfont.svg#roboto-italic-webfont') format('svg'); + url('~fonts/roboto/roboto-italic-webfont.woff2') format('woff2'), + url('~fonts/roboto/roboto-italic-webfont.woff') format('woff'), + url('~fonts/roboto/roboto-italic-webfont.ttf') format('truetype'), + url('~fonts/roboto/roboto-italic-webfont.svg#roboto-italic-webfont') format('svg'); font-weight: normal; font-style: italic; } @font-face { font-family: 'mastodon-font-sans-serif'; - src: local('Roboto'), + src: local('Roboto Bold'), - url('../fonts/roboto/roboto-bold-webfont.woff2') format('woff2'), - url('../fonts/roboto/roboto-bold-webfont.woff') format('woff'), - url('../fonts/roboto/roboto-bold-webfont.ttf') format('truetype'), - url('../fonts/roboto/roboto-bold-webfont.svg#roboto-bold-webfont') format('svg'); + url('~fonts/roboto/roboto-bold-webfont.woff2') format('woff2'), + url('~fonts/roboto/roboto-bold-webfont.woff') format('woff'), + url('~fonts/roboto/roboto-bold-webfont.ttf') format('truetype'), + url('~fonts/roboto/roboto-bold-webfont.svg#roboto-bold-webfont') format('svg'); font-weight: bold; font-style: normal; } @font-face { font-family: 'mastodon-font-sans-serif'; - src: local('Roboto'), + src: local('Roboto Medium'), - url('../fonts/roboto/roboto-medium-webfont.woff2') format('woff2'), - url('../fonts/roboto/roboto-medium-webfont.woff') format('woff'), - url('../fonts/roboto/roboto-medium-webfont.ttf') format('truetype'), - url('../fonts/roboto/roboto-medium-webfont.svg#roboto-medium-webfont') format('svg'); + url('~fonts/roboto/roboto-medium-webfont.woff2') format('woff2'), + url('~fonts/roboto/roboto-medium-webfont.woff') format('woff'), + url('~fonts/roboto/roboto-medium-webfont.ttf') format('truetype'), + url('~fonts/roboto/roboto-medium-webfont.svg#roboto-medium-webfont') format('svg'); font-weight: 500; font-style: normal; } diff --cc lib/mastodon/version.rb index 5d1b8e6d9,a656031b1..8172aeb94 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@@ -37,7 -33,7 +37,7 @@@ module Mastodo end def repository - 'glitch-soc/mastodon' - ENV.fetch('GITHUB_REPOSITORY') { 'tootsuite/mastodon' } ++ ENV.fetch('GITHUB_REPOSITORY') { 'glitch-soc/mastodon' } end def source_base_url