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.

chore(config): add default active_period_days#425

Merged
mydearxym merged 1 commit intodevfromconfig-adust
Aug 15, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletionsconfig/config.exs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,15 +73,10 @@ config :groupher_server, :article,
# in this period, paged articles will sort front if non-article-author commented
# 在此时间段内,一旦有非文章作者的用户评论,该文章就会排到前面
active_period_days: %{
post: 10,
job: 10,
repo: 10,
blog: 10,
works: 10,
radar: 10,
guide: 10,
meetup: 10,
drink: 10
default: 10
# post: 10,
# job: 10,
# ...
},

# NOTE: if you want to add/remove emotion, just edit the list below
Expand Down
2 changes: 1 addition & 1 deletionlib/groupher_server/cms/delegates/article_curd.ex
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -324,7 +324,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do

# check is an article's active_at is in active period
defp in_active_period?(thread, article) do
active_period_days =Map.get(@active_period,thread)
active_period_days = @active_period[thread] || @active_period[:default]

inserted_at = article.inserted_at
active_threshold = Timex.shift(Timex.now(), days: -active_period_days)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.BlogComment do
end

test "old blog will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:blog)
active_period_days = @active_period[:blog] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.DrinkComment do
end

test "old drink will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:drink)
active_period_days = @active_period[:drink] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.GuideComment do
end

test "old guide will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:guide)
active_period_days = @active_period[:guide] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
2 changes: 1 addition & 1 deletiontest/groupher_server/cms/comments/job_comment_test.exs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.JobComment do
end

test "old job will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:job)
active_period_days = @active_period[:job] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.MeetupComment do
end

test "old meetup will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:meetup)
active_period_days = @active_period[:meetup] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.PostComment do
end

test "old post will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:post)
active_period_days = @active_period[:post] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.RadarComment do
end

test "old radar will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:radar)
active_period_days = @active_period[:radar] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.RepoComment do
end

test "old repo will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:repo)
active_period_days = @active_period[:repo] || @active_period[:default]

inserted_at =
Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime()
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -66,7 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.WorksComment do
end

test "old works will not update active after comment created", ~m(user)a do
active_period_days =Map.get(@active_period,:works)
active_period_days = @active_period[:works] || @active_period[:default]

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

[8]ページ先頭

©2009-2025 Movatter.jp