Skip to content

Commit

Permalink
Release 2.5.1 (#2051)
Browse files Browse the repository at this point in the history
* Remove border-left/right and border-radius in Wallet/Activity page (#1935)

* Remove border-left/right and border-radius in Wallet/Activity page

In smaller device, page takes full width so blocks in Wallet and
Activity page now longer have border-left and border-right. These
CSS properties are visible for medium device and above.

Same for border-radius, on smaller device it is creating unwanted
white-space. Border-radius is only available on medium device and
above.

* Adjust border and border-radius for multiple view ports

- Remove border right on medium devices
- Remove border-radius for smaller devices

* Add border-radius on Wallet and Activity medium or greater screens

* Add loader class instead of inline css

Add UserActivityActions__loader and related css.

* use npm packages instead of git (#2034)

* use develop as upstream branch (#2035)

* update BBackTop logic (#2036)

* Fix activity formatting on unfamiliar custom json operations (#1909) (#2037)

* fix: refresh login based on loaded, not authenticated prop (#2042)

* fix: add UPVOTE_LOCKOUT error fingerprint (#2043)

* fix: subtract delegated_vesting_shares from available shares (#2047)

* fix: always set current images, links, users and tags (#2048)

* feat: add create json metadata for comments (#2049)

* Release 2.5.1
  • Loading branch information
Sekhmet committed Jul 9, 2018
1 parent 27dd238 commit 13cd109
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 183 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "busy",
"version": "2.5.0",
"version": "2.5.1",
"engines": {
"node": ">=7.10.1",
"npm": "=5.3.0"
Expand Down Expand Up @@ -50,7 +50,7 @@
"babel-register": "^6.24.1",
"babel-runtime": "^6.18.0",
"bs58": "^4.0.0",
"busyjs": "https://github.com/busyorg/busyjs#dev",
"busyjs": "^1.0.2",
"cheerio": "^1.0.0-rc.2",
"classnames": "^2.2.5",
"cookie-parser": "^1.4.3",
Expand Down Expand Up @@ -101,7 +101,7 @@
"sc2-sdk": "^1.0.1",
"secure-random": "^1.1.1",
"speakingurl": "^11.0.0",
"steemscript": "https://github.com/busyorg/steemscript.git",
"steemscript": "^1.0.1",
"store": "^1.3.20",
"striptags": "^2.1.1",
"text-ellipsis": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/getChangedFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function execGitCmd(args) {
}

function getChangedFiles() {
const mergeBase = execGitCmd(['merge-base', 'HEAD', 'master']);
const mergeBase = execGitCmd(['merge-base', 'HEAD', 'develop']);
return [
...execGitCmd(['diff', '--name-only', '--diff-filter=ACMRTUB', mergeBase]),
...execGitCmd(['ls-files', '--others', '--exclude-standard']),
Expand Down
2 changes: 1 addition & 1 deletion src/client/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export default class Wrapper extends React.PureComponent {
<Transfer />
<PowerUpOrDown />
<NotificationPopup />
<BBackTop />
<BBackTop className="primary-modal" />
</div>
</Layout>
</LocaleProvider>
Expand Down
11 changes: 10 additions & 1 deletion src/client/activity/UserActionContents.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import _ from 'lodash';
import * as accountHistory from '../../common/constants/accountHistory';

const UserActionContents = ({ actionType, actionDetails }) => {
if (_.includes(accountHistory.PARSED_PROPERTIES, actionType)) {
if (actionType === accountHistory.CUSTOM_JSON) {
// Special case: Follow, Unfollow, Reblog, Mute operations are
// a part of custom json operations with actionDetails.id as "follow".
// We have a parser for these ops, however we cannot parse
// every custom json since it's flexible and there is no
// standard for the structure of custom_json ops.
if (_.includes(accountHistory.PARSED_CUSTOM_JSON_IDS, actionDetails.id)) {
return null;
}
} else if (_.includes(accountHistory.PARSED_PROPERTIES, actionType)) {
return null;
}

Expand Down
3 changes: 3 additions & 0 deletions src/client/activity/UserActionIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class UserActionIcon extends React.Component {
const customActionType = actionJSON[0];
const customActionDetails = actionJSON[1];

if (!_.includes(accountHistoryConstants.PARSED_CUSTOM_JSON_IDS, actionDetails.id)) {
return 'icon-document';
}
if (
customActionType === accountHistoryConstants.REBLOG &&
currentUsername === customActionDetails.account
Expand Down
10 changes: 9 additions & 1 deletion src/client/activity/UserActionMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage, FormattedNumber } from 'react-intl';
import { Link } from 'react-router-dom';
import _ from 'lodash';
import formatter from '../helpers/steemitFormatter';
import * as accountHistoryConstants from '../../common/constants/accountHistory';
import VoteActionMessage from './VoteActionMessage';
Expand All @@ -18,6 +19,10 @@ class UserActionMessage extends React.Component {
currentUsername: PropTypes.string.isRequired,
};

static renderDefault(actionType) {
return <FormattedMessage id={actionType} defaultMessage={actionType} />;
}

renderFormattedMessage() {
const {
actionType,
Expand Down Expand Up @@ -89,6 +94,9 @@ class UserActionMessage extends React.Component {
/>
);
case accountHistoryConstants.CUSTOM_JSON:
if (!_.includes(accountHistoryConstants.PARSED_CUSTOM_JSON_IDS, actionDetails.id)) {
return UserActionMessage.renderDefault(actionType);
}
return <CustomJSONMessage actionDetails={actionDetails} />;
case accountHistoryConstants.ACCOUNT_UPDATE:
return <FormattedMessage id="account_updated" defaultMessage="Account Updated" />;
Expand Down Expand Up @@ -184,7 +192,7 @@ class UserActionMessage extends React.Component {
/>
);
default:
return <FormattedMessage id={actionType} defaultMessage={actionType} />;
return UserActionMessage.renderDefault(actionType);
}
}
render() {
Expand Down
32 changes: 21 additions & 11 deletions src/client/activity/UserActivityActions.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,41 @@
color: @grey-nightRider;
display: flex;
padding: 10px 15px;
border-right: @base-border;
border-left: @base-border;
border-bottom: @base-border;

&:nth-of-type(2) {
border-top: @base-border;
border-top-left-radius: 0;
border-top-right-radius: 0;
@media @small {
}

@media @small {
border-right: @base-border;
border-left: @base-border;

&:nth-of-type(2),
&:last-of-type {
border-top-left-radius: @border-radius-base;
border-top-right-radius: @border-radius-base;
}
}

&:last-of-type {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;

@media @small {
&:last-of-type {
border-bottom-left-radius: @border-radius-base;
border-bottom-right-radius: @border-radius-base;
}
}
}

&__loader {
border-bottom: @base-border;
padding: 20px;

@media @small {
border-right: @base-border;
border-left: @base-border;
border-bottom-left-radius: @border-radius-base;
border-bottom-right-radius: @border-radius-base;
}
}

&__memo {
word-wrap: break-word;
}
Expand Down
6 changes: 4 additions & 2 deletions src/client/activity/UserActivityActionsLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ class UserActivityActionsLoader extends React.Component {
const { loadingMoreUsersAccountHistory } = this.props;
if (loadingMoreUsersAccountHistory) {
return (
<div style={{ margin: '20px' }}>
<Loading />
<div>
<div className="UserActivityActions__loader">
<Loading />
</div>
</div>
);
}
Expand Down
8 changes: 5 additions & 3 deletions src/client/auth/authActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Cookie from 'js-cookie';
import { createAction } from 'redux-actions';
import { getAuthenticatedUserName, getIsAuthenticated } from '../reducers';
import { getAuthenticatedUserName, getIsAuthenticated, getIsLoaded } from '../reducers';
import { createAsyncActionType } from '../helpers/stateHelpers';
import { addNewNotification } from '../app/appActions';
import { getFollowing } from '../user/userActions';
Expand All @@ -24,9 +24,11 @@ export const BUSY_LOGIN = createAsyncActionType('@auth/BUSY_LOGIN');
const loginError = createAction(LOGIN_ERROR);

export const login = () => (dispatch, getState, { steemConnectAPI }) => {
const state = getState();

let promise = Promise.resolve(null);

if (getIsAuthenticated(getState())) {
if (getIsLoaded(state)) {
promise = Promise.resolve(null);
} else if (!steemConnectAPI.options.accessToken) {
promise = Promise.reject(new Error('There is not accessToken present'));
Expand All @@ -40,7 +42,7 @@ export const login = () => (dispatch, getState, { steemConnectAPI }) => {
promise,
},
meta: {
refresh: getIsAuthenticated(getState()),
refresh: getIsLoaded(state),
},
}).catch(() => dispatch(loginError()));
};
Expand Down
14 changes: 7 additions & 7 deletions src/client/comments/commentsActions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { createAction } from 'redux-actions';
import { createCommentPermlink, getBodyPatchIfSmaller } from '../vendor/steemitHelpers';
import { notify } from '../app/Notification/notificationActions';
import { jsonParse } from '../../client/helpers/formatter';

const version = require('../../../package.json').version;
import { jsonParse } from '../helpers/formatter';
import { createPostMetadata } from '../helpers/postHelpers';

export const GET_COMMENTS = 'GET_COMMENTS';
export const GET_COMMENTS_START = 'GET_COMMENTS_START';
Expand Down Expand Up @@ -99,10 +98,11 @@ export const sendComment = (parentPost, body, isUpdating = false, originalCommen
? originalComment.permlink
: createCommentPermlink(parentAuthor, parentPermlink);

const defaultJsonMetadata = { tags: [category], community: 'busy', app: `busy/${version}` };
const jsonMetadata = isUpdating
? jsonParse(originalComment.json_metadata) || defaultJsonMetadata
: defaultJsonMetadata;
const jsonMetadata = createPostMetadata(
body,
[category],
isUpdating && jsonParse(originalComment.json_metadata),
);

const newBody = isUpdating ? getBodyPatchIfSmaller(originalComment.body, body) : body;

Expand Down
99 changes: 23 additions & 76 deletions src/client/components/BBackTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,28 @@ import { BackTop } from 'antd';
import classNames from 'classnames';
import './BBackTop.less';

class BBackTop extends React.Component {
static propTypes = {
isModal: PropTypes.bool,
target: PropTypes.func,
toggleHeight: PropTypes.number,
};

static defaultProps = {
isModal: false,
target: undefined,
toggleHeight: 100,
};

static getDefaultTarget() {
return window;
}

static getScroll(target) {
if (typeof window === 'undefined') return 0;

return target === window ? target.pageYOffset : target.scrollTop;
}

constructor(props) {
super(props);
this.state = {
visible: false,
};
}

componentDidMount() {
this.previousScroll = 0;
this.scrollEvent = this.getTarget().addEventListener('scroll', this.handleScroll);
}

componentWillUnmount() {
if (this.scrollEvent) this.scrollEvent.remove();
}

getTarget = () => (this.props.target || BBackTop.getDefaultTarget)();

handleScroll = () => {
const currentScroll = BBackTop.getScroll(this.getTarget());
if (currentScroll === 0) {
this.previousScroll = 0;
return;
}

const diff = currentScroll - this.previousScroll;
if (diff > 0) {
this.previousScroll = currentScroll;
this.setState({ visible: false });
} else if (diff < -this.props.toggleHeight) {
this.setState({ visible: true });
}
};

render() {
const { isModal, toggleHeight, ...otherProps } = this.props;
return (
this.state.visible && (
<div className="BBackTop">
<div
className={classNames('BBackTop__container', {
'BBackTop__container--shifted': this.props.isModal,
})}
>
<BackTop className="BBackTop_button" {...otherProps}>
<i className="iconfont icon-back-top" />
</BackTop>
</div>
</div>
)
);
}
export default function BBackTop({ className, isModal, ...otherProps }) {
return (
<div className="BBackTop">
<div
className={classNames(className, 'BBackTop__container', {
'BBackTop__container--shifted': isModal,
})}
>
<BackTop className="BBackTop_button" {...otherProps}>
<i className="iconfont icon-back-top" />
</BackTop>
</div>
</div>
);
}

export default BBackTop;
BBackTop.propTypes = {
className: PropTypes.string,
isModal: PropTypes.bool,
};

BBackTop.defaultProps = {
className: '',
isModal: false,
};
4 changes: 4 additions & 0 deletions src/client/helpers/__tests__/errorMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ describe('parseBlockChainError', () => {
expected =
'Your voting power is too small, please accumulate more voting power or steem power.';
expect(actual).toEqual(expected);

actual = parseBlockChainError('Cannot increase payout within last twelve hours before payout.');
expected = "You can't increase payout within last twelve hours before payout.";
expect(actual).toEqual(expected);
});

it('should extract message from unknown error', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/client/helpers/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function extractImageTags(body) {
}

export function extractLinks(body) {
return extract(body, hrefRegex);
return extract(body, hrefRegex).map(_.unescape);
}

export default null;
Loading

0 comments on commit 13cd109

Please sign in to comment.