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

快速差异模块比较被隐藏的版本时出现问题 #5

Closed
dragon-fish opened this issue Apr 3, 2020 · 3 comments
Closed

快速差异模块比较被隐藏的版本时出现问题 #5

dragon-fish opened this issue Apr 3, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@dragon-fish
Copy link
Member

dragon-fish commented Apr 3, 2020

简述此故障/Describe the bug

Minecraft Wiki用户Hatsuki kiri反馈:快速差异模块比较被隐藏的版本时出现问题,不论是否有权限查看被隐藏版本,都不会收到任何提示。

如何重现此故障/To Reproduce

Steps to reproduce the behavior:

  1. 前往 https://minecraft-zh.gamepedia.com/index.php?title=Java%E7%89%881.16&action=history
  2. 找到 2020年4月3日 (五) 21:24 的版本
  3. 使用快速差异预览差异
  4. 当比较被隐藏的历史版本时,模态框内容变成白板
  5. 当用户有查看被隐藏的版本的权限时,仍可以正常显示改历史版本
    附无权限用户的控制台记录
XHRPOSThttps://minecraft-zh.gamepedia.com/api.php
[HTTP/2 200 OK 299ms]

JSON	
error	{…}
code	"missingcontent"
info	"Missing content for revision ID 398590."
*	"See https://minecraft-zh.gamepedia.com/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
响应载荷(payload)	

{"error":{"code":"missingcontent","info":"Missing content for revision ID 398590.","*":"See https://minecraft-zh.gamepedia.com/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."}}

本应出现的情况/Expected behavior

有权限的用户应收到一个“您正在预览被隐藏的版本”的提示,无权限的用户应该收到正常的报错,而不是一个白屏

@dragon-fish dragon-fish added the bug Something isn't working label Apr 3, 2020
@dragon-fish dragon-fish self-assigned this Apr 3, 2020
@dragon-fish
Copy link
Member Author

使用个人wiki重现场景,有权限查看被隐藏版本的用户控制台记录如下

XHRPOSThttps://www.wjghj.cn/api.php
[HTTP/1.1 200 OK 1077ms]
JSON	
compare	{…}
fromid	9771
fromrevid	20204
fromns	4
fromtitle	"小鱼君和他的朋友们:符号"
fromsize	5964
fromuser	"机智的小鱼君"
fromuserid	1
fromcomment	"[InPageEdit] 没有编辑摘要"
fromparsedcomment	"[InPageEdit] 没有编辑摘要"
toid	9771
torevid	20205
tons	4
totitle	"小鱼君和他的朋友们:符号"
tosize	5964
touser	"机智的小鱼君"
touserid	1
tocomment	"机智的小鱼君移动页面[[符号]]至[[小鱼君和他的朋友们:符号]]:重命名页面 → [[:project:符号]] //使用API进行的操作,请核查本次编辑"
toparsedcomment	"机智的小鱼君移动页面<a href=\"/wiki/%E7%AC%A6%E5%8F%B7\" class=\"mw-redirect\" title=\"符号\">符号</a>至<a href=\"/wiki/%E5%B0%8F%E9%B1%BC%E5%90%9B%E5%92%8C%E4%BB%96%E7%9A%84%E6%9C%8B%E5%8F%8B%E4%BB%AC:%E7%AC%A6%E5%8F%B7\" title=\"小鱼君和他的朋友们:符号\">小鱼君和他的朋友们:符号</a>:重命名页面 → <a href=\"/wiki/%E5%B0%8F%E9%B1%BC%E5%90%9B%E5%92%8C%E4%BB%96%E7%9A%84%E6%9C%8B%E5%8F%8B%E4%BB%AC:%E7%AC%A6%E5%8F%B7\" title=\"小鱼君和他的朋友们:符号\">project:符号</a> //使用API进行的操作,请核查本次编辑"
prev	20203
diffsize	0
*	""

响应载荷(payload)
{"compare":{"fromid":9771,"fromrevid":20204,"fromns":4,"fromtitle":"\u5c0f\u9c7c\u541b\u548c\u4ed6\u7684\u670b\u53cb\u4eec:\u7b26\u53f7","fromsize":5964,"fromuser":"\u673a\u667a\u7684\u5c0f\u9c7c\u541b","fromuserid":1,"fromcomment":"[InPageEdit] \u6ca1\u6709\u7f16\u8f91\u6458\u8981","fromparsedcomment":"[InPageEdit] \u6ca1\u6709\u7f16\u8f91\u6458\u8981","toid":9771,"torevid":20205,"tons":4,"totitle":"\u5c0f\u9c7c\u541b\u548c\u4ed6\u7684\u670b\u53cb\u4eec:\u7b26\u53f7","tosize":5964,"touser":"\u673a\u667a\u7684\u5c0f\u9c7c\u541b","touserid":1,"tocomment":"\u673a\u667a\u7684\u5c0f\u9c7c\u541b\u79fb\u52a8\u9875\u9762[[\u7b26\u53f7]]\u81f3[[\u5c0f\u9c7c\u541b\u548c\u4ed6\u7684\u670b\u53cb\u4eec:\u7b26\u53f7]]\uff1a\u91cd\u547d\u540d\u9875\u9762 \u2192 [[:project:\u7b26\u53f7]] //\u4f7f\u7528API\u8fdb\u884c\u7684\u64cd\u4f5c\uff0c\u8bf7\u6838\u67e5\u672c\u6b21\u7f16\u8f91","toparsedcomment":"\u673a\u667a\u7684\u5c0f\u9c7c\u541b\u79fb\u52a8\u9875\u9762<a href=\"/wiki/%E7%AC%A6%E5%8F%B7\" class=\"mw-redirect\" title=\"\u7b26\u53f7\">\u7b26\u53f7</a>\u81f3<a href=\"/wiki/%E5%B0%8F%E9%B1%BC%E5%90%9B%E5%92%8C%E4%BB%96%E7%9A%84%E6%9C%8B%E5%8F%8B%E4%BB%AC:%E7%AC%A6%E5%8F%B7\" title=\"\u5c0f\u9c7c\u541b\u548c\u4ed6\u7684\u670b\u53cb\u4eec:\u7b26\u53f7\">\u5c0f\u9c7c\u541b\u548c\u4ed6\u7684\u670b\u53cb\u4eec:\u7b26\u53f7</a>\uff1a\u91cd\u547d\u540d\u9875\u9762 \u2192 <a href=\"/wiki/%E5%B0%8F%E9%B1%BC%E5%90%9B%E5%92%8C%E4%BB%96%E7%9A%84%E6%9C%8B%E5%8F%8B%E4%BB%AC:%E7%AC%A6%E5%8F%B7\" title=\"\u5c0f\u9c7c\u541b\u548c\u4ed6\u7684\u670b\u53cb\u4eec:\u7b26\u53f7\">project:\u7b26\u53f7</a> //\u4f7f\u7528API\u8fdb\u884c\u7684\u64cd\u4f5c\uff0c\u8bf7\u6838\u67e5\u672c\u6b21\u7f16\u8f91","prev":20203,"diffsize":0,"*":""}}

@dragon-fish
Copy link
Member Author

注意到以下几点:

用户有权限时

返回json中包含值fromtexthidden
调用console.log(data.compare.fromtexthidden)结果是""(空字符串)

用户无权限时

返回json包含参数code
键为error.code,值为missingcontent

@dragon-fish dragon-fish added the In progress Start working on label Apr 3, 2020
@dragon-fish
Copy link
Member Author

Fixed

用户有权限时,被隐藏的内容会显示为灰色并被横线贯穿;用户无权限时错误信息会被显示出来。

@dragon-fish dragon-fish added Closed and removed In progress Start working on labels Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant