From dbdd2e2dd3b7ac3f0c7681f92dcd289c11810d4b Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 18 Oct 2021 11:54:42 +0800 Subject: [PATCH] add: user template message setting --- .../template_message_settings_controller.rb | 36 ++ app/docs/slate/source/includes/_users.md | 248 ++++++++++-- .../create_or_assign.rb | 4 +- .../manage_project.rb | 8 +- app/models/user.rb | 4 +- app/models/user_template_message_setting.rb | 54 +++ .../index.json.jbuilder | 2 +- .../_detail.json.jbuilder | 5 + .../current_setting.json.jbuilder | 2 + .../update_setting.json.jbuilder | 2 + config/routes.rb | 2 + public/docs/api.html | 364 ++++++++++++++---- 12 files changed, 599 insertions(+), 132 deletions(-) create mode 100644 app/controllers/users/template_message_settings_controller.rb create mode 100644 app/views/users/template_message_settings/_detail.json.jbuilder create mode 100644 app/views/users/template_message_settings/current_setting.json.jbuilder create mode 100644 app/views/users/template_message_settings/update_setting.json.jbuilder diff --git a/app/controllers/users/template_message_settings_controller.rb b/app/controllers/users/template_message_settings_controller.rb new file mode 100644 index 000000000..2234e7301 --- /dev/null +++ b/app/controllers/users/template_message_settings_controller.rb @@ -0,0 +1,36 @@ +class Users::TemplateMessageSettingsController < Users::BaseController + before_action :check_auth + before_action :get_current_setting + + def current_setting + + end + + def update_setting + Rails.logger.info setting_params[:notification_body] + Rails.logger.info setting_params[:email_body] + + @current_setting.notification_body = setting_params[:notification_body].to_hash + @current_setting.email_body = setting_params[:email_body].to_hash + return render_error("保存失败") unless @current_setting.save! + end + + private + def check_auth + return render_forbidden unless current_user.admin? || observed_logged_user? + end + + def get_current_setting + @current_setting = @_observed_user.user_template_message_setting + @current_setting = UserTemplateMessageSetting.build(@_observed_user.id) if @current_setting.nil? + end + + def setting_params + params.require(:setting).permit(notification_body: {}, email_body: {}) + end + + def valid_setting_params + setting_params[:notification_body].keys.equal?(UserTemplateMessageSetting.init_notification_body.keys) && setting_params[:email_body].keys.equal?(UserTemplateMessageSetting.init_email_body) + end + +end \ No newline at end of file diff --git a/app/docs/slate/source/includes/_users.md b/app/docs/slate/source/includes/_users.md index d02516024..4df28755b 100644 --- a/app/docs/slate/source/includes/_users.md +++ b/app/docs/slate/source/includes/_users.md @@ -408,6 +408,31 @@ await octokit.request('GET /api/template_message_settings.json') "status": 0, "message": "响应成功", "setting_types": [ + { + "type": "TemplateMessageSetting::Normal", + "type_name": "", + "total_settings_count": 3, + "settings": [ + { + "name": "被拉入或移出组织", + "key": "Organization", + "notification_disabled": true, + "email_disabled": false + }, + { + "name": "被拉入或移出项目", + "key": "Project", + "notification_disabled": true, + "email_disabled": false + }, + { + "name": "有权限变更", + "key": "Permission", + "notification_disabled": true, + "email_disabled": false + } + ] + }, { "type": "TemplateMessageSetting::CreateOrAssign", "type_name": "我创建的或负责的", @@ -416,28 +441,24 @@ await octokit.request('GET /api/template_message_settings.json') { "name": "易修状态变更", "key": "IssueChanged", - "openning": true, "notification_disabled": true, "email_disabled": false }, { "name": "易修被指派", "key": "IssueAssigned", - "openning": true, "notification_disabled": true, "email_disabled": false }, { "name": "合并请求被指派", "key": "PullRequestAssigned", - "openning": true, "notification_disabled": true, "email_disabled": false }, { "name": "合并请求状态变更", "key": "PullRequestAssigned", - "openning": true, "notification_disabled": true, "email_disabled": false } @@ -450,57 +471,25 @@ await octokit.request('GET /api/template_message_settings.json') "settings": [ { "name": "有新的易修", - "key": "ProjectIssue", - "openning": true, + "key": "Issue", "notification_disabled": true, "email_disabled": false }, { "name": "有新的合并请求", - "key": "ProjectPullRequest", - "openning": true, + "key": "PullRequest", "notification_disabled": true, "email_disabled": false }, { "name": "有成员变动", - "key": "ProjectMember", - "openning": true, + "key": "Member", "notification_disabled": true, "email_disabled": false }, { "name": "设置更改", - "key": "ProjectSettingChanged", - "openning": true, - "notification_disabled": true, - "email_disabled": false - } - ] - }, - { - "type": "TemplateMessageSetting::Normal", - "type_name": "", - "total_settings_count": 3, - "settings": [ - { - "name": "被拉入或移出组织", - "key": "Organization", - "openning": true, - "notification_disabled": true, - "email_disabled": false - }, - { - "name": "被拉入或移出项目", - "key": "Project", - "openning": true, - "notification_disabled": true, - "email_disabled": false - }, - { - "name": "有权限变更", - "key": "Permission", - "openning": true, + "key": "SettingChanged", "notification_disabled": true, "email_disabled": false } @@ -512,6 +501,185 @@ await octokit.request('GET /api/template_message_settings.json') + +## 获取用户消息设置配置信息 +获取用户消息设置配置信息 + +> 示例: + +```shell +curl -X GET http://localhost:3000/api/users/yystopf/template_message_settings.json +``` + +```javascript +await octokit.request('GET /api/uses/yystopf/template_message_settings.json') +``` + +### HTTP 请求 +`GET /api/users/:user_id/template_message_settings.json` + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|notification_body |string |站内信配置 | +|email_body |string |邮件配置| + + +> 返回的JSON示例: + +```json +{ + "status": 0, + "message": "响应成功", + "user": { + "id": 2, + "type": "User", + "name": "heh", + "login": "yystopf", + "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png" + }, + "notification_body": { + "CreateOrAssign::IssueChanged": true, + "CreateOrAssign::IssueAssigned": true, + "CreateOrAssign::PullRequestAssigned": true, + "CreateOrAssign::PullRequestChanged": true, + "ManageProject::Issue": true, + "ManageProject::PullRequest": true, + "ManageProject::Member": true, + "ManageProject::SettingChanged": true, + "Normal::Organization": true, + "Normal::Project": true, + "Normal::Permission": true + }, + "email_body": { + "CreateOrAssign::IssueChanged": false, + "CreateOrAssign::IssueAssigned": false, + "CreateOrAssign::PullRequestAssigned": false, + "CreateOrAssign::PullRequestChanged": false, + "ManageProject::Issue": false, + "ManageProject::PullRequest": false, + "ManageProject::Member": false, + "ManageProject::SettingChanged": true, + "Normal::Organization": false, + "Normal::Project": true, + "Normal::Permission": false + } +} +``` + + +## 重新设置用户消息设置配置信息 +重新设置用户消息设置配置信息 + +> 示例: + +```shell +curl -X POST http://localhost:3000/api/users/yystopf/template_message_settings/update_setting.json +``` + +```javascript +await octokit.request('POST /api/uses/yystopf/template_message_settings/update_setting.json') +``` + +### HTTP 请求 +`POST /api/users/:user_id/template_message_settings/update_setting.json` + +### 请求字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|notification_body |string |站内信配置 | +|email_body |string |邮件配置| + + +> 请求的JSON示例: + +```json +{ + "setting": { + "notification_body": { + "CreateOrAssign::IssueChanged": true, + "CreateOrAssign::IssueAssigned": true, + "CreateOrAssign::PullRequestAssigned": true, + "CreateOrAssign::PullRequestChanged": true, + "ManageProject::Issue": true, + "ManageProject::PullRequest": true, + "ManageProject::Member": true, + "ManageProject::SettingChanged": true, + "Normal::Organization": true, + "Normal::Project": true, + "Normal::Permission": true + }, + "email_body": { + "CreateOrAssign::IssueChanged": false, + "CreateOrAssign::IssueAssigned": false, + "CreateOrAssign::PullRequestAssigned": false, + "CreateOrAssign::PullRequestChanged": false, + "ManageProject::Issue": false, + "ManageProject::PullRequest": false, + "ManageProject::Member": false, + "ManageProject::SettingChanged": true, + "Normal::Organization": false, + "Normal::Project": "t", + "Normal::Permission": false + } + } +} +``` + +### 返回字段说明: +参数 | 类型 | 字段说明 +--------- | ----------- | ----------- +|notification_body |string |站内信配置 | +|email_body |string |邮件配置| + + +> 返回的JSON示例: + +```json +{ + "status": 0, + "message": "响应成功", + "user": { + "id": 2, + "type": "User", + "name": "heh", + "login": "yystopf", + "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png" + }, + "notification_body": { + "CreateOrAssign::IssueChanged": true, + "CreateOrAssign::IssueAssigned": true, + "CreateOrAssign::PullRequestAssigned": true, + "CreateOrAssign::PullRequestChanged": true, + "ManageProject::Issue": true, + "ManageProject::PullRequest": true, + "ManageProject::Member": true, + "ManageProject::SettingChanged": true, + "Normal::Organization": true, + "Normal::Project": true, + "Normal::Permission": true + }, + "email_body": { + "CreateOrAssign::IssueChanged": false, + "CreateOrAssign::IssueAssigned": false, + "CreateOrAssign::PullRequestAssigned": false, + "CreateOrAssign::PullRequestChanged": false, + "ManageProject::Issue": false, + "ManageProject::PullRequest": false, + "ManageProject::Member": false, + "ManageProject::SettingChanged": true, + "Normal::Organization": false, + "Normal::Project": true, + "Normal::Permission": false + } +} +``` + + ## 获取用户星标项目 获取用户星标项目 diff --git a/app/models/template_message_setting/create_or_assign.rb b/app/models/template_message_setting/create_or_assign.rb index df98a5ca9..65bf26423 100644 --- a/app/models/template_message_setting/create_or_assign.rb +++ b/app/models/template_message_setting/create_or_assign.rb @@ -21,9 +21,9 @@ class TemplateMessageSetting::CreateOrAssign < TemplateMessageSetting end def self.build_init_data - self.find_or_create_by(name: "易修状态变更", key: "IssueChanged") self.find_or_create_by(name: "易修被指派", key: "IssueAssigned") + self.find_or_create_by(name: "易修状态变更", key: "IssueChanged") self.find_or_create_by(name: "合并请求被指派", key: "PullRequestAssigned") - self.find_or_create_by(name: "合并请求状态变更", key: "PullRequestAssigned") + self.find_or_create_by(name: "合并请求状态变更", key: "PullRequestChanged") end end diff --git a/app/models/template_message_setting/manage_project.rb b/app/models/template_message_setting/manage_project.rb index b0f535ea2..b1e69a5a9 100644 --- a/app/models/template_message_setting/manage_project.rb +++ b/app/models/template_message_setting/manage_project.rb @@ -21,9 +21,9 @@ class TemplateMessageSetting::ManageProject < TemplateMessageSetting end def self.build_init_data - self.find_or_create_by(name: "有新的易修", key: "ProjectIssue") - self.find_or_create_by(name: "有新的合并请求", key: "ProjectPullRequest") - self.find_or_create_by(name: "有成员变动", key: "ProjectMember") - self.find_or_create_by(name: "设置更改", key: "ProjectSettingChanged") + self.find_or_create_by(name: "有新的易修", key: "Issue") + self.find_or_create_by(name: "有新的合并请求", key: "PullRequest") + self.find_or_create_by(name: "有成员变动", key: "Member") + self.find_or_create_by(name: "设置更改", key: "SettingChanged") end end diff --git a/app/models/user.rb b/app/models/user.rb index 623694b33..fc4c33618 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -170,7 +170,9 @@ class User < Owner has_many :issues, dependent: :destroy, foreign_key: :author_id has_many :pull_requests, dependent: :destroy has_many :public_keys, class_name: "Gitea::PublicKey",primary_key: :gitea_uid, foreign_key: :owner_id, dependent: :destroy - + + has_one :user_template_message_setting, dependent: :destroy + # Groups and active users scope :active, lambda { where(status: STATUS_ACTIVE) } scope :like, lambda { |keywords| diff --git a/app/models/user_template_message_setting.rb b/app/models/user_template_message_setting.rb index 5c6f3a2f3..5992adbb4 100644 --- a/app/models/user_template_message_setting.rb +++ b/app/models/user_template_message_setting.rb @@ -15,4 +15,58 @@ # class UserTemplateMessageSetting < ApplicationRecord + serialize :notification_body, Hash + serialize :email_body, Hash + + belongs_to :user + + before_update :set_body_value + + def self.build(user_id) + self.create!(user_id: user_id, notification_body: init_notification_body, email_body: init_email_body) + end + + def self.init_notification_body + { + "CreateOrAssign::IssueChanged": true, + "CreateOrAssign::IssueAssigned": true, + "CreateOrAssign::PullRequestAssigned": true, + "CreateOrAssign::PullRequestChanged": true, + "ManageProject::Issue": true, + "ManageProject::PullRequest": true, + "ManageProject::Member": true, + "ManageProject::SettingChanged": true, + "Normal::Organization": true, + "Normal::Project": true, + "Normal::Permission": true, + }.stringify_keys! + end + + def self.init_email_body + { + "CreateOrAssign::IssueChanged": false, + "CreateOrAssign::IssueAssigned": false, + "CreateOrAssign::PullRequestAssigned": false, + "CreateOrAssign::PullRequestChanged": false, + "ManageProject::Issue": false, + "ManageProject::PullRequest": false, + "ManageProject::Member": false, + "ManageProject::SettingChanged": false, + "Normal::Organization": false, + "Normal::Project": false, + "Normal::Permission": false, + }.stringify_keys! + end + + private + + def set_body_value + self.notification_body.each do |k, v| + self.notification_body[k] = ActiveModel::Type::Boolean.new.cast(v).nil? ? false : ActiveModel::Type::Boolean.new.cast(v) + end + + self.email_body.each do |k, v| + self.email_body[k] = ActiveModel::Type::Boolean.new.cast(v).nil? ? false : ActiveModel::Type::Boolean.new.cast(v) + end + end end diff --git a/app/views/template_message_settings/index.json.jbuilder b/app/views/template_message_settings/index.json.jbuilder index 3ca136797..eae5bb018 100644 --- a/app/views/template_message_settings/index.json.jbuilder +++ b/app/views/template_message_settings/index.json.jbuilder @@ -1,7 +1,7 @@ json.partial! "commons/success" json.setting_types do - json.array! @group_settings.keys.each do |k| + json.array! @group_settings.keys.sort_by{|i| i.constantize.type_name}.each do |k| json.partial! "detail", type: k, count: @group_settings[k] end diff --git a/app/views/users/template_message_settings/_detail.json.jbuilder b/app/views/users/template_message_settings/_detail.json.jbuilder new file mode 100644 index 000000000..18a3e31ed --- /dev/null +++ b/app/views/users/template_message_settings/_detail.json.jbuilder @@ -0,0 +1,5 @@ +json.user do + json.partial! 'users/user_simple', locals: { user: setting.user } +end +json.notification_body setting.notification_body +json.email_body setting.email_body \ No newline at end of file diff --git a/app/views/users/template_message_settings/current_setting.json.jbuilder b/app/views/users/template_message_settings/current_setting.json.jbuilder new file mode 100644 index 000000000..514aadb7c --- /dev/null +++ b/app/views/users/template_message_settings/current_setting.json.jbuilder @@ -0,0 +1,2 @@ +json.partial! "commons/success" +json.partial! "detail", locals: {setting: @current_setting} \ No newline at end of file diff --git a/app/views/users/template_message_settings/update_setting.json.jbuilder b/app/views/users/template_message_settings/update_setting.json.jbuilder new file mode 100644 index 000000000..514aadb7c --- /dev/null +++ b/app/views/users/template_message_settings/update_setting.json.jbuilder @@ -0,0 +1,2 @@ +json.partial! "commons/success" +json.partial! "detail", locals: {setting: @current_setting} \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 34fa0ed6b..35fea39c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -265,6 +265,8 @@ Rails.application.routes.draw do end scope module: :users do + get 'template_message_settings', to: 'template_message_settings#current_setting' + post 'template_message_settings/update_setting', to: 'template_message_settings#update_setting' resources :applied_messages, only: [:index] resources :applied_transfer_projects, only: [:index] do member do diff --git a/public/docs/api.html b/public/docs/api.html index ecfdb055d..e2a642023 100644 --- a/public/docs/api.html +++ b/public/docs/api.html @@ -363,6 +363,12 @@
  • 获取平台消息设置配置信息
  • +
  • + 获取用户消息设置配置信息 +
  • +
  • + 重新设置用户消息设置配置信息 +
  • 获取用户星标项目
  • @@ -1634,6 +1640,31 @@ Success — a happy kitten is an authenticated kitten! "status": 0, "message": "响应成功", "setting_types": [ + { + "type": "TemplateMessageSetting::Normal", + "type_name": "", + "total_settings_count": 3, + "settings": [ + { + "name": "被拉入或移出组织", + "key": "Organization", + "notification_disabled": true, + "email_disabled": false + }, + { + "name": "被拉入或移出项目", + "key": "Project", + "notification_disabled": true, + "email_disabled": false + }, + { + "name": "有权限变更", + "key": "Permission", + "notification_disabled": true, + "email_disabled": false + } + ] + }, { "type": "TemplateMessageSetting::CreateOrAssign", "type_name": "我创建的或负责的", @@ -1642,28 +1673,24 @@ Success — a happy kitten is an authenticated kitten! { "name": "易修状态变更", "key": "IssueChanged", - "openning": true, "notification_disabled": true, "email_disabled": false }, { "name": "易修被指派", "key": "IssueAssigned", - "openning": true, "notification_disabled": true, "email_disabled": false }, { "name": "合并请求被指派", "key": "PullRequestAssigned", - "openning": true, "notification_disabled": true, "email_disabled": false }, { "name": "合并请求状态变更", "key": "PullRequestAssigned", - "openning": true, "notification_disabled": true, "email_disabled": false } @@ -1676,57 +1703,25 @@ Success — a happy kitten is an authenticated kitten! "settings": [ { "name": "有新的易修", - "key": "ProjectIssue", - "openning": true, + "key": "Issue", "notification_disabled": true, "email_disabled": false }, { "name": "有新的合并请求", - "key": "ProjectPullRequest", - "openning": true, + "key": "PullRequest", "notification_disabled": true, "email_disabled": false }, { "name": "有成员变动", - "key": "ProjectMember", - "openning": true, + "key": "Member", "notification_disabled": true, "email_disabled": false }, { "name": "设置更改", - "key": "ProjectSettingChanged", - "openning": true, - "notification_disabled": true, - "email_disabled": false - } - ] - }, - { - "type": "TemplateMessageSetting::Normal", - "type_name": "", - "total_settings_count": 3, - "settings": [ - { - "name": "被拉入或移出组织", - "key": "Organization", - "openning": true, - "notification_disabled": true, - "email_disabled": false - }, - { - "name": "被拉入或移出项目", - "key": "Project", - "openning": true, - "notification_disabled": true, - "email_disabled": false - }, - { - "name": "有权限变更", - "key": "Permission", - "openning": true, + "key": "SettingChanged", "notification_disabled": true, "email_disabled": false } @@ -1738,6 +1733,207 @@ Success — a happy kitten is an authenticated kitten! +

    获取用户消息设置配置信息

    +

    获取用户消息设置配置信息

    + +
    +

    示例:

    +
    +
    curl -X GET http://localhost:3000/api/users/yystopf/template_message_settings.json
    +
    await octokit.request('GET /api/uses/yystopf/template_message_settings.json')
    +

    HTTP 请求

    +

    GET /api/users/:user_id/template_message_settings.json

    +

    返回字段说明:

    + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    notification_bodystring站内信配置
    email_bodystring邮件配置
    + +
    +

    返回的JSON示例:

    +
    +
    {
    +    "status": 0,
    +    "message": "响应成功",
    +    "user": {
    +        "id": 2,
    +        "type": "User",
    +        "name": "heh",
    +        "login": "yystopf",
    +        "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
    +    },
    +    "notification_body": {
    +        "CreateOrAssign::IssueChanged": true,
    +        "CreateOrAssign::IssueAssigned": true,
    +        "CreateOrAssign::PullRequestAssigned": true,
    +        "CreateOrAssign::PullRequestChanged": true,
    +        "ManageProject::Issue": true,
    +        "ManageProject::PullRequest": true,
    +        "ManageProject::Member": true,
    +        "ManageProject::SettingChanged": true,
    +        "Normal::Organization": true,
    +        "Normal::Project": true,
    +        "Normal::Permission": true
    +    },
    +    "email_body": {
    +        "CreateOrAssign::IssueChanged": false,
    +        "CreateOrAssign::IssueAssigned": false,
    +        "CreateOrAssign::PullRequestAssigned": false,
    +        "CreateOrAssign::PullRequestChanged": false,
    +        "ManageProject::Issue": false,
    +        "ManageProject::PullRequest": false,
    +        "ManageProject::Member": false,
    +        "ManageProject::SettingChanged": true,
    +        "Normal::Organization": false,
    +        "Normal::Project": true,
    +        "Normal::Permission": false
    +    }
    +}
    +
    + +

    重新设置用户消息设置配置信息

    +

    重新设置用户消息设置配置信息

    + +
    +

    示例:

    +
    +
    curl -X POST http://localhost:3000/api/users/yystopf/template_message_settings/update_setting.json
    +
    await octokit.request('POST /api/uses/yystopf/template_message_settings/update_setting.json')
    +

    HTTP 请求

    +

    POST /api/users/:user_id/template_message_settings/update_setting.json

    +

    请求字段说明:

    + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    notification_bodystring站内信配置
    email_bodystring邮件配置
    + +
    +

    请求的JSON示例:

    +
    +
    {
    +    "setting": {
    +        "notification_body": {
    +            "CreateOrAssign::IssueChanged": true,
    +            "CreateOrAssign::IssueAssigned": true,
    +            "CreateOrAssign::PullRequestAssigned": true,
    +            "CreateOrAssign::PullRequestChanged": true,
    +            "ManageProject::Issue": true,
    +            "ManageProject::PullRequest": true,
    +            "ManageProject::Member": true,
    +            "ManageProject::SettingChanged": true,
    +            "Normal::Organization": true,
    +            "Normal::Project": true,
    +            "Normal::Permission": true
    +        },
    +        "email_body": {
    +            "CreateOrAssign::IssueChanged": false,
    +            "CreateOrAssign::IssueAssigned": false,
    +            "CreateOrAssign::PullRequestAssigned": false,
    +            "CreateOrAssign::PullRequestChanged": false,
    +            "ManageProject::Issue": false,
    +            "ManageProject::PullRequest": false,
    +            "ManageProject::Member": false,
    +            "ManageProject::SettingChanged": true,
    +            "Normal::Organization": false,
    +            "Normal::Project": "t",
    +            "Normal::Permission": false
    +        }
    +   }
    +}
    +

    返回字段说明:

    + + + + + + + + + + + + + + + + + +
    参数类型字段说明
    notification_bodystring站内信配置
    email_bodystring邮件配置
    + +
    +

    返回的JSON示例:

    +
    +
    {
    +    "status": 0,
    +    "message": "响应成功",
    +    "user": {
    +        "id": 2,
    +        "type": "User",
    +        "name": "heh",
    +        "login": "yystopf",
    +        "image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
    +    },
    +    "notification_body": {
    +        "CreateOrAssign::IssueChanged": true,
    +        "CreateOrAssign::IssueAssigned": true,
    +        "CreateOrAssign::PullRequestAssigned": true,
    +        "CreateOrAssign::PullRequestChanged": true,
    +        "ManageProject::Issue": true,
    +        "ManageProject::PullRequest": true,
    +        "ManageProject::Member": true,
    +        "ManageProject::SettingChanged": true,
    +        "Normal::Organization": true,
    +        "Normal::Project": true,
    +        "Normal::Permission": true
    +    },
    +    "email_body": {
    +        "CreateOrAssign::IssueChanged": false,
    +        "CreateOrAssign::IssueAssigned": false,
    +        "CreateOrAssign::PullRequestAssigned": false,
    +        "CreateOrAssign::PullRequestChanged": false,
    +        "ManageProject::Issue": false,
    +        "ManageProject::PullRequest": false,
    +        "ManageProject::Member": false,
    +        "ManageProject::SettingChanged": true,
    +        "Normal::Organization": false,
    +        "Normal::Project": true,
    +        "Normal::Permission": false
    +    }
    +}
    +
    +

    获取用户星标项目

    获取用户星标项目

    @@ -1746,9 +1942,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/is_pinned_projects.json
     
    await octokit.request('GET /api/users/:login/is_pinned_projects.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/:login/is_pinned_projects.json

    -

    返回字段说明:

    +

    返回字段说明:

    @@ -1933,9 +2129,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/is_pinned_projects/pin.json
     
    await octokit.request('GET /api/users/:login/is_pinned_projects/pin.json')
    -

    HTTP 请求

    +

    HTTP 请求

    POST /api/users/:login/is_pinned_projects/pin.json

    -

    请求字段说明:

    同时设定多个星标项目

    +

    请求字段说明:

    同时设定多个星标项目

    参数
    @@ -1979,9 +2175,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X PATCH http://localhost:3000/api/users/yystopf/is_pinned_projects/11.json
     
    await octokit.request('PATCH/PUT /api/users/:login/is_pinned_projects/:id.json')
    -

    HTTP 请求

    +

    HTTP 请求

    PATCH/PUT /api/users/:login/is_pinned_projects/:id.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2020,9 +2216,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/activity.json
     
    await octokit.request('GET /api/users/:login/statistics/activity.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/activity.json

    -

    返回字段说明:

    +

    返回字段说明:

    参数
    @@ -2109,9 +2305,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/headmaps.json
     
    await octokit.request('GET /api/users/:login/headmaps.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/:login/headmaps.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2125,7 +2321,7 @@ Success — a happy kitten is an authenticated kitten!
    参数年份
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2254,9 +2450,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/project_trends.json
     
    await octokit.request('GET /api/users/:login/project_trends.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET api/users/:login/project_trends.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2270,7 +2466,7 @@ Success — a happy kitten is an authenticated kitten!
    参数日期,格式: 2021-05-28
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2571,9 +2767,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/develop.json
     
    await octokit.request('GET /api/users/:login/statistics/develop.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/develop.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2592,7 +2788,7 @@ Success — a happy kitten is an authenticated kitten!
    参数时间戳,结束时间,格式:1622131200
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2714,9 +2910,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/role.json
     
    await octokit.request('GET /api/users/:login/statistics/role.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/role.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2735,7 +2931,7 @@ Success — a happy kitten is an authenticated kitten!
    参数时间戳,结束时间,格式:1622131200
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2796,9 +2992,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/statistics/major.json
     
    await octokit.request('GET /api/users/:login/statistics/major.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/statistics/major.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2817,7 +3013,7 @@ Success — a happy kitten is an authenticated kitten!
    参数时间戳,结束时间,格式:1622131200
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -2857,9 +3053,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/applied_messages.json
     
    await octokit.request('GET /api/users/:login/applied_messages.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_messages.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -2873,7 +3069,7 @@ Success — a happy kitten is an authenticated kitten!
    参数用户标识
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3136,9 +3332,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/applied_transfer_projects.json
     
    await octokit.request('GET /api/users/:login/applied_transfer_projects.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_transfer_projects.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3152,7 +3348,7 @@ Success — a happy kitten is an authenticated kitten!
    参数用户标识
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3328,9 +3524,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/accept.json
     
    await octokit.request('GET /api/users/:login/applied_transfer_projects/:id/accept.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_transfer_projects/:id/accept.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3349,7 +3545,7 @@ Success — a happy kitten is an authenticated kitten!
    参数迁移id
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3519,9 +3715,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_transfer_projects/2/refuse.json
     
    await octokit.request('GET /api/users/:login/applied_transfer_projects/:id/refuse.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_transfer_projects/:id/refuse.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3540,7 +3736,7 @@ Success — a happy kitten is an authenticated kitten!
    参数迁移id
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3710,9 +3906,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X GET http://localhost:3000/api/users/yystopf/applied_projects.json
     
    await octokit.request('GET /api/users/:login/applied_projects.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_projects.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3726,7 +3922,7 @@ Success — a happy kitten is an authenticated kitten!
    参数用户标识
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -3870,9 +4066,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_projects/2/accept.json
     
    await octokit.request('GET /api/users/:login/applied_projects/:id/accept.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_projects/:id/accept.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -3891,7 +4087,7 @@ Success — a happy kitten is an authenticated kitten!
    参数申请id
    -

    返回字段说明:

    +

    返回字段说明:

    @@ -4029,9 +4225,9 @@ Success — a happy kitten is an authenticated kitten!
    curl -X POST http://localhost:3000/api/users/yystopf/applied_projects/2/refuse.json
     
    await octokit.request('GET /api/users/:login/applied_projects/:id/refuse.json')
    -

    HTTP 请求

    +

    HTTP 请求

    GET /api/users/:login/applied_projects/:id/refuse.json

    -

    请求字段说明:

    +

    请求字段说明:

    参数
    @@ -4050,7 +4246,7 @@ Success — a happy kitten is an authenticated kitten!
    参数申请id
    -

    返回字段说明:

    +

    返回字段说明:

    参数