Skip to content

Commit

Permalink
Merge pull request #264 from alimy/pr-share
Browse files Browse the repository at this point in the history
add simple tweet share support
  • Loading branch information
alimy authored Apr 14, 2023
2 parents 1a4e277 + d1804f7 commit 46f079d
Show file tree
Hide file tree
Showing 45 changed files with 1,225 additions and 1,189 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to paopao-ce are documented in this file.
- add custom comment sort strategy support [#243](https://github.com/rocboss/paopao-ce/pull/243)
- add `RedisCacheIndex` feature [#250](https://github.com/rocboss/paopao-ce/pull/250)
- add `Sentry` feature [#258](https://github.com/rocboss/paopao-ce/pull/258)
- add simple tweet share feature(just copy tweet link to clipboard now) support [#264](https://github.com/rocboss/paopao-ce/pull/264)
- add default tweet max length configure in web/.env support. [&a1160ca](https://github.com/rocboss/paopao-ce/commit/a1160ca79380445157146d9eae1710543c153cce 'commit a1160ca')
Set the value of `VITE_DEFAULT_TWEET_MAX_LENGTH` in file web/.env to change the tweet max default length.
```
Expand Down
3 changes: 3 additions & 0 deletions internal/dao/jinzhu/dbr/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Post struct {
UserID int64 `json:"user_id"`
CommentCount int64 `json:"comment_count"`
CollectionCount int64 `json:"collection_count"`
ShareCount int64 `json:"share_count"`
UpvoteCount int64 `json:"upvote_count"`
Visibility PostVisibleT `json:"visibility"`
IsTop int `json:"is_top"`
Expand All @@ -45,6 +46,7 @@ type PostFormated struct {
Contents []*PostContentFormated `json:"contents"`
CommentCount int64 `json:"comment_count"`
CollectionCount int64 `json:"collection_count"`
ShareCount int64 `json:"share_count"`
UpvoteCount int64 `json:"upvote_count"`
Visibility PostVisibleT `json:"visibility"`
IsTop int `json:"is_top"`
Expand All @@ -71,6 +73,7 @@ func (p *Post) Format() *PostFormated {
Contents: []*PostContentFormated{},
CommentCount: p.CommentCount,
CollectionCount: p.CollectionCount,
ShareCount: p.ShareCount,
UpvoteCount: p.UpvoteCount,
Visibility: p.Visibility,
IsTop: p.IsTop,
Expand Down
1 change: 1 addition & 0 deletions scripts/migration/mysql/0005_share_count.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `p_post` DROP COLUMN `share_count`;
1 change: 1 addition & 0 deletions scripts/migration/mysql/0005_share_count.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `p_post` ADD COLUMN `share_count` BIGINT unsigned NOT NULL DEFAULT 0;
1 change: 1 addition & 0 deletions scripts/migration/postgres/0004_share_count.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE p_post DROP COLUMN share_count;
1 change: 1 addition & 0 deletions scripts/migration/postgres/0004_share_count.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE p_post ADD COLUMN share_count BIGINT NOT NULL DEFAULT 0; -- 分享数
1 change: 1 addition & 0 deletions scripts/migration/sqlite3/0005_share_count.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `p_post` DROP COLUMN `share_count`;
1 change: 1 addition & 0 deletions scripts/migration/sqlite3/0005_share_count.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `p_post` ADD COLUMN `share_count` integer NOT NULL DEFAULT 0;
1 change: 1 addition & 0 deletions scripts/paopao-mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ CREATE TABLE `p_post` (
`comment_count` bigint unsigned NOT NULL DEFAULT '0' COMMENT '评论数',
`collection_count` bigint unsigned NOT NULL DEFAULT '0' COMMENT '收藏数',
`upvote_count` bigint unsigned NOT NULL DEFAULT '0' COMMENT '点赞数',
`share_count` bigint unsigned NOT NULL DEFAULT '0' COMMENT '分享数',
`visibility` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '可见性 0公开 1私密 2好友可见',
`is_top` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否置顶',
`is_essence` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否精华',
Expand Down
1 change: 1 addition & 0 deletions scripts/paopao-postgres.sql
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ CREATE TABLE p_post (
comment_count BIGINT NOT NULL DEFAULT 0,
collection_count BIGINT NOT NULL DEFAULT 0,
upvote_count BIGINT NOT NULL DEFAULT 0,
share_count BIGINT NOT NULL DEFAULT 0,
visibility SMALLINT NOT NULL DEFAULT 0, -- 可见性 0公开 1私密 2好友可见
is_top SMALLINT NOT NULL DEFAULT 0, -- 是否置顶
is_essence SMALLINT NOT NULL DEFAULT 0, -- 是否精华
Expand Down
1 change: 1 addition & 0 deletions scripts/paopao-sqlite3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ CREATE TABLE "p_post" (
"comment_count" integer NOT NULL,
"collection_count" integer NOT NULL,
"upvote_count" integer NOT NULL,
"share_count" integer NOT NULL,
"is_top" integer NOT NULL,
"is_essence" integer NOT NULL,
"is_lock" integer NOT NULL,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 46f079d

Please sign in to comment.