Merge changes from upstream with the CSS reload fix

This commit is contained in:
Ondřej Hruška
2017-07-18 18:58:47 +02:00
98 changed files with 1376 additions and 582 deletions

View File

@ -186,6 +186,12 @@ export default class MediaGallery extends React.PureComponent {
visible: !this.props.sensitive,
};
componentWillReceiveProps (nextProps) {
if (nextProps.sensitive !== this.props.sensitive) {
this.setState({ visible: !nextProps.sensitive });
}
}
handleOpen = () => {
this.setState({ visible: !this.state.visible });
}

View File

@ -1,4 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { makeGetAccount } from '../selectors';
import Account from '../components/account';
import {
@ -9,6 +11,11 @@ import {
muteAccount,
unmuteAccount,
} from '../actions/accounts';
import { openModal } from '../actions/modal';
const messages = defineMessages({
unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
});
const makeMapStateToProps = () => {
const getAccount = makeGetAccount();
@ -16,15 +23,25 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, props) => ({
account: getAccount(state, props.id),
me: state.getIn(['meta', 'me']),
unfollowModal: state.getIn(['meta', 'unfollow_modal']),
});
return mapStateToProps;
};
const mapDispatchToProps = (dispatch) => ({
const mapDispatchToProps = (dispatch, { intl }) => ({
onFollow (account) {
if (account.getIn(['relationship', 'following'])) {
dispatch(unfollowAccount(account.get('id')));
if (this.unfollowModal) {
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.unfollowConfirm),
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else {
dispatch(followAccount(account.get('id')));
}
@ -45,6 +62,7 @@ const mapDispatchToProps = (dispatch) => ({
dispatch(muteAccount(account.get('id')));
}
},
});
export default connect(makeMapStateToProps, mapDispatchToProps)(Account);
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Account));

View File

@ -17,6 +17,7 @@ import { blockDomain, unblockDomain } from '../../../actions/domain_blocks';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
const messages = defineMessages({
unfollowConfirm: { id: 'confirmations.unfollow.confirm', defaultMessage: 'Unfollow' },
blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
muteConfirm: { id: 'confirmations.mute.confirm', defaultMessage: 'Mute' },
blockDomainConfirm: { id: 'confirmations.domain_block.confirm', defaultMessage: 'Hide entire domain' },
@ -28,15 +29,25 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, { accountId }) => ({
account: getAccount(state, Number(accountId)),
me: state.getIn(['meta', 'me']),
unfollowModal: state.getIn(['meta', 'unfollow_modal']),
});
return mapStateToProps;
};
const mapDispatchToProps = (dispatch, { intl }) => ({
onFollow (account) {
if (account.getIn(['relationship', 'following'])) {
dispatch(unfollowAccount(account.get('id')));
if (this.unfollowModal) {
dispatch(openModal('CONFIRM', {
message: <FormattedMessage id='confirmations.unfollow.message' defaultMessage='Are you sure you want to unfollow {name}?' values={{ name: <strong>@{account.get('acct')}</strong> }} />,
confirm: intl.formatMessage(messages.unfollowConfirm),
onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else {
dispatch(followAccount(account.get('id')));
}
@ -85,6 +96,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onUnblockDomain (domain, accountId) {
dispatch(unblockDomain(domain, accountId));
},
});
export default injectIntl(connect(makeMapStateToProps, mapDispatchToProps)(Header));

View File

@ -87,7 +87,7 @@ export default class ModalRoot extends React.PureComponent {
>
{interpolatedStyles =>
<div className='modal-root'>
{interpolatedStyles.map(({ key, data: { type }, style }) => (
{interpolatedStyles.map(({ key, data: { type, props }, style }) => (
<div key={key} style={{ pointerEvents: visible ? 'auto' : 'none' }}>
<div role='presentation' className='modal-root__overlay' style={{ opacity: style.opacity }} onClick={onClose} />
<div className='modal-root__container' style={{ opacity: style.opacity, transform: `translateZ(0px) scale(${style.scale})` }}>

View File

@ -10,31 +10,36 @@ const makeGetStatusIds = () => createSelector([
(state, { type }) => state.getIn(['timelines', type, 'items'], ImmutableList()),
(state) => state.get('statuses'),
(state) => state.getIn(['meta', 'me']),
], (columnSettings, statusIds, statuses, me) => statusIds.filter(id => {
const statusForId = statuses.get(id);
let showStatus = true;
], (columnSettings, statusIds, statuses, me) => {
const rawRegex = columnSettings.getIn(['regex', 'body'], '').trim();
let regex = null;
if (columnSettings.getIn(['shows', 'reblog']) === false) {
showStatus = showStatus && statusForId.get('reblog') === null;
try {
regex = rawRegex && new RegExp(rawRegex, 'i');
} catch (e) {
// Bad regex, don't affect filters
}
if (columnSettings.getIn(['shows', 'reply']) === false) {
showStatus = showStatus && (statusForId.get('in_reply_to_id') === null || statusForId.get('in_reply_to_account_id') === me);
}
return statusIds.filter(id => {
const statusForId = statuses.get(id);
let showStatus = true;
if (columnSettings.getIn(['regex', 'body'], '').trim().length > 0) {
try {
if (showStatus) {
const regex = new RegExp(columnSettings.getIn(['regex', 'body']).trim(), 'i');
showStatus = !regex.test(statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index'));
}
} catch(e) {
// Bad regex, don't affect filters
if (columnSettings.getIn(['shows', 'reblog']) === false) {
showStatus = showStatus && statusForId.get('reblog') === null;
}
}
return showStatus;
}));
if (columnSettings.getIn(['shows', 'reply']) === false) {
showStatus = showStatus && (statusForId.get('in_reply_to_id') === null || statusForId.get('in_reply_to_account_id') === me);
}
if (showStatus && regex && statusForId.get('account') !== me) {
const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index');
showStatus = !regex.test(searchIndex);
}
return showStatus;
});
});
const makeMapStateToProps = () => {
const getStatusIds = makeGetStatusIds();

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "أكتم",
"confirmations.mute.message": "هل أنت متأكد أنك تريد كتم {name} ؟",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "الأنشطة",
"emoji_button.flags": "الأعلام",
"emoji_button.food": "الطعام والشراب",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Estàs realment, realment segur que vols bloquejar totalment {domain}? En la majoria dels casos bloquejar o silenciar és suficient i preferible.",
"confirmations.mute.confirm": "Silenciar",
"confirmations.mute.message": "Estàs segur que vols silenciar {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activitat",
"emoji_button.flags": "Flags",
"emoji_button.food": "Menjar i Beure",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -228,6 +228,19 @@
],
"path": "app/javascript/mastodon/components/video_player.json"
},
{
"descriptors": [
{
"defaultMessage": "Unfollow",
"id": "confirmations.unfollow.confirm"
},
{
"defaultMessage": "Are you sure you want to unfollow {name}?",
"id": "confirmations.unfollow.message"
}
],
"path": "app/javascript/mastodon/containers/account_container.json"
},
{
"descriptors": [
{
@ -268,6 +281,10 @@
},
{
"descriptors": [
{
"defaultMessage": "Unfollow",
"id": "confirmations.unfollow.confirm"
},
{
"defaultMessage": "Block",
"id": "confirmations.block.confirm"
@ -280,6 +297,10 @@
"defaultMessage": "Hide entire domain",
"id": "confirmations.domain_block.confirm"
},
{
"defaultMessage": "Are you sure you want to unfollow {name}?",
"id": "confirmations.unfollow.message"
},
{
"defaultMessage": "Are you sure you want to block {name}?",
"id": "confirmations.block.message"

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "آیا جدی جدی می‌خواهید کل دامین {domain} را مسدود کنید؟ بیشتر وقت‌ها مسدودکردن یا بی‌صداکردن چند حساب کاربری خاص کافی است و توصیه می‌شود.",
"confirmations.mute.confirm": "بی‌صدا کن",
"confirmations.mute.message": "آیا واقعاً می‌خواهید {name} را بی‌صدا کنید؟",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "فعالیت",
"emoji_button.flags": "پرچم‌ها",
"emoji_button.food": "غذا و نوشیدنی",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Êtes-vous vraiment, vraiment sûr⋅e de vouloir bloquer {domain} en entier? Dans la plupart des cas, quelques blocages ou masquages ciblés sont suffisants et préférables.",
"confirmations.mute.confirm": "Masquer",
"confirmations.mute.message": "Confirmez vous le masquage de {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activités",
"emoji_button.flags": "Drapeaux",
"emoji_button.food": "Boire et manger",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "באמת באמת לחסום את כל קהילת {domain}? ברב המקרים השתקות נבחרות של מספר משתמשים מסויימים צריכה להספיק.",
"confirmations.mute.confirm": "להשתיק",
"confirmations.mute.message": "להשתיק את {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "פעילות",
"emoji_button.flags": "דגלים",
"emoji_button.food": "אוכל ושתיה",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Jesi li zaista, zaista siguran da želiš blokirati sve sa {domain}? U većini slučajeva nekoliko ciljanih blokiranja ili utišavanja je dostatno i poželjnije.",
"confirmations.mute.confirm": "Utišaj",
"confirmations.mute.message": "Jesi li siguran da želiš utišati {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Aktivnost",
"emoji_button.flags": "Zastave",
"emoji_button.food": "Hrana & Piće",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Bisukan",
"confirmations.mute.message": "Apa anda yakin ingin membisukan {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Aktivitas",
"emoji_button.flags": "Bendera",
"emoji_button.food": "Makanan & Minuman",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "本当に{domain}全体を非表示にしますか? 多くの場合は個別にブロックやミュートするだけで充分であり、また好ましいです。",
"confirmations.mute.confirm": "ミュート",
"confirmations.mute.message": "本当に{name}をミュートしますか?",
"confirmations.unfollow.confirm": "フォロー解除",
"confirmations.unfollow.message": "本当に{name}のフォローを解除しますか?",
"emoji_button.activity": "活動",
"emoji_button.flags": "国旗",
"emoji_button.food": "食べ物",
@ -149,7 +151,7 @@
"report.target": "問題のユーザー",
"search.placeholder": "検索",
"search_results.total": "{count, number}件の結果",
"standalone.public_title": "A look inside...",
"standalone.public_title": "連合タイムライン",
"status.cannot_reblog": "この投稿はブーストできません",
"status.delete": "削除",
"status.favourite": "お気に入り",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "정말로 {domain} 전체를 숨기시겠습니까? 대부분의 경우 개별 차단이나 뮤트로 충분합니다.",
"confirmations.mute.confirm": "뮤트",
"confirmations.mute.message": "정말로 {name}를 뮤트하시겠습니까?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "활동",
"emoji_button.flags": "국기",
"emoji_button.food": "음식",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Weet je het echt, echt zeker dat je alles van {domain} wil negeren? In de meeste gevallen is het blokkeren of negeren van een paar specifieke personen voldoende en gewenst.",
"confirmations.mute.confirm": "Negeren",
"confirmations.mute.message": "Weet je zeker dat je {name} wilt negeren?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activiteiten",
"emoji_button.flags": "Vlaggen",
"emoji_button.food": "Eten en drinken",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Er du sikker på at du vil skjule hele domenet {domain}? I de fleste tilfeller er det bedre med målrettet blokkering eller demping.",
"confirmations.mute.confirm": "Demp",
"confirmations.mute.message": "Er du sikker på at du vil dempe {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Aktivitet",
"emoji_button.flags": "Flagg",
"emoji_button.food": "Mat og drikke",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Sètz segur segur de voler blocar complètament {domain} ? De còps cal pas que blocar o rescondre unas personas solament.",
"confirmations.mute.confirm": "Metre en silenci",
"confirmations.mute.message": "Sètz segur de voler metre en silenci {name} ?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activitat",
"emoji_button.flags": "Drapèus",
"emoji_button.food": "Beure e manjar",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Czy na pewno chcesz zablokować całą domenę {domain}? Zwykle lepszym rozwiązaniem jest blokada lub wyciszenie kilku użytkowników.",
"confirmations.mute.confirm": "Wycisz",
"confirmations.mute.message": "Czy na pewno chcesz wyciszyć {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Aktywność",
"emoji_button.flags": "Flagi",
"emoji_button.food": "Żywność i napoje",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Вы на самом деле уверены, что хотите блокировать весь {domain}? В большинстве случаев нескольких отдельных блокировок или глушений достаточно.",
"confirmations.mute.confirm": "Заглушить",
"confirmations.mute.message": "Вы уверены, что хотите заглушить {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Занятия",
"emoji_button.flags": "Флаги",
"emoji_button.food": "Еда и напитки",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Mute",
"confirmations.mute.message": "Are you sure you want to mute {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Activity",
"emoji_button.flags": "Flags",
"emoji_button.food": "Food & Drink",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "Sessize al",
"confirmations.mute.message": "{name} kullanıcısını sessize almak istiyor musunuz?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Aktivite",
"emoji_button.flags": "Bayraklar",
"emoji_button.food": "Yiyecek ve İçecek",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Ви точно, точно впевнені, що хочете заблокувати весь домен {domain}? У більшості випадків для нормальної роботи краще заблокувати/заглушити лише деяких користувачів.",
"confirmations.mute.confirm": "Заглушити",
"confirmations.mute.message": "Ви впевнені, що хочете заглушити {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "Заняття",
"emoji_button.flags": "Прапори",
"emoji_button.food": "Їжа та напої",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "静音",
"confirmations.mute.message": "想好了,真的要静音 {name}?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "活动",
"emoji_button.flags": "旗帜",
"emoji_button.food": "食物和饮料",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "Are you really, really sure you want to block the entire {domain}? In most cases a few targeted blocks or mutes are sufficient and preferable.",
"confirmations.mute.confirm": "靜音",
"confirmations.mute.message": "你確定要將{name}靜音嗎?",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "活動",
"emoji_button.flags": "旗幟",
"emoji_button.food": "飲飲食食",

View File

@ -55,6 +55,8 @@
"confirmations.domain_block.message": "你真的真的確定要封鎖整個 {domain} ?多數情況下,比較推薦封鎖或消音幾個特定目標就好。",
"confirmations.mute.confirm": "消音",
"confirmations.mute.message": "你確定要消音 {name} ",
"confirmations.unfollow.confirm": "Unfollow",
"confirmations.unfollow.message": "Are you sure you want to unfollow {name}?",
"emoji_button.activity": "活動",
"emoji_button.flags": "旗幟",
"emoji_button.food": "食物與飲料",

View File

@ -1,12 +1,14 @@
import * as OfflinePluginRuntime from 'offline-plugin/runtime';
import * as WebPushSubscription from './web_push_subscription';
import Mastodon from 'mastodon/containers/mastodon';
import React from 'react';
import ReactDOM from 'react-dom';
import ready from './ready';
const perf = require('./performance');
function main() {
perf.start('main()');
const Mastodon = require('mastodon/containers/mastodon').default;
const React = require('react');
const ReactDOM = require('react-dom');
if (window.history && history.replaceState) {
const { pathname, search, hash } = window.location;
@ -23,9 +25,6 @@ function main() {
ReactDOM.render(<Mastodon {...props} />, mountNode);
if (process.env.NODE_ENV === 'production') {
// avoid offline in dev mode because it's harder to debug
const OfflinePluginRuntime = require('offline-plugin/runtime');
const WebPushSubscription = require('./web_push_subscription');
OfflinePluginRuntime.install();
WebPushSubscription.register();
}

View File

@ -1 +1,10 @@
import './web_push_notifications';
// Cause a new version of a registered Service Worker to replace an existing one
// that is already installed, and replace the currently active worker on open pages.
self.addEventListener('install', function(event) {
event.waitUntil(self.skipWaiting());
});
self.addEventListener('activate', function(event) {
event.waitUntil(self.clients.claim());
});

View File

@ -50,6 +50,24 @@ const makeRequest = (notification, action) =>
credentials: 'include',
});
const openUrl = url =>
self.clients.matchAll({ type: 'window' }).then(clientList => {
if (clientList.length !== 0 && 'navigate' in clientList[0]) { // Chrome 42-48 does not support navigate
const webClients = clientList
.filter(client => /\/web\//.test(client.url))
.sort(client => client !== 'visible');
const visibleClient = clientList.find(client => client.visibilityState === 'visible');
const focusedClient = clientList.find(client => client.focused);
const client = webClients[0] || visibleClient || focusedClient || clientList[0];
return client.navigate(url).then(client => client.focus());
} else {
return self.clients.openWindow(url);
}
});
const removeActionFromNotification = (notification, action) => {
const actions = notification.actions.filter(act => act.action !== action.action);
@ -75,7 +93,7 @@ const handleNotificationClick = (event) => {
}
} else {
event.notification.close();
resolve(self.clients.openWindow(event.notification.data.url));
resolve(openUrl(event.notification.data.url));
}
});

View File

@ -1,12 +1,11 @@
import TimelineContainer from '../mastodon/containers/timeline_container';
import React from 'react';
import ReactDOM from 'react-dom';
import loadPolyfills from '../mastodon/load_polyfills';
import ready from '../mastodon/ready';
require.context('../images/', true);
function loaded() {
const TimelineContainer = require('../mastodon/containers/timeline_container').default;
const React = require('react');
const ReactDOM = require('react-dom');
const mountNode = document.getElementById('mastodon-timeline');
if (mountNode !== null) {
@ -16,6 +15,7 @@ function loaded() {
}
function main() {
const ready = require('../mastodon/ready').default;
ready(loaded);
}

View File

@ -0,0 +1,40 @@
import { delegate } from 'rails-ujs';
function handleDeleteStatus(event) {
const [data] = event.detail;
const element = document.querySelector(`[data-id="${data.id}"]`);
if (element) {
element.parentNode.removeChild(element);
}
}
[].forEach.call(document.querySelectorAll('.trash-button'), (content) => {
content.addEventListener('ajax:success', handleDeleteStatus);
});
const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]';
delegate(document, '#batch_checkbox_all', 'change', ({ target }) => {
[].forEach.call(document.querySelectorAll(batchCheckboxClassName), (content) => {
content.checked = target.checked;
});
});
delegate(document, batchCheckboxClassName, 'change', () => {
const checkAllElement = document.querySelector('#batch_checkbox_all');
if (checkAllElement) {
checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked);
}
});
delegate(document, '.media-spoiler-show-button', 'click', () => {
[].forEach.call(document.querySelectorAll('.activity-stream .media-spoiler-wrapper'), (content) => {
content.classList.add('media-spoiler-wrapper__visible');
});
});
delegate(document, '.media-spoiler-hide-button', 'click', () => {
[].forEach.call(document.querySelectorAll('.activity-stream .media-spoiler-wrapper'), (content) => {
content.classList.remove('media-spoiler-wrapper__visible');
});
});

View File

@ -1,6 +1,7 @@
import main from '../mastodon/main';
import loadPolyfills from '../mastodon/load_polyfills';
loadPolyfills().then(main).catch(e => {
loadPolyfills().then(() => {
require('../mastodon/main').default();
}).catch(e => {
console.error(e);
});

View File

@ -1,45 +1,44 @@
import { length } from 'stringz';
import IntlRelativeFormat from 'intl-relativeformat';
import { delegate } from 'rails-ujs';
import emojify from '../mastodon/emoji';
import { getLocale } from '../mastodon/locales';
import loadPolyfills from '../mastodon/load_polyfills';
import { processBio } from '../glitch/util/bio_metadata';
import ready from '../mastodon/ready';
const { localeData } = getLocale();
localeData.forEach(IntlRelativeFormat.__addLocaleData);
function loaded() {
const locale = document.documentElement.lang;
const dateTimeFormat = new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
});
const relativeFormat = new IntlRelativeFormat(locale);
[].forEach.call(document.querySelectorAll('.emojify'), (content) => {
content.innerHTML = emojify(content.innerHTML);
});
[].forEach.call(document.querySelectorAll('time.formatted'), (content) => {
const datetime = new Date(content.getAttribute('datetime'));
const formattedDate = dateTimeFormat.format(datetime);
content.title = formattedDate;
content.textContent = formattedDate;
});
[].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {
const datetime = new Date(content.getAttribute('datetime'));
content.textContent = relativeFormat.format(datetime);;
});
}
function main() {
ready(loaded);
const { length } = require('stringz');
const IntlRelativeFormat = require('intl-relativeformat').default;
const { delegate } = require('rails-ujs');
const emojify = require('../mastodon/emoji').default;
const { getLocale } = require('../mastodon/locales');
const ready = require('../mastodon/ready').default;
const { localeData } = getLocale();
localeData.forEach(IntlRelativeFormat.__addLocaleData);
ready(() => {
const locale = document.documentElement.lang;
const dateTimeFormat = new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
});
const relativeFormat = new IntlRelativeFormat(locale);
[].forEach.call(document.querySelectorAll('.emojify'), (content) => {
content.innerHTML = emojify(content.innerHTML);
});
[].forEach.call(document.querySelectorAll('time.formatted'), (content) => {
const datetime = new Date(content.getAttribute('datetime'));
const formattedDate = dateTimeFormat.format(datetime);
content.title = formattedDate;
content.textContent = formattedDate;
});
[].forEach.call(document.querySelectorAll('time.time-ago'), (content) => {
const datetime = new Date(content.getAttribute('datetime'));
content.textContent = relativeFormat.format(datetime);;
});
});
delegate(document, '.video-player video', 'click', ({ target }) => {
if (target.paused) {

View File

@ -253,7 +253,8 @@
}
}
.report-status {
.report-status,
.account-status {
display: flex;
margin-bottom: 10px;
@ -263,7 +264,8 @@
}
}
.report-status__actions {
.report-status__actions,
.account-status__actions {
flex: 0 0 auto;
display: flex;
flex-direction: column;
@ -275,3 +277,42 @@
margin-bottom: 10px;
}
}
.batch-form-box {
display: flex;
margin-bottom: 10px;
#form_status_batch_action {
margin-right: 5px;
font-size: 14px;
}
.media-spoiler-toggle-buttons {
margin-left: auto;
.button {
overflow: visible;
}
}
}
.batch-checkbox,
.batch-checkbox-all {
display: flex;
align-items: center;
margin-right: 5px;
}
.back-link {
margin-bottom: 10px;
font-size: 14px;
a {
color: $classic-highlight-color;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
}