From eddb95b0126e523faeafbde544ff5df3a64e5b25 Mon Sep 17 00:00:00 2001 From: Eugen Rochko <eugen@zeonfederated.com> Date: Thu, 4 May 2017 23:41:34 +0200 Subject: [PATCH] When streaming API is disconnected, poll home/notifications (#2776) * When streaming API is disconnected, poll home/notifications Display slightly different empty home timeline message if user is following others Cull notifications to 20 items when over 40 get added in real-time Run manage:translations * Optimize <HomeTimeline /> a little --- .../mastodon/actions/notifications.js | 35 +++++++++++++------ app/javascript/mastodon/actions/timelines.js | 2 ++ .../mastodon/containers/mastodon.js | 22 +++++++++++- .../mastodon/features/home_timeline/index.js | 24 ++++++++++--- app/javascript/mastodon/locales/ar.json | 20 ++++------- app/javascript/mastodon/locales/bg.json | 1 + app/javascript/mastodon/locales/de.json | 1 + .../mastodon/locales/defaultMessages.json | 4 +++ app/javascript/mastodon/locales/en.json | 1 + app/javascript/mastodon/locales/eo.json | 1 + app/javascript/mastodon/locales/es.json | 1 + app/javascript/mastodon/locales/fa.json | 1 + app/javascript/mastodon/locales/fi.json | 1 + app/javascript/mastodon/locales/fr.json | 7 ++-- app/javascript/mastodon/locales/hr.json | 1 + app/javascript/mastodon/locales/hu.json | 1 + app/javascript/mastodon/locales/id.json | 7 ++-- app/javascript/mastodon/locales/io.json | 1 + app/javascript/mastodon/locales/it.json | 1 + app/javascript/mastodon/locales/ja.json | 1 + app/javascript/mastodon/locales/nl.json | 1 + app/javascript/mastodon/locales/no.json | 5 +-- app/javascript/mastodon/locales/oc.json | 1 + app/javascript/mastodon/locales/pt-BR.json | 1 + app/javascript/mastodon/locales/pt.json | 1 + app/javascript/mastodon/locales/ru.json | 1 + app/javascript/mastodon/locales/uk.json | 1 + app/javascript/mastodon/locales/zh-CN.json | 6 ++-- app/javascript/mastodon/locales/zh-HK.json | 1 + .../mastodon/reducers/accounts_counters.js | 6 +++- .../mastodon/reducers/notifications.js | 12 +++++-- 31 files changed, 124 insertions(+), 45 deletions(-) diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index b09ca08545..8bae411c1e 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -54,54 +54,64 @@ const excludeTypesFromSettings = state => state.getIn(['settings', 'notification export function refreshNotifications() { return (dispatch, getState) => { - dispatch(refreshNotificationsRequest()); - const params = {}; const ids = getState().getIn(['notifications', 'items']); + let skipLoading = false; + if (ids.size > 0) { params.since_id = ids.first().get('id'); } + if (getState().getIn(['notifications', 'loaded'])) { + skipLoading = true; + } + params.exclude_types = excludeTypesFromSettings(getState()); + dispatch(refreshNotificationsRequest(skipLoading)); + api(getState).get('/api/v1/notifications', { params }).then(response => { const next = getLinks(response).refs.find(link => link.rel === 'next'); - dispatch(refreshNotificationsSuccess(response.data, next ? next.uri : null)); + dispatch(refreshNotificationsSuccess(response.data, skipLoading, next ? next.uri : null)); fetchRelatedRelationships(dispatch, response.data); }).catch(error => { - dispatch(refreshNotificationsFail(error)); + dispatch(refreshNotificationsFail(error, skipLoading)); }); }; }; -export function refreshNotificationsRequest() { +export function refreshNotificationsRequest(skipLoading) { return { - type: NOTIFICATIONS_REFRESH_REQUEST + type: NOTIFICATIONS_REFRESH_REQUEST, + skipLoading }; }; -export function refreshNotificationsSuccess(notifications, next) { +export function refreshNotificationsSuccess(notifications, skipLoading, next) { return { type: NOTIFICATIONS_REFRESH_SUCCESS, notifications, accounts: notifications.map(item => item.account), statuses: notifications.map(item => item.status).filter(status => !!status), + skipLoading, next }; }; -export function refreshNotificationsFail(error) { +export function refreshNotificationsFail(error, skipLoading) { return { type: NOTIFICATIONS_REFRESH_FAIL, - error + error, + skipLoading }; }; export function expandNotifications() { return (dispatch, getState) => { - const url = getState().getIn(['notifications', 'next'], null); + const url = getState().getIn(['notifications', 'next'], null); + const lastId = getState().getIn(['notifications', 'items']).last(); if (url === null || getState().getIn(['notifications', 'isLoading'])) { return; @@ -109,7 +119,10 @@ export function expandNotifications() { dispatch(expandNotificationsRequest()); - const params = {}; + const params = { + max_id: lastId, + limit: 20 + }; params.exclude_types = excludeTypesFromSettings(getState()); diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 6cd1f04b31..5b37509a9d 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -86,6 +86,8 @@ export function refreshTimeline(timeline, id = null) { params = { ...params, since_id: newestId }; skipLoading = true; + } else if (getState().getIn(['timelines', timeline, 'loaded'])) { + skipLoading = true; } dispatch(refreshTimelineRequest(timeline, id, skipLoading)); diff --git a/app/javascript/mastodon/containers/mastodon.js b/app/javascript/mastodon/containers/mastodon.js index 637199686c..4e40d73efa 100644 --- a/app/javascript/mastodon/containers/mastodon.js +++ b/app/javascript/mastodon/containers/mastodon.js @@ -217,20 +217,34 @@ Container.propTypes = { children: PropTypes.node, }; -class Mastodon extends React.Component { +class Mastodon extends React.PureComponent { componentDidMount() { const { locale } = this.props; const streamingAPIBaseURL = store.getState().getIn(['meta', 'streaming_api_base_url']); const accessToken = store.getState().getIn(['meta', 'access_token']); + const setupPolling = () => { + this.polling = setInterval(() => { + store.dispatch(refreshTimeline('home')); + store.dispatch(refreshNotifications()); + }, 20000); + }; + + const clearPolling = () => { + clearInterval(this.polling); + this.polling = undefined; + }; + this.subscription = createStream(streamingAPIBaseURL, accessToken, 'user', { connected () { + clearPolling(); store.dispatch(connectTimeline('home')); }, disconnected () { + setupPolling(); store.dispatch(disconnectTimeline('home')); }, @@ -249,6 +263,7 @@ class Mastodon extends React.Component { }, reconnected () { + clearPolling(); store.dispatch(connectTimeline('home')); store.dispatch(refreshTimeline('home')); store.dispatch(refreshNotifications()); @@ -269,6 +284,11 @@ class Mastodon extends React.Component { this.subscription.close(); this.subscription = null; } + + if (typeof this.polling !== 'undefined') { + clearInterval(this.polling); + this.polling = null; + } } render () { diff --git a/app/javascript/mastodon/features/home_timeline/index.js b/app/javascript/mastodon/features/home_timeline/index.js index d7c4381225..d6bfef8cd9 100644 --- a/app/javascript/mastodon/features/home_timeline/index.js +++ b/app/javascript/mastodon/features/home_timeline/index.js @@ -12,18 +12,33 @@ const messages = defineMessages({ }); const mapStateToProps = state => ({ - hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0 + hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0, + hasFollows: state.getIn(['accounts_counters', state.getIn(['meta', 'me']), 'following_count']) > 0 }); class HomeTimeline extends React.PureComponent { render () { - const { intl, hasUnread } = this.props; + const { intl, hasUnread, hasFollows } = this.props; + + let emptyMessage; + + if (hasFollows) { + emptyMessage = <FormattedMessage id='empty_column.home.inactivity' defaultMessage="Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon." /> + } else { + emptyMessage = <FormattedMessage id='empty_column.home' defaultMessage="You aren't following anyone yet. Visit {public} or use search to get started and meet other users." values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />; + } return ( <Column icon='home' active={hasUnread} heading={intl.formatMessage(messages.title)}> <ColumnSettingsContainer /> - <StatusListContainer {...this.props} scrollKey='home_timeline' type='home' emptyMessage={<FormattedMessage id='empty_column.home' defaultMessage="You aren't following anyone yet. Visit {public} or use search to get started and meet other users." values={{ public: <Link to='/timelines/public'><FormattedMessage id='empty_column.home.public_timeline' defaultMessage='the public timeline' /></Link> }} />} /> + + <StatusListContainer + {...this.props} + scrollKey='home_timeline' + type='home' + emptyMessage={emptyMessage} + /> </Column> ); } @@ -32,7 +47,8 @@ class HomeTimeline extends React.PureComponent { HomeTimeline.propTypes = { intl: PropTypes.object.isRequired, - hasUnread: PropTypes.bool + hasUnread: PropTypes.bool, + hasFollows: PropTypes.bool }; export default connect(mapStateToProps)(injectIntl(HomeTimeline)); diff --git a/app/javascript/mastodon/locales/ar.json b/app/javascript/mastodon/locales/ar.json index b4f05a73ef..c5f7b9a7b6 100644 --- a/app/javascript/mastodon/locales/ar.json +++ b/app/javascript/mastodon/locales/ar.json @@ -29,6 +29,7 @@ "compose_form.lock_disclaimer": "Øسابك ليس {locked}. يمكن لأي شخص متابعتك Ùˆ عرض المنشورات.", "compose_form.lock_disclaimer.lock": "مقÙÙ„", "compose_form.placeholder": "Ùيمَ تÙكّر؟", + "compose_form.privacy_disclaimer": "Your private status will be delivered to mentioned users on {domains}. Do you trust {domainsCount, plural, one {that server} other {those servers}}? Post privacy only works on Mastodon instances. If {domains} {domainsCount, plural, one {is not a Mastodon instance} other {are not Mastodon instances}}, there will be no indication that your post is private, and it may be boosted or otherwise made visible to unintended recipients.", "compose_form.publish": "بوّق !", "compose_form.sensitive": "ضع علامة على الوسيط باعتباره Øسّاس", "compose_form.spoiler": "أخÙ٠النص واعرض تØذيرا", @@ -53,6 +54,7 @@ "empty_column.community": "الخط الزمني المØلي Ùارغ. اكتب شيئا ما للعامة كبداية.", "empty_column.hashtag": "ليس هناك بعد٠أي Ù…Øتوى ذو علاقة بهذا الوسم.", "empty_column.home": "إنك لا تتبع بعد أي شخص إلى Øد الآن. زر {public} أو استخدام Øقل البØØ« لكي تبدأ على التعر٠على مستخدمين آخرين.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "الخيط العام", "empty_column.notifications": "لم تتلق أي إشعار بعدÙ. تÙاعل مع المستخدمين الآخرين لإنشاء Ù…Øادثة.", "empty_column.public": "لا يوجد شيء هنا ! قم بتØرير شيء ما بشكل عام، أو اتبع مستخدمين آخرين ÙÙŠ الخوادم المثيلة الأخرى لملء خيط المØادثات العام.", @@ -149,24 +151,14 @@ "tabs_bar.compose": "تØرير", "tabs_bar.federated_timeline": "Federated", "tabs_bar.home": "الرئيسية", - "tabs_bar.mentions": "الإشارات", - "tabs_bar.public": "الخيط العام الموØد", + "tabs_bar.local_timeline": "Local", "tabs_bar.notifications": "الإخطارات", + "upload_area.title": "Drag & drop to upload", "upload_button.label": "إضاÙØ© وسائط", "upload_form.undo": "إلغاء", "upload_progress.label": "يرÙع...", - "notification.follow": "{name} يتبعك", - "notification.favourite": "{name} أعجب بمنشورك", - "notification.reblog": "{name} قام بترقية تبويقك", - "notification.mention": "{name} ذكرك", - "notifications.column_settings.alert": "إشعارات Ø³Ø·Ø Ø§Ù„Ù…ÙƒØªØ¨", - "notifications.column_settings.show": "إعرÙضها ÙÙŠ عمود", - "notifications.column_settings.follow": "متابعÙون جÙدÙد :", - "notifications.column_settings.favourite": "المÙÙَضَّلة :", - "notifications.column_settings.mention": "الإشارات :", - "notifications.column_settings.reblog": "الترقيّات:", + "video_player.expand": "وسّع الÙيديو", "video_player.toggle_sound": "تبديل الصوت", "video_player.toggle_visible": "إظهار / إخÙاء الÙيديو", - "video_player.expand": "وسّع الÙيديو", "video_player.video_error": "تعذر تشغيل الÙيديو" -} +} \ No newline at end of file diff --git a/app/javascript/mastodon/locales/bg.json b/app/javascript/mastodon/locales/bg.json index 38dbb8b61f..399220050e 100644 --- a/app/javascript/mastodon/locales/bg.json +++ b/app/javascript/mastodon/locales/bg.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/de.json b/app/javascript/mastodon/locales/de.json index 1d79f0cb8b..f5b6a10e92 100644 --- a/app/javascript/mastodon/locales/de.json +++ b/app/javascript/mastodon/locales/de.json @@ -54,6 +54,7 @@ "empty_column.community": "Die lokale Zeitleiste ist leer. Schreibe etwas öffentlich, um den Ball ins Rollen zu bringen!", "empty_column.hashtag": "Es gibt noch nichts unter diesem Hashtag.", "empty_column.home": "Du folgst noch niemandem. Besuche {public} oder benutze die Suche, um zu starten oder andere Benutzer anzutreffen.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "die öffentliche Zeitleiste", "empty_column.notifications": "Du hast noch keine Mitteilungen. Interagiere mit anderen, um die Konversation zu starten.", "empty_column.public": "Hier ist nichts zu sehen! Schreibe etwas öffentlich oder folge Benutzern von anderen Instanzen, um es aufzufüllen.", diff --git a/app/javascript/mastodon/locales/defaultMessages.json b/app/javascript/mastodon/locales/defaultMessages.json index ea481e1545..03931aeff9 100644 --- a/app/javascript/mastodon/locales/defaultMessages.json +++ b/app/javascript/mastodon/locales/defaultMessages.json @@ -713,6 +713,10 @@ { "defaultMessage": "the public timeline", "id": "empty_column.home.public_timeline" + }, + { + "defaultMessage": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", + "id": "empty_column.home.inactivity" } ], "path": "app/javascript/mastodon/features/home_timeline/index.json" diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 797a1caf2e..8a7a5e4e65 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/eo.json b/app/javascript/mastodon/locales/eo.json index b71088490d..af6fbad694 100644 --- a/app/javascript/mastodon/locales/eo.json +++ b/app/javascript/mastodon/locales/eo.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/es.json b/app/javascript/mastodon/locales/es.json index c023a4b7e0..d4b8363913 100644 --- a/app/javascript/mastodon/locales/es.json +++ b/app/javascript/mastodon/locales/es.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/fa.json b/app/javascript/mastodon/locales/fa.json index 6e0b41756a..d61ff9f697 100644 --- a/app/javascript/mastodon/locales/fa.json +++ b/app/javascript/mastodon/locales/fa.json @@ -54,6 +54,7 @@ "empty_column.community": "Ùهرست نوشته‌های Ù…ØÙ„ÛŒ خالی است. چیزی بنویسید تا چرخش بچرخد!", "empty_column.hashtag": "هنوز هیچ چیزی با این هشتگ نیست.", "empty_column.home": "شما هنوز پیگیر کسی نیستید. {public} را ببینید یا چیزی را جستجو کنید تا کاربران دیگر را ببینید.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "Ùهرست نوشته‌های همه‌جا", "empty_column.notifications": "هنوز هیچ اعلانی ندارید. به نوشته‌های دیگران واکنش نشان دهید تا Ú¯Ùتگو آغاز شود.", "empty_column.public": "این‌جا هنوز چیزی نیست! خودتان چیزی بنویسید یا کاربران دیگر را Ù¾ÛŒ بگیرید تا این‌جا پر شود", diff --git a/app/javascript/mastodon/locales/fi.json b/app/javascript/mastodon/locales/fi.json index 148a371aeb..fce0fe65f6 100644 --- a/app/javascript/mastodon/locales/fi.json +++ b/app/javascript/mastodon/locales/fi.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/fr.json b/app/javascript/mastodon/locales/fr.json index c036a08f56..41a86d2b16 100644 --- a/app/javascript/mastodon/locales/fr.json +++ b/app/javascript/mastodon/locales/fr.json @@ -30,7 +30,6 @@ "compose_form.lock_disclaimer.lock": "locked", "compose_form.placeholder": "Qu’avez-vous en tête ?", "compose_form.privacy_disclaimer": "Votre statut privé va être transmis aux personnes mentionnées sur {domains}. Avez-vous confiance en {domainsCount, plural, one {ce serveur} other {ces serveurs}} pour ne pas divulguer votre statut ? Les statuts privés ne fonctionnent que sur les instances de Mastodon. Si {domains} {domainsCount, plural, one {n’est pas une instance de Mastodon} other {ne sont pas des instances de Mastodon}}, il n’y aura aucune indication que votre statut est privé, et il pourrait être partagé ou rendu visible d’une autre manière à d’autres personnes imprévues.", - "compose_form.private": "Rendre privé", "compose_form.publish": "Pouet ", "compose_form.sensitive": "Marquer le média comme délicat", "compose_form.spoiler": "Masquer le texte derrière un avertissement", @@ -54,8 +53,9 @@ "emoji_button.travel": "Travel & Places", "empty_column.community": "Le fil public local est vide. Écrivez-donc quelque chose pour le remplir !", "empty_column.hashtag": "Il n’y a encore aucun contenu relatif à ce hashtag", - "empty_column.home.public_timeline": "le fil public", "empty_column.home": "Vous ne suivez encore personne. Visitez {public} ou bien utilisez la recherche pour vous connecter à d’autres utilisateursâ‹…trices.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", + "empty_column.home.public_timeline": "le fil public", "empty_column.notifications": "Vous n’avez pas encore de notification. Interagissez avec d’autres utilisateursâ‹…trices pour débuter la conversation.", "empty_column.public": "Il n’y a rien ici ! Écrivez quelque chose publiquement, ou bien suivez manuellement des utilisateursâ‹…trices d’autres instances pour remplir le fil public.", "follow_request.authorize": "Autoriser", @@ -106,6 +106,7 @@ "onboarding.page_one.welcome": "Bienvenue sur Mastodon !", "onboarding.page_six.admin": "L’administrateurâ‹…trice de votre instance est {admin}", "onboarding.page_six.almost_done": "Nous y sommes presque…", + "onboarding.page_six.appetoot": "Bon Appetoot!", "onboarding.page_six.apps_available": "De nombreuses {apps} sont disponibles pour iOS, Android et autres. Et maintenant… Bon Appetoot!", "onboarding.page_six.github": "Mastodon est un logiciel libre, gratuit et open-source. Vous pouvez rapporter des bogues, suggérer des fonctionnalités, ou contribuer à son développement sur {github}.", "onboarding.page_six.guidelines": "règles de la communauté", @@ -160,4 +161,4 @@ "video_player.toggle_sound": "Mettre/Couper le son", "video_player.toggle_visible": "Afficher/Cacher la vidéo", "video_player.video_error": "Video could not be played" -} +} \ No newline at end of file diff --git a/app/javascript/mastodon/locales/hr.json b/app/javascript/mastodon/locales/hr.json index 45c3cb7f62..d0a400b489 100644 --- a/app/javascript/mastodon/locales/hr.json +++ b/app/javascript/mastodon/locales/hr.json @@ -54,6 +54,7 @@ "empty_column.community": "Lokalni timeline je prazan. NapiÅ¡i neÅ¡to javno kako bi pokrenuo stvari!", "empty_column.hashtag": "JoÅ¡ ne postoji niÅ¡ta s ovim hashtagom.", "empty_column.home": "JoÅ¡ ne slijediÅ¡ nikoga. Posjeti {public} ili koristi tražilicu kako bi poÄeo i upoznao druge korisnike.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "javni timeline", "empty_column.notifications": "JoÅ¡ nemaÅ¡ notifikacija. Komuniciraj sa drugima kako bi zapoÄeo razgovor.", "empty_column.public": "Ovdje nema niÅ¡ta! NapiÅ¡i neÅ¡to javno, ili ruÄno slijedi korisnike sa drugih instanci kako bi popunio", diff --git a/app/javascript/mastodon/locales/hu.json b/app/javascript/mastodon/locales/hu.json index e1d9d36be0..eb2949302a 100644 --- a/app/javascript/mastodon/locales/hu.json +++ b/app/javascript/mastodon/locales/hu.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/id.json b/app/javascript/mastodon/locales/id.json index d73915a361..d71e861ee1 100644 --- a/app/javascript/mastodon/locales/id.json +++ b/app/javascript/mastodon/locales/id.json @@ -54,6 +54,7 @@ "empty_column.community": "Linimasa lokal masih kosong. Tulis sesuatu secara publik dan buat roda berputar!", "empty_column.hashtag": "Tidak ada apapun dalam hashtag ini.", "empty_column.home": "Anda sedang tidak mengikuti siapapun. Kunjungi {public} atau gunakan pencarian untuk memulai dan bertemu pengguna lain.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "linimasa publik", "empty_column.notifications": "Anda tidak memiliki notifikasi apapun. Berinteraksi dengan orang lain untuk memulai percakapan.", "empty_column.public": "Tidak ada apapun disini! Tulis sesuatu, atau ikuti pengguna lain dari server lain untuk mengisinya secara manual", @@ -129,9 +130,6 @@ "report.placeholder": "Komentar tambahan", "report.submit": "Kirim", "report.target": "Melaporkan", - "search.status_by": "Status yang dibuat oleh {name}", - "search_results.total": "{count} {count, plural, one {hasil} other {hasil}}", - "status.cannot_reblog": "Postingan ini tidak dapat di-boost", "search.placeholder": "Pencarian", "search_results.total": "{count} {count, plural, one {hasil} other {hasil}}", "status.cannot_reblog": "This post cannot be boosted", @@ -162,6 +160,5 @@ "video_player.expand": "Tampilkan video", "video_player.toggle_sound": "Suara", "video_player.toggle_visible": "Tampilan", - "video_player.expand": "Tampilkan video", "video_player.video_error": "Video tidak dapat diputar" -} +} \ No newline at end of file diff --git a/app/javascript/mastodon/locales/io.json b/app/javascript/mastodon/locales/io.json index bcf89cfc2a..e5fe43e472 100644 --- a/app/javascript/mastodon/locales/io.json +++ b/app/javascript/mastodon/locales/io.json @@ -54,6 +54,7 @@ "empty_column.community": "La lokala tempolineo esas vakua. Skribez ulo publike por iniciar la agiveso!", "empty_column.hashtag": "Esas ankore nulo en ta gretovorto.", "empty_column.home": "Tu sequas ankore nulu. Vizitez {public} od uzez la serchilo por komencar e renkontrar altra uzeri.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "la publika tempolineo", "empty_column.notifications": "Tu havas ankore nula savigo. Komunikez kun altri por debutar la konverso.", "empty_column.public": "Esas nulo hike! Skribez ulo publike, o manuale sequez uzeri de altra instaluri por plenigar ol.", diff --git a/app/javascript/mastodon/locales/it.json b/app/javascript/mastodon/locales/it.json index 0342f1e1f5..d84bf16a56 100644 --- a/app/javascript/mastodon/locales/it.json +++ b/app/javascript/mastodon/locales/it.json @@ -54,6 +54,7 @@ "empty_column.community": "La timeline locale è vuota. Condividi qualcosa pubblicamente per dare inizio alla festa!", "empty_column.hashtag": "Non c'è ancora nessun post con questo hashtag.", "empty_column.home": "Non stai ancora seguendo nessuno. Visita {public} o usa la ricerca per incontrare nuove persone.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "la timeline pubblica", "empty_column.notifications": "Non hai ancora nessuna notifica. Interagisci con altri per iniziare conversazioni.", "empty_column.public": "Qui non c'è nulla! Scrivi qualcosa pubblicamente, o aggiungi utenti da altri server per riempire questo spazio.", diff --git a/app/javascript/mastodon/locales/ja.json b/app/javascript/mastodon/locales/ja.json index c9ddde0837..3d041c96d3 100644 --- a/app/javascript/mastodon/locales/ja.json +++ b/app/javascript/mastodon/locales/ja.json @@ -54,6 +54,7 @@ "empty_column.community": "ãƒãƒ¼ã‚«ãƒ«ã‚¿ã‚¤ãƒ ラインã¯ã¾ã 使ã‚ã‚Œã¦ã„ã¾ã›ã‚“。何ã‹æ›¸ã„ã¦ã¿ã¾ã—ょã†ï¼", "empty_column.hashtag": "ã“ã®ãƒãƒƒã‚·ãƒ¥ã‚¿ã‚°ã¯ã¾ã 使ã‚ã‚Œã¦ã„ã¾ã›ã‚“。", "empty_column.home": "ã¾ã 誰もフォãƒãƒ¼ã—ã¦ã„ã¾ã›ã‚“。{public}を見ã«è¡Œãã‹ã€æ¤œç´¢ã‚’使ã£ã¦ä»–ã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚’見ã¤ã‘ã¾ã—ょã†ã€‚", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "連åˆã‚¿ã‚¤ãƒ ライン", "empty_column.notifications": "ã¾ã 通知ãŒã‚ã‚Šã¾ã›ã‚“。他ã®äººã¨ãµã‚Œåˆã£ã¦ä¼šè©±ã‚’始ã‚ã¾ã—ょã†ã€‚", "empty_column.public": "ã“ã“ã«ã¯ã¾ã 何もã‚ã‚Šã¾ã›ã‚“ï¼å…¬é–‹ã§ä½•ã‹ã‚’投稿ã—ãŸã‚Šã€ä»–ã®ã‚¤ãƒ³ã‚¹ã‚¿ãƒ³ã‚¹ã®ãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚’フォãƒãƒ¼ã—ãŸã‚Šã—ã¦ã„ã£ã±ã„ã«ã—ã¾ã—ょã†ï¼", diff --git a/app/javascript/mastodon/locales/nl.json b/app/javascript/mastodon/locales/nl.json index 730ef246d6..565cd96b9d 100644 --- a/app/javascript/mastodon/locales/nl.json +++ b/app/javascript/mastodon/locales/nl.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/no.json b/app/javascript/mastodon/locales/no.json index 25dee25a3b..e714a5c493 100644 --- a/app/javascript/mastodon/locales/no.json +++ b/app/javascript/mastodon/locales/no.json @@ -4,8 +4,8 @@ "account.edit_profile": "Rediger profil", "account.follow": "Følg", "account.followers": "Følgere", - "account.follows_you": "Følger deg", "account.follows": "Følger", + "account.follows_you": "Følger deg", "account.mention": "Nevn @{name}", "account.mute": "Demp @{name}", "account.posts": "Innlegg", @@ -54,6 +54,7 @@ "empty_column.community": "Den lokale tidslinjen er tom. Skriv noe offentlig for Ã¥ fÃ¥ snøballen til Ã¥ rulle!", "empty_column.hashtag": "Det er ingenting i denne hashtagen ennÃ¥.", "empty_column.home": "Du har ikke fulgt noen ennÃ¥. Besøk {publlic} eller bruk søk for Ã¥ komme i gang og møte andre brukere.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "en offentlig tidslinje", "empty_column.notifications": "Du har ingen varsler ennÃ¥. Kommuniser med andre for Ã¥ begynne samtalen.", "empty_column.public": "Det er ingenting her! Skriv noe offentlig, eller følg brukere manuelt fra andre instanser for Ã¥ fylle den opp", @@ -160,4 +161,4 @@ "video_player.toggle_sound": "Veksle lyd", "video_player.toggle_visible": "Veksle synlighet", "video_player.video_error": "Video could not be played" -} +} \ No newline at end of file diff --git a/app/javascript/mastodon/locales/oc.json b/app/javascript/mastodon/locales/oc.json index 5a23fe9f87..74cda821f8 100644 --- a/app/javascript/mastodon/locales/oc.json +++ b/app/javascript/mastodon/locales/oc.json @@ -54,6 +54,7 @@ "empty_column.community": "Lo fil public local es void. Escribètz quicòm per lo garnir !", "empty_column.hashtag": "I a pas encara de contengut ligat a aqueste hashtag", "empty_column.home": "Pel moment segètz pas segun. Visitatz {public} o utilizatz la recèrca per vos connectar a d’autras personas.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "lo fil public", "empty_column.notifications": "Avètz pas encara de notificacions. Respondètz a qualqu’un per començar una conversacion.", "empty_column.public": "I a pas res aquà ! Escribètz quicòm de public, o seguètz de personas d’autras instà ncias per garnir lo fil public.", diff --git a/app/javascript/mastodon/locales/pt-BR.json b/app/javascript/mastodon/locales/pt-BR.json index 12e9f6b5f0..13366effe8 100644 --- a/app/javascript/mastodon/locales/pt-BR.json +++ b/app/javascript/mastodon/locales/pt-BR.json @@ -54,6 +54,7 @@ "empty_column.community": "Ainda não existem conteúdo local para mostrar!", "empty_column.hashtag": "Ainda não existe qualquer conteúdo com essa hashtag", "empty_column.home": "Ainda não segues qualquer utilizador. Visita {public} ou utiliza a pesquisa para procurar outros utilizadores.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "global", "empty_column.notifications": "Não tens notificações. Interage com outros utilizadores para iniciar uma conversa.", "empty_column.public": "Não há nada aqui! Escreve algo publicamente ou segue outros utilizadores para ver aqui os conteúdos públicos.", diff --git a/app/javascript/mastodon/locales/pt.json b/app/javascript/mastodon/locales/pt.json index 12e9f6b5f0..13366effe8 100644 --- a/app/javascript/mastodon/locales/pt.json +++ b/app/javascript/mastodon/locales/pt.json @@ -54,6 +54,7 @@ "empty_column.community": "Ainda não existem conteúdo local para mostrar!", "empty_column.hashtag": "Ainda não existe qualquer conteúdo com essa hashtag", "empty_column.home": "Ainda não segues qualquer utilizador. Visita {public} ou utiliza a pesquisa para procurar outros utilizadores.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "global", "empty_column.notifications": "Não tens notificações. Interage com outros utilizadores para iniciar uma conversa.", "empty_column.public": "Não há nada aqui! Escreve algo publicamente ou segue outros utilizadores para ver aqui os conteúdos públicos.", diff --git a/app/javascript/mastodon/locales/ru.json b/app/javascript/mastodon/locales/ru.json index c13c959605..9edc378599 100644 --- a/app/javascript/mastodon/locales/ru.json +++ b/app/javascript/mastodon/locales/ru.json @@ -54,6 +54,7 @@ "empty_column.community": "Ð›Ð¾ÐºÐ°Ð»ÑŒÐ½Ð°Ñ Ð»ÐµÐ½Ñ‚Ð° пуÑта. Ðапишите что-нибудь, чтобы разогреть народ!", "empty_column.hashtag": "СтатуÑов Ñ Ñ‚Ð°ÐºÐ¸Ð¼ Ñ…Ñштегом еще не ÑущеÑтвует.", "empty_column.home": "Пока Ð’Ñ‹ ни на кого не подпиÑаны. ПолиÑтайте {public} или иÑпользуйте поиÑк, чтобы оÑвоитьÑÑ Ð¸ завеÑти новые знакомÑтва.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "публичные ленты", "empty_column.notifications": "У Ð’Ð°Ñ ÐµÑ‰Ðµ нет уведомлений. Заведите знакомÑтво Ñ Ð´Ñ€ÑƒÐ³Ð¸Ð¼Ð¸ пользователÑми, чтобы начать разговор.", "empty_column.public": "ЗдеÑÑŒ ничего нет! Опубликуйте что-нибудь или подпишитеÑÑŒ на пользователей Ñ Ð´Ñ€ÑƒÐ³Ð¸Ñ… узлов, чтобы заполнить ленту.", diff --git a/app/javascript/mastodon/locales/uk.json b/app/javascript/mastodon/locales/uk.json index fde28871df..552a8713dc 100644 --- a/app/javascript/mastodon/locales/uk.json +++ b/app/javascript/mastodon/locales/uk.json @@ -54,6 +54,7 @@ "empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!", "empty_column.hashtag": "There is nothing in this hashtag yet.", "empty_column.home": "You aren't following anyone yet. Visit {public} or use search to get started and meet other users.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "the public timeline", "empty_column.notifications": "You don't have any notifications yet. Interact with others to start the conversation.", "empty_column.public": "There is nothing here! Write something publicly, or manually follow users from other instances to fill it up", diff --git a/app/javascript/mastodon/locales/zh-CN.json b/app/javascript/mastodon/locales/zh-CN.json index cf1e759c13..bd46086d64 100644 --- a/app/javascript/mastodon/locales/zh-CN.json +++ b/app/javascript/mastodon/locales/zh-CN.json @@ -23,6 +23,7 @@ "column.mutes": "被é™éŸ³çš„用户", "column.notifications": "通知", "column.public": "跨站公共时间轴", + "column_back_button.label": "Back", "column_subheading.navigation": "导航", "column_subheading.settings": "设置", "compose_form.lock_disclaimer": "ä½ çš„è´¦æˆ·æ²¡ {locked}. 任何人å¯ä»¥é€šè¿‡å…³æ³¨ä½ æ¥æŸ¥çœ‹åªæœ‰å…³æ³¨è€…å¯è§çš„嘟文.", @@ -33,7 +34,6 @@ "compose_form.sensitive": "å°†åª’ä½“æ–‡ä»¶æ ‡ç¤ºä¸ºâ€œæ•æ„Ÿå†…容â€", "compose_form.spoiler": "将部分文本è—于è¦å‘Šæ¶ˆæ¯ä¹‹åŽ", "compose_form.spoiler_placeholder": "æ•æ„Ÿå†…容的è¦å‘Šæ¶ˆæ¯", - "emoji_button.label": "åŠ å…¥è¡¨æƒ…ç¬¦å·", "confirmation_modal.cancel": "å–消", "confirmations.block.confirm": "å±è”½", "confirmations.block.message": "想好了,真的è¦å±è”½ {name}?", @@ -44,6 +44,7 @@ "emoji_button.activity": "活动", "emoji_button.flags": "旗帜", "emoji_button.food": "食物和饮料", + "emoji_button.label": "åŠ å…¥è¡¨æƒ…ç¬¦å·", "emoji_button.nature": "自然", "emoji_button.objects": "物体", "emoji_button.people": "人物", @@ -53,6 +54,7 @@ "empty_column.community": "本站时间轴暂时未有内容,快贴文æ¥æŠ¢å¤´é¦™å•Šï¼", "empty_column.hashtag": "è¿™ä¸ªæ ‡ç¾æš‚时未有内容。", "empty_column.home": "ä½ è¿˜æ²¡æœ‰å…³æ³¨ä»»ä½•ç”¨æˆ·ã€‚å¿«çœ‹çœ‹{public},å‘其他用户æ讪å§ã€‚", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "公共时间轴", "empty_column.notifications": "ä½ æ²¡æœ‰ä»»ä½•é€šçŸ¥çºªå½•ï¼Œå¿«å‘其他用户æ讪å§ã€‚", "empty_column.public": "跨站公共时间轴暂时没有内容ï¼å¿«å†™ä¸€äº›å…¬å…±çš„嘟文,或者关注å¦ä¸€äº›æœåŠ¡ç«™çš„用户å§ï¼ä½ 和本站ã€å‹ç«™çš„交æµï¼Œå°†å†³å®šè¿™é‡Œå‡ºçŽ°çš„内容。", @@ -129,8 +131,8 @@ "report.submit": "æ交", "report.target": "Reporting", "search.placeholder": "æœç´¢", + "search_results.total": "{count, number} {count, plural, one {result} other {results}}", "status.cannot_reblog": "没法转嘟这æ¡å˜Ÿæ–‡å•¦â€¦â€¦", - "search.status_by": "按{name}æœç´¢å˜Ÿæ–‡", "status.delete": "åˆ é™¤", "status.favourite": "赞", "status.load_more": "åŠ è½½æ›´å¤š", diff --git a/app/javascript/mastodon/locales/zh-HK.json b/app/javascript/mastodon/locales/zh-HK.json index 772b7f8fb4..501c409ac4 100644 --- a/app/javascript/mastodon/locales/zh-HK.json +++ b/app/javascript/mastodon/locales/zh-HK.json @@ -54,6 +54,7 @@ "empty_column.community": "本站時間軸暫時未有內容,快貼文來æ¶é 香啊ï¼", "empty_column.hashtag": "這個標籤暫時未有內容。", "empty_column.home": "ä½ é‚„æ²’æœ‰é—œæ³¨ä»»ä½•ç”¨æˆ¶ã€‚å¿«çœ‹çœ‹{public},å‘其他用戶æ訕å§ã€‚", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", "empty_column.home.public_timeline": "公共時間軸", "empty_column.notifications": "ä½ æ²’æœ‰ä»»ä½•é€šçŸ¥ç´€éŒ„ï¼Œå¿«å‘其他用戶æ訕å§ã€‚", "empty_column.public": "跨站公共時間軸暫時沒有內容ï¼å¿«å¯«ä¸€äº›å…¬å…±çš„æ–‡ç« ï¼Œæˆ–è€…é—œæ³¨å¦ä¸€äº›æœå‹™ç«™çš„用戶å§ï¼ä½ 和本站ã€å‹ç«™çš„交æµï¼Œå°‡æ±ºå®šé€™è£å‡ºç¾çš„內容。", diff --git a/app/javascript/mastodon/reducers/accounts_counters.js b/app/javascript/mastodon/reducers/accounts_counters.js index 2afc6c3d92..f0433c48c0 100644 --- a/app/javascript/mastodon/reducers/accounts_counters.js +++ b/app/javascript/mastodon/reducers/accounts_counters.js @@ -87,7 +87,11 @@ const initialState = Immutable.Map(); export default function accountsCounters(state = initialState, action) { switch(action.type) { case STORE_HYDRATE: - return state.merge(action.state.get('accounts_counters')); + return state.merge(action.state.get('accounts').map(item => Immutable.fromJS({ + followers_count: item.get('followers_count'), + following_count: item.get('following_count'), + statuses_count: item.get('statuses_count') + }))); case ACCOUNT_FETCH_SUCCESS: case NOTIFICATIONS_UPDATE: return normalizeAccount(state, action.account); diff --git a/app/javascript/mastodon/reducers/notifications.js b/app/javascript/mastodon/reducers/notifications.js index c567a3a59c..6d53a0ae60 100644 --- a/app/javascript/mastodon/reducers/notifications.js +++ b/app/javascript/mastodon/reducers/notifications.js @@ -29,11 +29,19 @@ const notificationToMap = notification => Immutable.Map({ }); const normalizeNotification = (state, notification) => { - if (!state.get('top')) { + const top = state.get('top'); + + if (!top) { state = state.update('unread', unread => unread + 1); } - return state.update('items', list => list.unshift(notificationToMap(notification))); + return state.update('items', list => { + if (top && list.size > 40) { + list = list.take(20); + } + + return list.unshift(notificationToMap(notification)); + }); }; const normalizeNotifications = (state, notifications, next) => { -- GitLab