From f0bb2c6d1eeea63cd92be3da57288fd4743a8db9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 28 Jul 2017 20:26:54 +0200 Subject: [PATCH 01/28] Fix web push notifications "boost" icon not being loaded (regression from #4426) (#4431) --- app/models/web/push_subscription.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/web/push_subscription.rb b/app/models/web/push_subscription.rb index b343cf044..45ce3298a 100644 --- a/app/models/web/push_subscription.rb +++ b/app/models/web/push_subscription.rb @@ -135,7 +135,7 @@ class Web::PushSubscription < ApplicationRecord end if can_boost - actions << { title: translate('push_notifications.mention.action_boost'), icon: full_asset_url('web-push-icon_boost.png', skip_pipeline: true), todo: 'request', method: 'POST', action: "/api/v1/statuses/#{notification.target_status.id}/reblog" } + actions << { title: translate('push_notifications.mention.action_boost'), icon: full_asset_url('web-push-icon_reblog.png', skip_pipeline: true), todo: 'request', method: 'POST', action: "/api/v1/statuses/#{notification.target_status.id}/reblog" } end actions From 7e0c00a555ddf9140800356535ef9e683ef0eb00 Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Fri, 28 Jul 2017 22:53:16 +0200 Subject: [PATCH 02/28] fix(mocha): Run all tests (#4433) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 90dc6d3e4..5fdd491ee 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "start": "node ./streaming/index.js", "test": "npm run test:lint && npm run test:mocha", "test:lint": "eslint -c .eslintrc.yml --ext=js app/javascript/ config/webpack/ spec/javascript/ streaming/", - "test:mocha": "cross-env NODE_ENV=test mocha --require ./spec/javascript/setup.js --compilers js:babel-register ./spec/javascript/components/*.test.js", + "test:mocha": "cross-env NODE_ENV=test mocha --require ./spec/javascript/setup.js --compilers js:babel-register ./spec/javascript/components/**/*.test.js", "postinstall": "npm rebuild node-sass" }, "repository": { From 3d378ed0b42eab98f74ba1572924029e7d6992ac Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Fri, 28 Jul 2017 22:55:13 +0200 Subject: [PATCH 03/28] fix(tabs_bar): Allow animation to end before navigating (#4429) * fix(tabs_bar): Allow animation to end before navigating * fix(tabs_bar): Do not use event.path --- .../features/ui/components/tabs_bar.js | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/ui/components/tabs_bar.js b/app/javascript/mastodon/features/ui/components/tabs_bar.js index 4d488f82d..7e6a65cdb 100644 --- a/app/javascript/mastodon/features/ui/components/tabs_bar.js +++ b/app/javascript/mastodon/features/ui/components/tabs_bar.js @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import NavLink from 'react-router-dom/NavLink'; import { FormattedMessage, injectIntl } from 'react-intl'; +import { debounce } from 'lodash'; export const links = [ , @@ -25,16 +26,47 @@ export function getLink (index) { @injectIntl export default class TabsBar extends React.Component { + static contextTypes = { + router: PropTypes.object.isRequired, + } + static propTypes = { intl: PropTypes.object.isRequired, } + setRef = ref => { + this.node = ref; + } + + handleClick = (e) => { + e.preventDefault(); + e.persist(); + + requestAnimationFrame(() => { + const tabs = Array(...this.node.querySelectorAll('.tabs-bar__link')); + const currentTab = tabs.find(tab => tab.classList.contains('active')); + const nextTab = tabs.find(tab => tab.contains(e.target)); + const { props: { to } } = links[Array(...this.node.childNodes).indexOf(nextTab)]; + + currentTab.classList.remove('active'); + + const listener = debounce(() => { + nextTab.removeEventListener('transitionend', listener); + this.context.router.history.push(to); + }, 50); + + nextTab.addEventListener('transitionend', listener); + nextTab.classList.add('active'); + }); + + } + render () { const { intl: { formatMessage } } = this.props; return ( -