welcome-notice.js: the dismiss callback is sent as POST data, and `attr( 'disabled', true )` warns on WordPress 7.2
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 92/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, jquery
- 领域
- frontend
调研方向
打开 assets/js/src/welcome-notice.js:关闭请求围绕第 61–65 行构建,安装按钮在第 48 行附近被禁用。将 success: hideAndRemoveNotice 从 $.post 数据对象中移出,并用 .done( hideAndRemoveNotice ) 附加,然后将 installBtn.attr( 'disabled', true ) 改为 .prop( 'disabled', true )。要验证,请在开启 SCRIPT_DEBUG 的情况下加载欢迎通知并关闭它,检查通知仅在请求成功后消失,以及点击 Install & Activate Otter Blocks 时 jQuery Migrate 不再发出警告。
由索引模型根据 Issue 内容生成。
描述
What's wrong
Two small problems in assets/js/src/welcome-notice.js. Neither breaks the notice today.
-
Dismiss. Lines 61–65:
$.post( ajaxUrl, { nonce, action: 'fork_dismiss_welcome_notice', success: hideAndRemoveNotice, } );successis inside the data object, not passed as a callback. When jQuery serializes data it calls any function it finds, sohideAndRemoveNotice()runs immediately when the request is built, and the request carries an emptysuccess=field. As a result, the notice disappears even if the dismissal is not saved (for example after an expired nonce), and then comes back on the next page load. Found by reading the code. -
Disabled button. Line 48,
installBtn.attr( 'disabled', true );. WithSCRIPT_DEBUGon, WordPress 7.2's jQuery Migrate 3.6 logsJQMIGRATE: Boolean attribute 'disabled' is not set to its lowercased namewhen Install & Activate Otter Blocks is clicked. Seen on 7.2-RC2; the install still completes. WordPress plans to move to jQuery 4 in 7.3.
Suggested fix
$.post( ajaxUrl, { nonce, action: 'fork_dismiss_welcome_notice' } ).done( hideAndRemoveNotice );
and installBtn.prop( 'disabled', true );.
- 主要语言
- PHP
- 星标
- 0
- 派生
- 0
- 平均合并
- 1 小时 2 分钟
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeinwp/fork 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 1/5 1 小时以内 新手友好度 88/100
相似的 Issue
-
Change: check an identifier filter the same way in every tool - the order of somcp_search_orders未关闭consistency enhancement Orders
难度 1/5 1 小时以内 新手友好度 88/100
novalo-dev/Prestashop-MCP-Server#343 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
claude
难度 2/5 1-3 小时 新手友好度 72/100
sprain/sprainocchio#45 ·
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
sync-en
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复