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 new notice about latest release #2798

Merged
merged 6 commits into from
Apr 17, 2024
Merged

Add new notice about latest release #2798

merged 6 commits into from
Apr 17, 2024

Conversation

yscik
Copy link
Contributor

@yscik yscik commented Mar 27, 2024

Fixes #2796

Changes Proposed in this Pull Request

  • Add a new release notice class
  • Add new styles and options to support this notice layout

Testing Instructions

  • Notice should show up on the Job Manager (Job Listings) admin screen
  • Disable Job Statistics in the settings
  • In the notice, click 'Enable'. Check that the setting is enabled and the notice disappears
  • Check that dismissing the various notices makes them disappear, even after refreshing the page
  • Use wp option delete wp_job_manager_dismissed_notices to un-dismiss all notices
  • Also check if the notice text needs any improvements

Screenshot / Video

image
Plugin build for 317970f
📦 Download plugin zip
▶️ Open in playground

@yscik yscik self-assigned this Mar 27, 2024
@yscik yscik requested a review from a team March 28, 2024 16:41
@yscik yscik linked an issue Apr 2, 2024 that may be closed by this pull request
Copy link
Contributor

@gikaragia gikaragia left a comment

Choose a reason for hiding this comment

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

Looks great overall! First time taking a look at stats so forgive my ignorance on topics already discussed.

  • Why do we have stats disabled by default? Generally, most people will simply dismiss notices without reading them and we shouldn't hide exciting new functionality behind settings I think. Maybe the actions in the notice should be 'Dismiss' and a redirect to settings for 'Disable'?
  • I think the notice itself is a bit too big as it takes almost half of my screen. Is it possible to reduce its height a bit?
  • I don't think that we should display the notice in new installations as it seems that it is directed to existing users.

There is also some minor Psalm errors

includes/admin/class-release-notice.php Outdated Show resolved Hide resolved
wp_die( esc_html__( 'You don’t have permission to do this.', 'wp-job-manager' ) );
}

do_action( 'job_manager_action_' . $action );
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I would avoid dynamic hook name because they are hard to find and document. You can pass the action as an argument

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a pretty common pattern in WordPress and WPJM, like wp_ajax_*, admin_action_*. A bit harder to search but cleaner and faster to use.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah whenever I encountered it in the existing cases it always needed extra time to figure out. It usually goes like this:

  • You use the hotkey to go to the hook definition. This doesn't work because the IDE can't figure out dynamic hooks.
  • Then I search for the whole name
  • Then I search for parts of the hook. It is also very common during this step for the results to be too many as the parts of the hook name are very commonly used for other things like variables or function names.

I don't see how dynamic hooks are cleaner as instead of doing concatenation we will pass an extra argument. The only downside is an extra check on the called method which I don't think is important enough.

includes/admin/class-release-notice.php Outdated Show resolved Hide resolved
includes/admin/class-release-notice.php Outdated Show resolved Hide resolved
@yscik
Copy link
Contributor Author

yscik commented Apr 12, 2024

Set up the plugin install/update hook to enable stats for new installs and skip this notice. Note that to test updating, the version in JOB_MANAGER_VERSION has to be bumped.

Also tweaked the size a bit, but the idea for this to be a little piece of news, I think we can take some real estate for it. It's only shown on the Job Manager screen — which eventually would be a 'Home' dashboard for news and things requiring action.

I didn't want to complicate things and used the notice style, but we can tone it down a little and make this a more like News box:

image

@yscik yscik requested a review from gikaragia April 12, 2024 14:26
Copy link
Contributor

@gikaragia gikaragia left a comment

Choose a reason for hiding this comment

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

Looks better now!

Note that to test updating, the version in JOB_MANAGER_VERSION has to be bumped.

Probably I'm missing something here as I didn't need to do any updates for the notice to show.

This comment made me think though, how are we going to handle the release notices in versions after 2.3.0. We maybe don't want to show the notice to users upgrading to 2.4.0 directly. Maybe we shouldn't mention the version at all in the notice? Or maybe add an extra step to the release steps to stop showing the Release_Notice class. Maybe it isn't big of a deal though and we could just show it to everyone updating to a a post-2.3.0 version.

There is also the issue with the dynamic hook but I don't consider it a blocker

@yscik
Copy link
Contributor Author

yscik commented Apr 15, 2024

This comment made me think though, how are we going to handle the release notices in versions after 2.3.0. We maybe don't want to show the notice to users upgrading to 2.4.0 directly. Maybe we shouldn't mention the version at all in the notice? Or maybe add an extra step to the release steps to stop showing the Release_Notice class. Maybe it isn't big of a deal though and we could just show it to everyone updating to a a post-2.3.0 version.

Right now the idea is to update the Release_Notice class with new content for 2.4.0 — or just unhook it if we don't want to show a notice then. Eventually it'd be nice if this were a server-based noticed, so we can update it on wpjobmanager.com and even show what's new in an update to folks who haven't updated yet.

@gikaragia
Copy link
Contributor

Makes sense! Could we add a comment in the release steps as something to check?

@yscik
Copy link
Contributor Author

yscik commented Apr 15, 2024

Updated the release checklist here: P6r3EZ-1Q-p2

Base automatically changed from feature/stats to trunk April 16, 2024 10:30
@yscik yscik merged commit f51a22e into trunk Apr 17, 2024
11 checks passed
@yscik yscik deleted the add/release-notice branch April 17, 2024 11:07
@yscik yscik added this to the 2.3.0 milestone Apr 22, 2024
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.

Stats: add feature announcement notice
2 participants