Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit6a9e464

Browse files
authored
chore(config): add default active_period_days (#425)
1 parentc57eb91 commit6a9e464

File tree

11 files changed

+14
-19
lines changed

11 files changed

+14
-19
lines changed

‎config/config.exs‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,10 @@ config :groupher_server, :article,
7373
# in this period, paged articles will sort front if non-article-author commented
7474
# 在此时间段内,一旦有非文章作者的用户评论,该文章就会排到前面
7575
active_period_days:%{
76-
post:10,
77-
job:10,
78-
repo:10,
79-
blog:10,
80-
works:10,
81-
radar:10,
82-
guide:10,
83-
meetup:10,
84-
drink:10
76+
default:10
77+
# post: 10,
78+
# job: 10,
79+
# ...
8580
},
8681

8782
# NOTE: if you want to add/remove emotion, just edit the list below

‎lib/groupher_server/cms/delegates/article_curd.ex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
324324

325325
# check is an article's active_at is in active period
326326
defpin_active_period?(thread,article)do
327-
active_period_days=Map.get(@active_period,thread)
327+
active_period_days=@active_period[thread]||@active_period[:default]
328328

329329
inserted_at=article.inserted_at
330330
active_threshold=Timex.shift(Timex.now(),days:-active_period_days)

‎test/groupher_server/cms/comments/blog_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.BlogComment do
6666
end
6767

6868
test"old blog will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:blog)
69+
active_period_days=@active_period[:blog]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/drink_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.DrinkComment do
6666
end
6767

6868
test"old drink will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:drink)
69+
active_period_days=@active_period[:drink]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/guide_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.GuideComment do
6666
end
6767

6868
test"old guide will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:guide)
69+
active_period_days=@active_period[:guide]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/job_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.JobComment do
6666
end
6767

6868
test"old job will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:job)
69+
active_period_days=@active_period[:job]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/meetup_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.MeetupComment do
6666
end
6767

6868
test"old meetup will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:meetup)
69+
active_period_days=@active_period[:meetup]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/post_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.PostComment do
6666
end
6767

6868
test"old post will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:post)
69+
active_period_days=@active_period[:post]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/radar_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.RadarComment do
6666
end
6767

6868
test"old radar will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:radar)
69+
active_period_days=@active_period[:radar]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

‎test/groupher_server/cms/comments/repo_comment_test.exs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.RepoComment do
6666
end
6767

6868
test"old repo will not update active after comment created",~m(user)ado
69-
active_period_days=Map.get(@active_period,:repo)
69+
active_period_days=@active_period[:repo]||@active_period[:default]
7070

7171
inserted_at=
7272
Timex.shift(Timex.now(),days:-(active_period_days-1))|>Timex.to_datetime()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp