Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posted From Feature #1122

Merged
merged 31 commits into from
Dec 2, 2017
Merged

Posted From Feature #1122

merged 31 commits into from
Dec 2, 2017

Conversation

Kennybll
Copy link
Contributor

Show the app used to publish a post in the UI.

Changes:

  • Adds a formatted message telling what app the post was posted by. Ex: Posted by busy
  • There is a tooltip around that, which says the version of that app.

@Kennybll
Copy link
Contributor Author

From Workflow https://github.com/busyorg/busy/projects/6

@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 05:56 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 14:34 Inactive
@Sekhmet
Copy link
Contributor

Sekhmet commented Nov 28, 2017

JSON.parse can fail, and when it does it throws error making React go wild.
Can you make it fail-safe?
https://gist.github.com/gucheen/12b90451f04733078d7f

@bonustrack
Copy link
Contributor

@Kennybll here is my review:

  • The tag should appear next to the reputation indicator, now there is this long space due to Posted from steemit text width see:
    image
  • The text Posted from steemit is too long et repetitive, i prefer just Steemit instead.
  • This should also appear in single post
  • We should save a list of apps in json file with name of app with correct case for example:
{
  steemit: 'Steemit',
  busy: 'Busy',
  esteem: 'eSteem',
  chainbb: 'chainBB',
}

@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:49 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:49 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:50 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:50 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:51 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:51 Inactive
@Kennybll
Copy link
Contributor Author

Also fixes issue #1111.

@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 16:53 Inactive
@bonustrack
Copy link
Contributor

@Kennybll in future please use more relevant name for your commits

@Kennybll
Copy link
Contributor Author

Okay.

@Sekhmet
Copy link
Contributor

Sekhmet commented Nov 28, 2017

@Kennybll

  1. Make sure that your PRs do one thing and only one.
  2. Don't integrate changes outside of base branch (master in this case) if it's not relevant to your PR.

Updates color property on __post_from
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 28, 2017 17:01 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 29, 2017 16:32 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 29, 2017 16:33 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 29, 2017 16:33 Inactive
@Kennybll
Copy link
Contributor Author

Kennybll commented Nov 29, 2017

Again sorry for so many commit, they all are different files that are changed because Github.com doesn't allow multiple file commits. Git on my Windows laptop isn't working so well.

@Kennybll
Copy link
Contributor Author

There @Sekhmet . Is there any other things you guys tend to not do, so I can be prepared in the future?
I remember you once said you put styles at the bottom of the imports.

Copy link
Contributor

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any written rules, but we try to make our codebase consistent. I think that code should speak for itself and that code is the best guideline.

If there is something related to code style that can be improved it should be discussed first and update an entire codebase to make sure everything is consistent.

I'm not sure what kind of git client are you using, but I think it should support committing multiple files. I recommend using command line git though.

import { jsonParse } from '../../helpers/formatter';
import './PostedFromEmbed.less';

const PostedFromEmbed = ({ post }) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this called PostedFromEmbed? Just PostedFrom makes sense in my opinion

<FormattedMessage
id="posted_from_tooltip"
defaultMessage={'Version: {version}'}
values={{ version: jsonParse(post.json_metadata).app.split('/')[1] }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to parse metadata three times. We can do it just once. and save name and version in a variable.
This won't work too well if the app is no present (it will throw exception crashing React).

<FormattedRelative value={`${post.created}Z`} />
</span>
</Tooltip>
<PostedFromEmbed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's short enough to fit in one line.

@@ -57,6 +57,10 @@
padding: 16px;
display: flex;

&__flex {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. On line 238. I had to make that span display flex because the Topic tag would be on the next line next to the date posted.

@@ -311,7 +312,10 @@ class StoryFull extends React.Component {
<FormattedRelative value={`${post.created}Z`} />
</span>
</Tooltip>
{ Math.ceil(readingTime(post.body).minutes) > 1 &&
<PostedFromEmbed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can fit on one line as well.

@@ -54,7 +54,12 @@
position: relative;
display: flex;
padding: 16px 0;


&__post_from {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this isn't used as well.

"power_down_message": "Started power down: {value}"
"power_down_message": "Started power down: {value}",
"posted_from_tooltip": "Version: {version}",
"posted_from": "{from}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need translation for posted_from. It should just display app name.


const PostedFromEmbed = ({ post }) => (
<span>
<span className="PostedFrom__bullet" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS class name should have the same name as component PostedFormEmbed. It doesn't make a difference though as I think it should be renamed.

import './PostedFromEmbed.less';

const PostedFromEmbed = ({ post }) => (
<span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to add a class name to a topmost element in this component (to respect http://getbem.com/introduction guidelines).

@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 29, 2017 21:32 Inactive
@Kennybll
Copy link
Contributor Author

@Sekhmet , so I figured out what was wrong with git on my computer. Nothing! Lol. I thought the process was hanging, but nope, it was running the pre-commit tests. It just took a minute to output something.

@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 29, 2017 21:55 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 November 30, 2017 21:28 Inactive
@Kennybll
Copy link
Contributor Author

Is this good @Sekhmet @bonustrack ?

@@ -54,7 +58,7 @@
position: relative;
display: flex;
padding: 16px 0;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is additional whitespace there.

esteem: 'eSteem',
chainbb: 'chainBB',
utopian: 'Utopian',
dtube: 'dTube',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's DTube, DSound and dMania (not dTube and dSound). Can you fix the case?

@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 December 1, 2017 19:29 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 December 1, 2017 19:41 Inactive
@bonustrack bonustrack temporarily deployed to busy-master-pr-1122 December 1, 2017 20:36 Inactive
@bonustrack bonustrack merged commit 3637e23 into busyorg:master Dec 2, 2017
@bonustrack bonustrack added this to the v2.2 milestone Dec 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants