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

[BUG] 关于页面保护级别的故障/The bug is about the page protection #26

Closed
huxiangyou opened this issue Apr 15, 2020 · 4 comments · Fixed by #21, #42 or #48
Closed

[BUG] 关于页面保护级别的故障/The bug is about the page protection #26

huxiangyou opened this issue Apr 15, 2020 · 4 comments · Fixed by #21, #42 or #48
Assignees
Labels
bug Something isn't working level-1 Push a hotfix now!

Comments

@huxiangyou
Copy link

huxiangyou commented Apr 15, 2020

简述此故障/Describe the bug

部分页面仅“移动保护”(即不允许移动),但使用快速编辑会提示“无编辑权限”。

如何重现此故障/To Reproduce

萌娘百科的公开沙盒上,使用非管理员的账号进行快速编辑。

你的设备信息/Your device info

PC端/Desktop

Chrome.

补充说明/Additional context

问题出在script.js的第431行。此处直接取的protection的第0个。但如上述例子中,页面仅对“移动”(move)有保护,而对编辑(edit)未保护,取第0个protection即为移动保护。应修改成查找protection[i].type === edit,再读取其protection[i].level

通常页面的protection"protection": [],
全保护页面的protection"protection": [{"type": "edit", "level": "sysop", "expiry": "infinity"}, {"type": "move", "level": "sysop", "expiry": "infinity"}],
仅移动保护页面的protection"protection": [{"type": "move", "level": "sysop", "expiry": "infinity"}],

@dragon-fish dragon-fish added the bug Something isn't working label Apr 15, 2020
@dragon-fish
Copy link
Member

记录典型result用于debug

禁止移动

{
  "batchcomplete": "",
  "query": {
    "pages": {
      "185503": {
        "pageid": 185503,
        "ns": 12,
        "title": "Help:沙盒",
        "revisions": [
          {
            "revid": 3626690,
            "parentid": 3625988,
            "user": "九江月",
            "timestamp": "2020-04-16T14:32:45Z",
            "comment": "/* 請在這行文字底下進行您的測試 */"
          }
        ],
        "contentmodel": "wikitext",
        "pagelanguage": "zh",
        "pagelanguagehtmlcode": "zh",
        "pagelanguagedir": "ltr",
        "touched": "2020-04-16T14:32:45Z",
        "lastrevid": 3626690,
        "length": 140,
        "protection": [
          {
            "type": "move",
            "level": "sysop",
            "expiry": "infinity"
          }
        ],
        "restrictiontypes": [
          "edit",
          "move"
        ]
      }
    }
  }
}

禁止移动且禁止编辑

{
  "batchcomplete": "",
  "query": {
    "pages": {
      "129": {
        "pageid": 129,
        "ns": 0,
        "title": "受限制页面",
        "revisions": [
          {
            "revid": 1699,
            "parentid": 1697,
            "user": "机智的小鱼君",
            "timestamp": "2019-12-05T07:49:02Z",
            "comment": "[InPageEdit] 没有编辑摘要"
          }
        ],
        "contentmodel": "wikitext",
        "pagelanguage": "en",
        "pagelanguagehtmlcode": "en",
        "pagelanguagedir": "ltr",
        "touched": "2019-12-05T07:49:02Z",
        "lastrevid": 1699,
        "length": 6,
        "protection": [
          {
            "type": "edit",
            "level": "sysop",
            "expiry": "infinity"
          },
          {
            "type": "move",
            "level": "sysop",
            "expiry": "infinity"
          }
        ],
        "restrictiontypes": [
          "edit",
          "move"
        ]
      }
    }
  }
}

@dragon-fish dragon-fish added the Review Action has been taken and the result is awaited label Apr 16, 2020
dragon-fish added a commit that referenced this issue Apr 16, 2020
* 移动logo到src文件夹
* 测试新的更新日志格式
* 测试新的关于页面
* 修复 #26
@dragon-fish
Copy link
Member

dragon-fish commented Apr 16, 2020

dragon-fish added a commit that referenced this issue Apr 17, 2020
* 2020年4月17日02:45:05

* 移动logo到src文件夹
* 测试新的更新日志格式
* 测试新的关于页面
* 修复 #26

* Update versionInfo

* Update CSS

Co-authored-by: 机智的小鱼君 <dragon-fish@qq.com>
@dragon-fish dragon-fish linked a pull request Apr 23, 2020 that will close this issue
@dragon-fish dragon-fish added level-1 Push a hotfix now! Reopened and removed Review Action has been taken and the result is awaited labels Apr 23, 2020
@dragon-fish
Copy link
Member

#40 (comment)

@dragon-fish dragon-fish linked a pull request Apr 23, 2020 that will close this issue
@dragon-fish dragon-fish linked a pull request May 7, 2020 that will close this issue
@dragon-fish
Copy link
Member

@dragon-fish dragon-fish added the Review Action has been taken and the result is awaited label May 7, 2020
@dragon-fish dragon-fish removed Reopened Review Action has been taken and the result is awaited labels May 11, 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 level-1 Push a hotfix now!
Projects
None yet
2 participants