diff --git a/bench/go.mod b/bench/go.mod index 67bd346b9..47de0f797 100644 --- a/bench/go.mod +++ b/bench/go.mod @@ -11,6 +11,7 @@ require ( github.com/urfave/cli v1.22.1 go.uber.org/zap v1.26.0 golang.org/x/sync v0.4.0 + ) require ( diff --git a/bench/isupipe/assert.go b/bench/isupipe/assert.go index b03fffc74..e7da1680a 100644 --- a/bench/isupipe/assert.go +++ b/bench/isupipe/assert.go @@ -35,7 +35,6 @@ func assertSearchLivestream() { // FIXME: いくらか画面表示内容に問題がないことをチェックする // moderateにより登録されたNGワードが含まれるコメントが残っていたら失格 -// FIXME: ベンチ側では、ngワードのmoderate後に含まれる投稿を見つけたら失格扱いにする func assertModeratedComment() { // NGワード一覧取得 diff --git a/bench/isupipe/client_livecomment.go b/bench/isupipe/client_livecomment.go index 6305732b9..081e52b54 100644 --- a/bench/isupipe/client_livecomment.go +++ b/bench/isupipe/client_livecomment.go @@ -13,14 +13,13 @@ import ( ) type Livecomment struct { - Id int `json:"id"` - User User `json:"user"` - Livestream Livestream `json:"livestream"` - Comment string `json:"comment"` - Tip int `json:"tip"` - ReportCount int `json:"report_count"` - CreatedAt int `json:"created_at"` - UpdatedAt int `json:"updated_at"` + Id int `json:"id"` + User User `json:"user"` + Livestream Livestream `json:"livestream"` + Comment string `json:"comment"` + Tip int `json:"tip"` + CreatedAt int `json:"created_at"` + UpdatedAt int `json:"updated_at"` } type LivecommentReport struct { @@ -123,6 +122,8 @@ func (c *Client) GetLivecommentReports(ctx context.Context, livestreamId int, op return reports, nil } +func (c *Client) GetNgwords(ctx context.Context) + func (c *Client) PostLivecomment(ctx context.Context, livestreamId int, r *PostLivecommentRequest, opts ...ClientOption) (*PostLivecommentResponse, error) { var ( defaultStatusCode = http.StatusCreated diff --git a/docs/isupipe.yaml b/docs/isupipe.yaml index 44802eb16..3715e9688 100644 --- a/docs/isupipe.yaml +++ b/docs/isupipe.yaml @@ -552,8 +552,6 @@ components: type: string tip: type: integer - report_count: - type: integer created_at: type: integer updated_at: diff --git a/webapp/go/livecomment_handler.go b/webapp/go/livecomment_handler.go index 8af637520..15bf16772 100644 --- a/webapp/go/livecomment_handler.go +++ b/webapp/go/livecomment_handler.go @@ -25,20 +25,18 @@ type LivecommentModel struct { LivestreamId int64 `db:"livestream_id"` Comment string `db:"comment"` Tip int64 `db:"tip"` - ReportCount int64 `db:"report_count"` CreatedAt int64 `db:"created_at"` UpdatedAt int64 `db:"updated_at"` } type Livecomment struct { - Id int64 `json:"id"` - User User `json:"user"` - Livestream Livestream `json:"livestream"` - Comment string `json:"comment"` - Tip int64 `json:"tip"` - ReportCount int64 `json:"report_count"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + Id int64 `json:"id"` + User User `json:"user"` + Livestream Livestream `json:"livestream"` + Comment string `json:"comment"` + Tip int64 `json:"tip"` + CreatedAt int64 `json:"created_at"` + UpdatedAt int64 `json:"updated_at"` } type LivecommentReport struct { @@ -334,10 +332,6 @@ func reportLivecommentHandler(c echo.Context) error { } reportModel.Id = reportId - if _, err := tx.ExecContext(ctx, "UPDATE livecomments SET report_count = report_count + 1 WHERE id = ?", livecommentId); err != nil { - return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) - } - report, err := fillLivecommentReportResponse(ctx, tx, reportModel) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -435,14 +429,13 @@ func fillLivecommentResponse(ctx context.Context, tx *sqlx.Tx, livecommentModel } livecomment := Livecomment{ - Id: livecommentModel.Id, - User: commentOwner, - Livestream: livestream, - Comment: livecommentModel.Comment, - Tip: livecommentModel.Tip, - ReportCount: livecommentModel.ReportCount, - CreatedAt: livecommentModel.CreatedAt, - UpdatedAt: livecommentModel.UpdatedAt, + Id: livecommentModel.Id, + User: commentOwner, + Livestream: livestream, + Comment: livecommentModel.Comment, + Tip: livecommentModel.Tip, + CreatedAt: livecommentModel.CreatedAt, + UpdatedAt: livecommentModel.UpdatedAt, } return livecomment, nil diff --git a/webapp/sql/initdb.d/10_schema.sql b/webapp/sql/initdb.d/10_schema.sql index 51cf2da9e..417890fc9 100644 --- a/webapp/sql/initdb.d/10_schema.sql +++ b/webapp/sql/initdb.d/10_schema.sql @@ -82,13 +82,11 @@ CREATE TABLE `livecomments` ( -- 単位はISU (1,2,3,4,5, ...などわかりやすい数値で良い気がする) -- 色は、青、水、黄緑、黃、マゼンタ、赤の6段階 (ココらへんはフロントエンドでいい感じにしてもらう) `tip` BIGINT NOT NULL, - -- スパム報告数 - `report_count` BIGINT DEFAULT 0 NOT NULL, `created_at` BIGINT NOT NULL DEFAULT 0, `updated_at` BIGINT NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; -CREATE INDEX livecomments_covering ON livecomments(`created_at`, `user_id`, `tip`, `report_count`, `updated_at`, `comment`, `livestream_id`); +CREATE INDEX livecomments_covering ON livecomments(`created_at`, `user_id`, `tip`, `updated_at`, `comment`, `livestream_id`); -- ユーザからのライブコメントのスパム報告 CREATE TABLE `livecomment_reports` (