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

Add tweet status column for supported post types #121

Merged
merged 10 commits into from
Mar 3, 2021

Conversation

thrijith
Copy link
Member

@thrijith thrijith commented Feb 2, 2021

Description of the Change

Adds changes outlined in #56

Verification Process

  • Enabled and activate the plugin, made changes for adding custom column in feature/add-custom-filter
  • Tested post list for tweeted posts

Normal view
Screenshot 2021-02-02 at 11 11 13 PM

Hover view

Screenshot 2021-02-02 at 11 12 01 PM

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Fixes #56

Changelog Entry

Add Tweet status column for supported / enabled post types.

@jeffpaul jeffpaul added this to the 1.1.0 milestone Feb 2, 2021
@jeffpaul jeffpaul requested a review from dinhtungdu February 2, 2021 19:36
Copy link
Contributor

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

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

Hi @thrijith, thank you for your PR, it looks good to me. However, there are some minor issues in your PR, can you please fix them to get this ready to be merged:

  • The post filter hasn't been added. I notice you set this PR as draft, so you may be working on it.
  • The tweeted icon in the table header shouldn't have a hover state.
  • The tweeted icon doesn't really match the one in the design to me, this one looks closer.
  • When you click on the tweeted icon (which opens the tweet page in a new tab), there are two blue dots on the left of the clicked icon.

$status = isset( $tweet_status['status'] ) ? $tweet_status['status'] : '';

if ( 'publish' !== $post_status || empty( $status ) ) {
echo '';
Copy link
Contributor

Choose a reason for hiding this comment

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

This echo call can be eliminated by check for the opposite conditions.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dinhtungdu updated, please check again.

// Loop through all the supported post types and add tweet status column.
$post_types = Utils\get_enabled_post_types();
foreach ( (array) $post_types as $post_type ) {
add_post_type_support( $post_type, POST_TYPE_SUPPORT_FEATURE );
Copy link
Contributor

Choose a reason for hiding this comment

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

this duplicates the functionalities of set_post_type_supports()

Copy link
Member Author

Choose a reason for hiding this comment

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

@dinhtungdu I've moved similar code to the other int hook function we already had.

Comment on lines 149 to 150
'<a href="' . esc_url( $twitter_url ) . '" target="_blank">
<span class="autoshare-for-twitter-status-logo" title="' . esc_attr( $tweet_title ) . '"></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

title attribute should be added to <a> instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dinhtungdu updated, please check again.

* @param int $post_id Post ID.
*/
function modify_post_type_add_tweet_status( $column_name, $post_id ) {
if ( 'is_tweeted' === $column_name ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using early return style can save us up to 2 indent levels.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dinhtungdu updated, please check again.

@thrijith
Copy link
Member Author

The post filter hasn't been added. I notice you set this PR as draft, so you may be working on it.

Yes, currently checking for options to do the same ref #56 (comment)

The tweeted icon in the table header shouldn't have a hover state.

Done.

The tweeted icon doesn't really match the one in the design to me, this one looks closer.

Unable to download the linked one, we need two for each hover and inactive state, not getting the issue with current icons.

When you click on the tweeted icon (which opens the tweet page in a new tab), there are two blue dots on the left of the clicked icon.

Done.

@jeffpaul jeffpaul requested a review from dinhtungdu February 12, 2021 16:32
@thrijith thrijith marked this pull request as ready for review February 12, 2021 21:04
@jeffpaul jeffpaul modified the milestones: 1.1.0, 1.0.5 Feb 12, 2021
@jeffpaul jeffpaul merged commit 9d52121 into 10up:develop Mar 3, 2021
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.

Finding Tweeted posts
3 participants