diff --git a/app/controllers/admins/system_notifications_controller.rb b/app/controllers/admins/system_notifications_controller.rb
index e2081f1a..0dc7dd2a 100644
--- a/app/controllers/admins/system_notifications_controller.rb
+++ b/app/controllers/admins/system_notifications_controller.rb
@@ -10,10 +10,6 @@ class Admins::SystemNotificationsController < Admins::BaseController
@notifications = paginate(notifications)
end
- def history
- @users = @notification.users
- end
-
def new
@notification = SystemNotification.new
end
diff --git a/app/controllers/users/system_notification_histories_controller.rb b/app/controllers/users/system_notification_histories_controller.rb
deleted file mode 100644
index 70e91fbb..00000000
--- a/app/controllers/users/system_notification_histories_controller.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class Users::SystemNotificationHistoriesController < Users::BaseController
- before_action :private_user_resources!, only: [:create]
- def create
- @history = observed_user.system_notification_histories.new(system_notification_id: params[:system_notification_id])
- if @history.save
- render_ok
- else
- Rails.logger.info @history.errors.as_json
- render_error(@history.errors.full_messages.join(","))
- end
- rescue Exception => e
- uid_logger_error(e.message)
- tip_exception(e.message)
- 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 594ce725..9d6b8092 100644
--- a/app/docs/slate/source/includes/_users.md
+++ b/app/docs/slate/source/includes/_users.md
@@ -199,36 +199,6 @@ await octokit.request('GET /api/users/:login/messages.json')
Success Data.
-## 用户阅读系统通知
-用户阅读系统通知
-
-> 示例:
-
-```shell
-curl -X POST http://localhost:3000/api/users/yystopf/system_notification_histories.json
-```
-
-```javascript
-await octokit.request('GET /api/users/:login/system_notification_histories.json')
-```
-
-### HTTP 请求
-`POST /api/users/:login/system_notification_histories.json`
-
-### 请求字段说明:
-参数 | 类型 | 字段说明
---------- | ----------- | -----------
-|system_notification_id |integer |阅读的系统通知id |
-
-> 返回的JSON示例:
-
-```json
-{
- "status": 0,
- "message": "success"
-}
-```
-
## 发送消息
发送消息, 目前只支持atme
diff --git a/app/models/system_notification.rb b/app/models/system_notification.rb
index 8eacd437..848d592d 100644
--- a/app/models/system_notification.rb
+++ b/app/models/system_notification.rb
@@ -15,9 +15,6 @@ class SystemNotification < ApplicationRecord
default_scope { order(created_at: :desc)}
- has_many :system_notification_histories
- has_many :users, through: :system_notification_histories
-
scope :is_top, lambda { where(is_top: true) }
diff --git a/app/models/system_notification_history.rb b/app/models/system_notification_history.rb
deleted file mode 100644
index b629babd..00000000
--- a/app/models/system_notification_history.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# == Schema Information
-#
-# Table name: system_notification_histories
-#
-# id :integer not null, primary key
-# system_message_id :integer
-# user_id :integer
-# created_at :datetime not null
-# updated_at :datetime not null
-#
-# Indexes
-#
-# index_system_notification_histories_on_system_message_id (system_message_id)
-# index_system_notification_histories_on_user_id (user_id)
-#
-
-class SystemNotificationHistory < ApplicationRecord
-
- belongs_to :system_notification
- belongs_to :user
-
- validates :system_notification_id, uniqueness: { scope: :user_id, message: '只能阅读一次'}
-end
diff --git a/app/models/user.rb b/app/models/user.rb
index 22c5e3cd..623694b3 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -170,8 +170,6 @@ 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_many :system_notification_histories
- has_many :system_notifications, through: :system_notification_histories
# Groups and active users
scope :active, lambda { where(status: STATUS_ACTIVE) }
diff --git a/config/locales/system_notification_histories/zh-CN.yml b/config/locales/system_notification_histories/zh-CN.yml
deleted file mode 100644
index 8dd7b49d..00000000
--- a/config/locales/system_notification_histories/zh-CN.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-zh-CN:
- activerecord:
- attributes:
- system_notification_history:
- system_notification: "系统通知"
- system_notification_id: "系统通知"
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 92061df9..9e5ffa2f 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -263,7 +263,6 @@ Rails.application.routes.draw do
end
scope module: :users do
- resources :system_notification_histories, only: [:create]
resources :applied_messages, only: [:index]
resources :applied_transfer_projects, only: [:index] do
member do
@@ -671,11 +670,7 @@ Rails.application.routes.draw do
resources :project_licenses
resources :project_ignores
resources :reversed_keywords
- resources :system_notifications do
- member do
- get :history
- end
- end
+ resources :system_notifications
resources :message_templates, only: [:index, :edit, :update] do
collection do
get :init_data
diff --git a/db/migrate/20211012060837_create_system_notification_histories.rb b/db/migrate/20211012060837_create_system_notification_histories.rb
deleted file mode 100644
index 9110f3ce..00000000
--- a/db/migrate/20211012060837_create_system_notification_histories.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreateSystemNotificationHistories < ActiveRecord::Migration[5.2]
- def change
- create_table :system_notification_histories do |t|
- t.references :system_notification
- t.references :user
-
- t.timestamps
- end
- end
-end
diff --git a/public/docs/api.html b/public/docs/api.html
index 0f112178..8368e8fa 100644
--- a/public/docs/api.html
+++ b/public/docs/api.html
@@ -348,9 +348,6 @@
用户消息列表
-
- 用户阅读系统通知
-
发送消息
@@ -1331,39 +1328,7 @@ Success — a happy kitten is an authenticated kitten!
-用户阅读系统通知
-用户阅读系统通知
-
-
-示例:
-
-curl -X POST http://localhost:3000/api/users/yystopf/system_notification_histories.json
-
await octokit.request('GET /api/users/:login/system_notification_histories.json')
-
HTTP 请求
-POST /api/users/:login/system_notification_histories.json
-请求字段说明:
-
-
-参数 |
-类型 |
-字段说明 |
-
-
-
-system_notification_id |
-integer |
-阅读的系统通知id |
-
-
-
-
-返回的JSON示例:
-
-{
- "status": 0,
- "message": "success"
-}
-
发送消息
+发送消息
发送消息, 目前只支持atme
@@ -1371,9 +1336,9 @@ Success — a happy kitten is an authenticated kitten!
curl -X POST http://localhost:3000/api/users/:login/messages.json
await octokit.request('POST /api/users/:login/messages.json')
-
HTTP 请求
+HTTP 请求
POST api/users/yystopf/messages.json
-请求字段说明:
+请求字段说明:
参数 |
@@ -1432,9 +1397,9 @@ Success — a happy kitten is an authenticated kitten!
curl -X POST http://localhost:3000/api/users/:login/messages/read.json
await octokit.request('POST /api/users/:login/messages/read.json')
-
HTTP 请求
+HTTP 请求
POST api/users/yystopf/messages/read.json
-请求字段说明:
+请求字段说明:
参数 |
@@ -1473,9 +1438,9 @@ Success — a happy kitten is an authenticated kitten!
curl -X DELETE http://localhost:3000/api/users/:login/messages.json
await octokit.request('DELETE /api/users/:login/messages.json')
-
HTTP 请求
+HTTP 请求
DELETE api/users/yystopf/messages.json
-请求字段说明:
+请求字段说明:
参数 |
@@ -1514,9 +1479,9 @@ Success — a happy kitten is an authenticated kitten!
curl -X PATCH/PUT http://localhost:3000/api/users/yystopf.json
await octokit.request('PATCH/PUT /api/users/:login.json')
-
HTTP 请求
+HTTP 请求
PATCH/PUT /api/users/:login.json
-请求字段说明:
+请求字段说明:
参数 |
@@ -1612,7 +1577,7 @@ 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
返回字段说明:
@@ -1799,9 +1764,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
-请求字段说明:
同时设定多个星标项目
+请求字段说明:
同时设定多个星标项目
参数 |
@@ -1845,9 +1810,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -1886,7 +1851,7 @@ 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
返回字段说明:
@@ -1975,9 +1940,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -2120,9 +2085,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -2437,9 +2402,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -2580,9 +2545,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -2662,9 +2627,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -2723,9 +2688,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -3002,9 +2967,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -3194,9 +3159,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -3385,9 +3350,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -3576,9 +3541,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -3736,9 +3701,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
-请求字段说明:
+请求字段说明:
参数 |
@@ -3895,9 +3860,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
-请求字段说明:
+请求字段说明: