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

Introduce advanced Exclude tab to replace Connectors tab #251 #278

Merged
merged 15 commits into from
Mar 7, 2014
Merged

Introduce advanced Exclude tab to replace Connectors tab #251 #278

merged 15 commits into from
Mar 7, 2014

Conversation

faishal
Copy link
Contributor

@faishal faishal commented Feb 25, 2014

Resolved #251

  1. Added Exclude setting with backwards compatibility.
  2. Restricting record being logged as per exclude setting.

* @param string Current class name
* @return bool
*/
return apply_filters( 'wp_stream_record_log', $bool, $user, get_called_class() );
Copy link
Contributor

Choose a reason for hiding this comment

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

@faishal nice! even including hook docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

@faishal Unless we have this filter somewhere else with the same name, and receiving same input, we should change the filter name to reflect what it really does.
It'd also be great if we can change the description to something like Filter to exclude actions of a specific user from being logged or something.
Nice work man! /five!

Copy link
Contributor

Choose a reason for hiding this comment

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

@faishal Also wanted to leave a /five for this!

@faishal
Copy link
Contributor Author

faishal commented Feb 25, 2014

@westonruter Thanks for your suggestion, I have fixed all the issues that you mention in comments.

Also fix issues ocure after merging develop branch

@westonruter
Copy link
Contributor

@faishal cheers!

@fjarrett @shadyvb over to you!

@@ -31,6 +31,9 @@ public static function register() {
if ( ! self::is_logging_enabled_for_user() ) {
return;
}
if ( ! self::is_logging_enabled_for_ip() ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding checks in the base class of all connector will cause it to be executed by all connectors while they try to register themselves, which is something we probably don't need. We probably need to move those checks ( including is_logging_enabled_for_user by @jonathanbardo ) to includes/connectors.php so it is done once on plugin load.
@fjarrett @jonathanbardo What do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I think it would be more efficient.

Copy link
Contributor

Choose a reason for hiding this comment

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

@faishal If you agree as well on this, please carry on with moving any redundant checks ( IP / User exclusion ) to the WP_Stream_Connectors class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shadyvb I am also agree with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shadyvb should i move functions is_logging_enabled_for_user & is_logging_enabled_for_ip into WP_Stream_Settings because it is a part of settings

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer putting them in the same class that'll use them, just to make it easier for people dealing with the same functionality later. Unless other classes would be using them, which is a far aim in this scenario.

$labels
), $old_options [ 'connectors_active_connectors' ]
);
unset( self::$options[ 'connectors_active_connectors' ] );
Copy link
Contributor

Choose a reason for hiding this comment

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

@faishal Also, the space usage within brackets is incorrect throughout the code in this PR, according to WP coding standards.

self::$options['connectors_active_connectors']

"When referring to array items, only include a space around the index if it is a variable"

cf. http://make.wordpress.org/core/handbook/coding-standards/php/#space-usage

@shadyvb
Copy link
Contributor

shadyvb commented Feb 26, 2014

With all the CS comments from @fjarrett , i'm curios to know if @faishal did setup pre-commit hook with dependencies ( phpcs / jslint etc.. ). Would make it way easier for @faishal to correct stuff like that.
Note: Setup instructions should be available in https://github.com/x-team/wp-stream/blob/master/contributing.md

@faishal
Copy link
Contributor Author

faishal commented Feb 26, 2014

@shadyvb I use phpStorm, in that i have configure codesniffer for wordpress standards and also show sniffer warning as ERROR, so if i missed something then it will alert me.

I also checked it by run command manually on terminal before pushing it to master, but i not found any error in that also.

pre-commit idea is also good.

@shadyvb
Copy link
Contributor

shadyvb commented Feb 26, 2014

We do have a pre-commit file inside bin directory, you'd just need to symlink it to .git/hooks so it works properly, more info on that is found on our plugin boilerplate repo.

Also i'm not sure if this would be helpful to you, but we do have a configuration template for phpstorm that should make it easier to follow WPCS as well, check it out.

@westonruter
Copy link
Contributor

@shadyvb The pre-commit hook wouldn't have helped because, as you see, our sniffs aren't fleshed out fully with all of the WordPress coding conventions. Travis isn't complaining here, so the pre-commit hook wouldn't complain either. So yeah, it would be good to create some new WPCS issues for enforcing the conventions we've discussed in this PR.

@faishal
Copy link
Contributor Author

faishal commented Feb 27, 2014

@shadyvb @fjarrett I have fixed all the issues that you mention in comments.

@shadyvb
Copy link
Contributor

shadyvb commented Feb 27, 2014

@faishal There seem to be some conflicts with develop, please merge and resolve them.

Great work!

@faishal
Copy link
Contributor Author

faishal commented Feb 27, 2014

@shadyvb Thanks, I just fixed that conflicts and other issues

@frankiejarrett
Copy link
Contributor

@faishal I've been testing this, and it's working quite nicely! There are only two issues that I can find that need to be resolved before we merge this feature:

  1. In Disabled connectors should be removed from default queries and filter dropdowns #223 we removed references to excluded Connectors from appearing anywhere in the Stream. So now that we are able to exclude Author, Role, Context, Action and IP - the same must be done for those as well.
  2. We must also ensure that the Live Update of the Stream does not try to bring in any previously-tracked activity that is now excluded. For instance, if I update a page and then decide to exclude the "Update" action, the live update should not let it enter the Stream because it should be excluded.

@frankiejarrett frankiejarrett self-assigned this Feb 28, 2014
@frankiejarrett
Copy link
Contributor

@faishal Do let me know if you have any questions regarding the two issues I mentioned above.

@faishal
Copy link
Contributor Author

faishal commented Mar 4, 2014

@fjarrett Sorry for delay, I just started looking in to it.
Regarding 1st issue, I am confuse about roles related references as we stored user_id in database and 2nd issue is already done.

@frankiejarrett
Copy link
Contributor

@faishal You're right about the Role, doesn't look like we'll be able to easily omit records based on that. However, the others (author, context, action, IP) we should be able to completely hide from the Stream, correct?

Regarding my second point, please disregard it. I believe my testing was flawed here, I must have been tired 😄

@faishal
Copy link
Contributor Author

faishal commented Mar 5, 2014

Absolutely correct @fjarrett.

@faishal
Copy link
Contributor Author

faishal commented Mar 7, 2014

@fjarrett, is anything else left to be done in here?

@frankiejarrett
Copy link
Contributor

@faishal I'm going to fully test this here in a few hours and I'll let you know.

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.

Introduce advanced Exclude tab to replace Connectors tab
5 participants