diff --git a/config/config.exs b/config/config.exs index e76d73aad..d461123cb 100644 --- a/config/config.exs +++ b/config/config.exs @@ -62,7 +62,7 @@ config :groupher_server, :customization, config :groupher_server, :article, # NOTE: do not change unless you know what you are doing - article_threads: [:post, :job, :repo], + threads: [:post, :job, :repo], # in this period, paged articles will sort front if non-article-author commented # 在此时间段内,一旦有非文章作者的用户评论,该文章就会排到前面 active_period_days: %{ @@ -73,7 +73,7 @@ config :groupher_server, :article, # NOTE: if you want to add/remove emotion, just edit the list below # and migrate the field to table "articles_users_emotions" - supported_emotions: [ + emotions: [ :upvote, :downvote, :beer, @@ -86,7 +86,7 @@ config :groupher_server, :article, ], # NOTE: if you want to add/remove emotion, just edit the list below # and migrate the field to table "articles_comments_users_emotions" - comment_supported_emotions: [ + comment_emotions: [ :downvote, :beer, :heart, diff --git a/lib/groupher_server/accounts/delegates/collect_folder.ex b/lib/groupher_server/accounts/delegates/collect_folder.ex index ab87d60dc..7f7001e32 100644 --- a/lib/groupher_server/accounts/delegates/collect_folder.ex +++ b/lib/groupher_server/accounts/delegates/collect_folder.ex @@ -24,7 +24,7 @@ defmodule GroupherServer.Accounts.Delegate.CollectFolder do # @max_article_count_per_collect_folder 300 @default_meta Embeds.CollectFolderMeta.default_meta() - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @doc """ list a user's not-private collect folders diff --git a/lib/groupher_server/accounts/delegates/upvoted_articles.ex b/lib/groupher_server/accounts/delegates/upvoted_articles.ex index a78ae161f..ffa3cd398 100644 --- a/lib/groupher_server/accounts/delegates/upvoted_articles.ex +++ b/lib/groupher_server/accounts/delegates/upvoted_articles.ex @@ -11,7 +11,7 @@ defmodule GroupherServer.Accounts.Delegate.UpvotedArticles do alias GroupherServer.CMS alias CMS.{ArticleUpvote} - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @doc """ get paged upvoted articles diff --git a/lib/groupher_server/accounts/embeds/collect_folder_meta.ex b/lib/groupher_server/accounts/embeds/collect_folder_meta.ex index 83104e3d2..0d7edaa00 100644 --- a/lib/groupher_server/accounts/embeds/collect_folder_meta.ex +++ b/lib/groupher_server/accounts/embeds/collect_folder_meta.ex @@ -12,7 +12,7 @@ defmodule GroupherServer.Accounts.Embeds.CollectFolderMeta.Macros do """ import Helper.Utils, only: [get_config: 2] - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) defmacro threads_fields() do @article_threads @@ -34,7 +34,7 @@ defmodule GroupherServer.Accounts.Embeds.CollectFolderMeta do import GroupherServer.Accounts.Embeds.CollectFolderMeta.Macros import Helper.Utils, only: [get_config: 2] - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @optional_fields Enum.map(@article_threads, &:"#{&1}_count") ++ Enum.map(@article_threads, &:"has_#{&1}") diff --git a/lib/groupher_server/accounts/embeds/user_meta.ex b/lib/groupher_server/accounts/embeds/user_meta.ex index 5fa95acdb..bb2430a40 100644 --- a/lib/groupher_server/accounts/embeds/user_meta.ex +++ b/lib/groupher_server/accounts/embeds/user_meta.ex @@ -3,7 +3,7 @@ defmodule GroupherServer.Accounts.Embeds.UserMeta.Macro do import Helper.Utils, only: [get_config: 2] - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) defmacro published_article_count_fields() do @article_threads @@ -26,7 +26,7 @@ defmodule GroupherServer.Accounts.Embeds.UserMeta do import GroupherServer.Accounts.Embeds.UserMeta.Macro import Helper.Utils, only: [get_config: 2] - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @general_options %{ reported_count: 0, diff --git a/lib/groupher_server/cms/abuse_report.ex b/lib/groupher_server/cms/abuse_report.ex index 85146601a..53e397489 100644 --- a/lib/groupher_server/cms/abuse_report.ex +++ b/lib/groupher_server/cms/abuse_report.ex @@ -13,7 +13,7 @@ defmodule GroupherServer.CMS.AbuseReport do alias GroupherServer.{Accounts, CMS} alias CMS.{ArticleComment, Embeds} - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) # @required_fields ~w(article_comment_id user_id recived_user_id)a @optional_fields ~w(article_comment_id account_id operate_user_id deal_with report_cases_count)a diff --git a/lib/groupher_server/cms/article_collect.ex b/lib/groupher_server/cms/article_collect.ex index bc361b3f5..ef5d934fb 100644 --- a/lib/groupher_server/cms/article_collect.ex +++ b/lib/groupher_server/cms/article_collect.ex @@ -12,7 +12,7 @@ defmodule GroupherServer.CMS.ArticleCollect do alias GroupherServer.Accounts alias Accounts.{User, CollectFolder} - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @required_fields ~w(user_id)a @optional_fields ~w(thread)a diff --git a/lib/groupher_server/cms/article_comment.ex b/lib/groupher_server/cms/article_comment.ex index 908dd30db..121bfbcea 100644 --- a/lib/groupher_server/cms/article_comment.ex +++ b/lib/groupher_server/cms/article_comment.ex @@ -14,7 +14,7 @@ defmodule GroupherServer.CMS.ArticleComment do alias CMS.{Embeds, ArticleCommentUpvote} # alias Helper.HTML - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @required_fields ~w(body_html author_id)a @optional_fields ~w(reply_to_id replies_count is_folded is_deleted floor is_article_author thread)a diff --git a/lib/groupher_server/cms/article_comment_user_emotion.ex b/lib/groupher_server/cms/article_comment_user_emotion.ex index 82deccf8a..949ee346d 100644 --- a/lib/groupher_server/cms/article_comment_user_emotion.ex +++ b/lib/groupher_server/cms/article_comment_user_emotion.ex @@ -1,7 +1,7 @@ defmodule GroupherServer.CMS.ArticleCommentUserEmotion.Macros do import Helper.Utils, only: [get_config: 2] - @supported_emotions get_config(:article, :comment_supported_emotions) + @supported_emotions get_config(:article, :comment_emotions) defmacro emotion_fields() do @supported_emotions @@ -25,7 +25,7 @@ defmodule GroupherServer.CMS.ArticleCommentUserEmotion do alias GroupherServer.{Accounts, CMS} alias CMS.ArticleComment - @supported_emotions get_config(:article, :comment_supported_emotions) + @supported_emotions get_config(:article, :comment_emotions) @required_fields ~w(article_comment_id user_id recived_user_id)a @optional_fields Enum.map(@supported_emotions, &:"#{&1}") diff --git a/lib/groupher_server/cms/article_pinned_comment.ex b/lib/groupher_server/cms/article_pinned_comment.ex index fd470ea29..06594c327 100644 --- a/lib/groupher_server/cms/article_pinned_comment.ex +++ b/lib/groupher_server/cms/article_pinned_comment.ex @@ -14,7 +14,7 @@ defmodule GroupherServer.CMS.ArticlePinnedComment do alias CMS.ArticleComment # alias Helper.HTML - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @required_fields ~w(article_comment_id)a # @optional_fields ~w(post_id job_id repo_id)a diff --git a/lib/groupher_server/cms/article_upvote.ex b/lib/groupher_server/cms/article_upvote.ex index 9ee913c2f..cfbad70f2 100644 --- a/lib/groupher_server/cms/article_upvote.ex +++ b/lib/groupher_server/cms/article_upvote.ex @@ -12,7 +12,7 @@ defmodule GroupherServer.CMS.ArticleUpvote do alias GroupherServer.Accounts alias Accounts.User - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @required_fields ~w(user_id)a @optional_fields ~w(thread)a diff --git a/lib/groupher_server/cms/article_user_emotion.ex b/lib/groupher_server/cms/article_user_emotion.ex index 48c6d9d34..a6ad2387b 100644 --- a/lib/groupher_server/cms/article_user_emotion.ex +++ b/lib/groupher_server/cms/article_user_emotion.ex @@ -1,7 +1,7 @@ defmodule GroupherServer.CMS.ArticleUserEmotion.Macros do import Helper.Utils, only: [get_config: 2] - @supported_emotions get_config(:article, :supported_emotions) + @supported_emotions get_config(:article, :emotions) defmacro emotion_fields() do @supported_emotions @@ -26,8 +26,8 @@ defmodule GroupherServer.CMS.ArticleUserEmotion do alias GroupherServer.Accounts - @supported_emotions get_config(:article, :supported_emotions) - @article_threads get_config(:article, :article_threads) + @supported_emotions get_config(:article, :emotions) + @article_threads get_config(:article, :threads) @required_fields ~w(user_id recived_user_id)a @optional_fields Enum.map(@article_threads, &:"#{&1}_id") ++ diff --git a/lib/groupher_server/cms/delegates/abuse_report.ex b/lib/groupher_server/cms/delegates/abuse_report.ex index db1a8036e..1c95d8d6b 100644 --- a/lib/groupher_server/cms/delegates/abuse_report.ex +++ b/lib/groupher_server/cms/delegates/abuse_report.ex @@ -17,7 +17,7 @@ defmodule GroupherServer.CMS.Delegate.AbuseReport do alias Ecto.Multi - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @report_threshold_for_fold ArticleComment.report_threshold_for_fold() @export_author_keys [:id, :login, :nickname, :avatar] diff --git a/lib/groupher_server/cms/delegates/article_comment_action.ex b/lib/groupher_server/cms/delegates/article_comment_action.ex index d063f3a7d..bcb9b3e93 100644 --- a/lib/groupher_server/cms/delegates/article_comment_action.ex +++ b/lib/groupher_server/cms/delegates/article_comment_action.ex @@ -20,7 +20,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleCommentAction do alias Ecto.Multi - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @max_parent_replies_count ArticleComment.max_parent_replies_count() @pinned_comment_limit ArticleComment.pinned_comment_limit() diff --git a/lib/groupher_server/cms/delegates/community_curd.ex b/lib/groupher_server/cms/delegates/community_curd.ex index 5df2be588..6351c25ce 100644 --- a/lib/groupher_server/cms/delegates/community_curd.ex +++ b/lib/groupher_server/cms/delegates/community_curd.ex @@ -25,7 +25,7 @@ defmodule GroupherServer.CMS.Delegate.CommunityCURD do } @default_meta Embeds.CommunityMeta.default_meta() - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) def read_community(clauses, user), do: read_community(clauses) |> viewer_has_states(user) def read_community(%{id: id}), do: ORM.read(Community, id, inc: :views) diff --git a/lib/groupher_server/cms/delegates/helper.ex b/lib/groupher_server/cms/delegates/helper.ex index 1bb952c9f..66e92c626 100644 --- a/lib/groupher_server/cms/delegates/helper.ex +++ b/lib/groupher_server/cms/delegates/helper.ex @@ -18,8 +18,8 @@ defmodule GroupherServer.CMS.Delegate.Helper do # TODO: # @max_latest_emotion_users_count ArticleComment.max_latest_emotion_users_count() @max_latest_emotion_users_count 4 - @supported_emotions get_config(:article, :supported_emotions) - @supported_comment_emotions get_config(:article, :comment_supported_emotions) + @supported_emotions get_config(:article, :emotions) + @supported_comment_emotions get_config(:article, :comment_emotions) ####### # emotion related diff --git a/lib/groupher_server/cms/embeds/article_comment_emotion.ex b/lib/groupher_server/cms/embeds/article_comment_emotion.ex index 35bf3e888..04840686c 100644 --- a/lib/groupher_server/cms/embeds/article_comment_emotion.ex +++ b/lib/groupher_server/cms/embeds/article_comment_emotion.ex @@ -13,7 +13,7 @@ defmodule GroupherServer.CMS.Embeds.ArticleCommentEmotion.Macros do alias GroupherServer.CMS alias CMS.Embeds - @supported_emotions get_config(:article, :comment_supported_emotions) + @supported_emotions get_config(:article, :comment_emotions) defmacro emotion_fields() do @supported_emotions @@ -39,7 +39,7 @@ defmodule GroupherServer.CMS.Embeds.ArticleCommentEmotion do import GroupherServer.CMS.Embeds.ArticleCommentEmotion.Macros import Helper.Utils, only: [get_config: 2] - @supported_emotions get_config(:article, :comment_supported_emotions) + @supported_emotions get_config(:article, :comment_emotions) @optional_fields Enum.map(@supported_emotions, &:"#{&1}_count") ++ Enum.map(@supported_emotions, &:"#{&1}_user_logins") diff --git a/lib/groupher_server/cms/embeds/article_emotion.ex b/lib/groupher_server/cms/embeds/article_emotion.ex index 694c11718..78b40c71d 100644 --- a/lib/groupher_server/cms/embeds/article_emotion.ex +++ b/lib/groupher_server/cms/embeds/article_emotion.ex @@ -13,7 +13,7 @@ defmodule GroupherServer.CMS.Embeds.ArticleEmotion.Macros do alias GroupherServer.CMS alias CMS.Embeds - @supported_emotions get_config(:article, :supported_emotions) + @supported_emotions get_config(:article, :emotions) defmacro emotion_fields() do @supported_emotions @@ -39,7 +39,7 @@ defmodule GroupherServer.CMS.Embeds.ArticleEmotion do import GroupherServer.CMS.Embeds.ArticleEmotion.Macros import Helper.Utils, only: [get_config: 2] - @supported_emotions get_config(:article, :supported_emotions) + @supported_emotions get_config(:article, :emotions) @optional_fields Enum.map(@supported_emotions, &:"#{&1}_count") ++ Enum.map(@supported_emotions, &:"#{&1}_user_logins") diff --git a/lib/groupher_server/cms/embeds/community_meta.ex b/lib/groupher_server/cms/embeds/community_meta.ex index 5b95a93c1..18c2ac7d5 100644 --- a/lib/groupher_server/cms/embeds/community_meta.ex +++ b/lib/groupher_server/cms/embeds/community_meta.ex @@ -3,7 +3,7 @@ defmodule GroupherServer.CMS.Embeds.CommunityMeta.Macro do import Helper.Utils, only: [get_config: 2] - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) defmacro thread_count_fields() do @article_threads @@ -26,7 +26,7 @@ defmodule GroupherServer.CMS.Embeds.CommunityMeta do import Helper.Utils, only: [get_config: 2] import GroupherServer.CMS.Embeds.CommunityMeta.Macro - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @general_options %{ editors_ids: [], diff --git a/lib/groupher_server/cms/helper/macros.ex b/lib/groupher_server/cms/helper/macros.ex index 8889bc299..e0dcb9e60 100644 --- a/lib/groupher_server/cms/helper/macros.ex +++ b/lib/groupher_server/cms/helper/macros.ex @@ -9,7 +9,7 @@ defmodule GroupherServer.CMS.Helper.Macros do alias Accounts.User alias CMS.{Author, Community, ArticleComment, ArticleTag, ArticleUpvote, ArticleCollect} - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @doc """ generate belongs to fields for given thread diff --git a/lib/groupher_server/cms/helper/matcher_macros.ex b/lib/groupher_server/cms/helper/matcher_macros.ex index 5614934ac..4d47dc9de 100644 --- a/lib/groupher_server/cms/helper/matcher_macros.ex +++ b/lib/groupher_server/cms/helper/matcher_macros.ex @@ -7,7 +7,7 @@ defmodule GroupherServer.CMS.Helper.MatcherMacros do alias GroupherServer.CMS alias CMS.{ArticleComment, Embeds} - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @doc """ match basic threads diff --git a/lib/groupher_server/cms/helper/utils.ex b/lib/groupher_server/cms/helper/utils.ex index e2b797840..dbef81685 100644 --- a/lib/groupher_server/cms/helper/utils.ex +++ b/lib/groupher_server/cms/helper/utils.ex @@ -8,7 +8,7 @@ defmodule GroupherServer.CMS.Helper.Utils do alias GroupherServer.CMS alias CMS.Community - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @article_fields @article_threads |> Enum.map(&:"#{&1}_id") @doc """ diff --git a/lib/groupher_server/cms/pinned_article.ex b/lib/groupher_server/cms/pinned_article.ex index e5eb13491..0226135c5 100644 --- a/lib/groupher_server/cms/pinned_article.ex +++ b/lib/groupher_server/cms/pinned_article.ex @@ -12,7 +12,7 @@ defmodule GroupherServer.CMS.PinnedArticle do alias GroupherServer.CMS alias CMS.Community - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @required_fields ~w(community_id thread)a # @optional_fields ~w(post_id job_id repo_id)a diff --git a/lib/groupher_server_web/schema/Helper/fields.ex b/lib/groupher_server_web/schema/Helper/fields.ex index ade73a6ca..e28e83cbe 100644 --- a/lib/groupher_server_web/schema/Helper/fields.ex +++ b/lib/groupher_server_web/schema/Helper/fields.ex @@ -7,10 +7,10 @@ defmodule GroupherServerWeb.Schema.Helper.Fields do alias GroupherServer.{Accounts, CMS} @page_size get_config(:general, :page_size) - @supported_emotions get_config(:article, :supported_emotions) - @supported_comment_emotions get_config(:article, :comment_supported_emotions) + @supported_emotions get_config(:article, :emotions) + @supported_comment_emotions get_config(:article, :comment_emotions) - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) defmacro timestamp_fields(:article) do quote do diff --git a/lib/groupher_server_web/schema/Helper/queries.ex b/lib/groupher_server_web/schema/Helper/queries.ex index 4ed41bfa6..07062ba1b 100644 --- a/lib/groupher_server_web/schema/Helper/queries.ex +++ b/lib/groupher_server_web/schema/Helper/queries.ex @@ -7,7 +7,7 @@ defmodule GroupherServerWeb.Schema.Helper.Queries do alias GroupherServerWeb.Middleware, as: M alias GroupherServerWeb.Resolvers, as: R - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) # user published articles defmacro published_article_queries() do diff --git a/lib/helper/orm.ex b/lib/helper/orm.ex index d72e59e15..f2145fc94 100644 --- a/lib/helper/orm.ex +++ b/lib/helper/orm.ex @@ -12,7 +12,7 @@ defmodule Helper.ORM do alias GroupherServer.Repo alias Helper.{QueryBuilder, SpecType} - @article_threads get_config(:article, :article_threads) + @article_threads get_config(:article, :threads) @doc """ a wrap for paginate request diff --git a/test/groupher_server/cms/articles/job_test.exs b/test/groupher_server/cms/articles/job_test.exs index c52324a02..742040c83 100644 --- a/test/groupher_server/cms/articles/job_test.exs +++ b/test/groupher_server/cms/articles/job_test.exs @@ -95,7 +95,6 @@ defmodule GroupherServer.Test.Articles.Job do end describe "[cms job sink/undo_sink]" do - @tag :wip2 test "if a job is too old, read job should update can_undo_sink flag", ~m(user community job_attrs)a do {:ok, job} = CMS.create_article(community, :job, job_attrs, user) @@ -110,7 +109,6 @@ defmodule GroupherServer.Test.Articles.Job do assert not job_last_year.meta.can_undo_sink end - @tag :wip2 test "can sink a job", ~m(user community job_attrs)a do {:ok, job} = CMS.create_article(community, :job, job_attrs, user) assert not job.meta.is_sinked @@ -120,7 +118,6 @@ defmodule GroupherServer.Test.Articles.Job do assert job.active_at == job.inserted_at end - @tag :wip2 test "can undo sink job", ~m(user community job_attrs)a do {:ok, job} = CMS.create_article(community, :job, job_attrs, user) {:ok, job} = CMS.sink_article(:job, job.id) @@ -132,7 +129,6 @@ defmodule GroupherServer.Test.Articles.Job do assert job.active_at == job.meta.last_active_at end - @tag :wip2 test "can not undo sink to old job", ~m()a do {:ok, job_last_year} = db_insert(:job, %{title: "last year", inserted_at: @last_year}) diff --git a/test/groupher_server/cms/articles/post_meta_test.exs b/test/groupher_server/cms/articles/post_meta_test.exs index 7974cfcf2..53bda7276 100644 --- a/test/groupher_server/cms/articles/post_meta_test.exs +++ b/test/groupher_server/cms/articles/post_meta_test.exs @@ -42,7 +42,6 @@ defmodule GroupherServer.Test.CMS.PostMeta do assert post.meta.is_edited end - @tag :wip test "post's lock article should work", ~m(user community post_attrs)a do {:ok, post} = CMS.create_article(community, :post, post_attrs, user) assert not post.meta.is_comment_locked diff --git a/test/groupher_server/cms/articles/post_test.exs b/test/groupher_server/cms/articles/post_test.exs index ff1c41d27..c88930b8a 100644 --- a/test/groupher_server/cms/articles/post_test.exs +++ b/test/groupher_server/cms/articles/post_test.exs @@ -105,7 +105,6 @@ defmodule GroupherServer.Test.CMS.Articles.Post do end describe "[cms post sink/undo_sink]" do - @tag :wip2 test "if a post is too old, read post should update can_undo_sink flag", ~m(user community post_attrs)a do {:ok, post} = CMS.create_article(community, :post, post_attrs, user) @@ -120,7 +119,6 @@ defmodule GroupherServer.Test.CMS.Articles.Post do assert not post_last_year.meta.can_undo_sink end - @tag :wip2 test "can sink a post", ~m(user community post_attrs)a do {:ok, post} = CMS.create_article(community, :post, post_attrs, user) assert not post.meta.is_sinked @@ -130,7 +128,6 @@ defmodule GroupherServer.Test.CMS.Articles.Post do assert post.active_at == post.inserted_at end - @tag :wip2 test "can undo sink post", ~m(user community post_attrs)a do {:ok, post} = CMS.create_article(community, :post, post_attrs, user) {:ok, post} = CMS.sink_article(:post, post.id) @@ -142,7 +139,6 @@ defmodule GroupherServer.Test.CMS.Articles.Post do assert post.active_at == post.meta.last_active_at end - @tag :wip2 test "can not undo sink to old post", ~m()a do {:ok, post_last_year} = db_insert(:post, %{title: "last year", inserted_at: @last_year}) diff --git a/test/groupher_server/cms/articles/repo_test.exs b/test/groupher_server/cms/articles/repo_test.exs index 7059778e5..3017e8e78 100644 --- a/test/groupher_server/cms/articles/repo_test.exs +++ b/test/groupher_server/cms/articles/repo_test.exs @@ -106,7 +106,6 @@ defmodule GroupherServer.Test.Articles.Repo do end describe "[cms repo sink/undo_sink]" do - @tag :wip2 test "if a repo is too old, read repo should update can_undo_sink flag", ~m(user community repo_attrs)a do {:ok, repo} = CMS.create_article(community, :repo, repo_attrs, user) @@ -121,7 +120,6 @@ defmodule GroupherServer.Test.Articles.Repo do assert not repo_last_year.meta.can_undo_sink end - @tag :wip2 test "can sink a repo", ~m(user community repo_attrs)a do {:ok, repo} = CMS.create_article(community, :repo, repo_attrs, user) assert not repo.meta.is_sinked @@ -131,7 +129,6 @@ defmodule GroupherServer.Test.Articles.Repo do assert repo.active_at == repo.inserted_at end - @tag :wip2 test "can undo sink repo", ~m(user community repo_attrs)a do {:ok, repo} = CMS.create_article(community, :repo, repo_attrs, user) {:ok, repo} = CMS.sink_article(:repo, repo.id) @@ -143,7 +140,6 @@ defmodule GroupherServer.Test.Articles.Repo do assert repo.active_at == repo.meta.last_active_at end - @tag :wip2 test "can not undo sink to old repo", ~m()a do {:ok, repo_last_year} = db_insert(:repo, %{title: "last year", inserted_at: @last_year}) diff --git a/test/groupher_server/cms/comments/job_comment_test.exs b/test/groupher_server/cms/comments/job_comment_test.exs index 4aa668d44..7571de272 100644 --- a/test/groupher_server/cms/comments/job_comment_test.exs +++ b/test/groupher_server/cms/comments/job_comment_test.exs @@ -72,16 +72,18 @@ defmodule GroupherServer.Test.CMS.Comments.JobComment do Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime() {:ok, job} = db_insert(:job, %{inserted_at: inserted_at}) + Process.sleep(1000) {:ok, _comment} = CMS.create_article_comment(:job, job.id, "job comment", user) {:ok, job} = ORM.find(Job, job.id) assert job.active_at |> DateTime.to_date() == DateTime.utc_now() |> DateTime.to_date() - # ---- + ##### inserted_at = Timex.shift(Timex.now(), days: -(active_period_days + 1)) |> Timex.to_datetime() {:ok, job} = db_insert(:job, %{inserted_at: inserted_at}) + Process.sleep(1000) {:ok, _comment} = CMS.create_article_comment(:job, job.id, "job comment", user) {:ok, job} = ORM.find(Job, job.id) diff --git a/test/groupher_server/cms/comments/post_comment_test.exs b/test/groupher_server/cms/comments/post_comment_test.exs index 066009ba8..40eb2924d 100644 --- a/test/groupher_server/cms/comments/post_comment_test.exs +++ b/test/groupher_server/cms/comments/post_comment_test.exs @@ -66,6 +66,7 @@ defmodule GroupherServer.Test.CMS.Comments.PostComment do assert post.active_at == post.inserted_at end + @tag :wip test "old post will not update active after comment created", ~m(user)a do active_period_days = Map.get(@active_period, :post) @@ -73,16 +74,18 @@ defmodule GroupherServer.Test.CMS.Comments.PostComment do Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime() {:ok, post} = db_insert(:post, %{inserted_at: inserted_at}) + Process.sleep(1000) {:ok, _comment} = CMS.create_article_comment(:post, post.id, "post comment", user) {:ok, post} = ORM.find(Post, post.id) assert post.active_at |> DateTime.to_date() == DateTime.utc_now() |> DateTime.to_date() - # ---- + ##### inserted_at = Timex.shift(Timex.now(), days: -(active_period_days + 1)) |> Timex.to_datetime() {:ok, post} = db_insert(:post, %{inserted_at: inserted_at}) + Process.sleep(1000) {:ok, _comment} = CMS.create_article_comment(:post, post.id, "post comment", user) {:ok, post} = ORM.find(Post, post.id) diff --git a/test/groupher_server/cms/comments/repo_comment_test.exs b/test/groupher_server/cms/comments/repo_comment_test.exs index f43f9d2a8..984e05974 100644 --- a/test/groupher_server/cms/comments/repo_comment_test.exs +++ b/test/groupher_server/cms/comments/repo_comment_test.exs @@ -73,16 +73,18 @@ defmodule GroupherServer.Test.CMS.Comments.RepoComment do Timex.shift(Timex.now(), days: -(active_period_days - 1)) |> Timex.to_datetime() {:ok, repo} = db_insert(:repo, %{inserted_at: inserted_at}) + Process.sleep(1000) {:ok, _comment} = CMS.create_article_comment(:repo, repo.id, "repo comment", user) {:ok, repo} = ORM.find(Repo, repo.id) assert repo.active_at |> DateTime.to_date() == DateTime.utc_now() |> DateTime.to_date() - # ---- + ##### inserted_at = Timex.shift(Timex.now(), days: -(active_period_days + 1)) |> Timex.to_datetime() {:ok, repo} = db_insert(:repo, %{inserted_at: inserted_at}) + Process.sleep(1000) {:ok, _comment} = CMS.create_article_comment(:repo, repo.id, "repo comment", user) {:ok, repo} = ORM.find(Repo, repo.id) diff --git a/test/groupher_server_web/mutation/cms/sink/job_sink_test.exs b/test/groupher_server_web/mutation/cms/sink/job_sink_test.exs index 9b7863716..a918eae57 100644 --- a/test/groupher_server_web/mutation/cms/sink/job_sink_test.exs +++ b/test/groupher_server_web/mutation/cms/sink/job_sink_test.exs @@ -26,8 +26,8 @@ defmodule GroupherServer.Test.Mutation.Sink.JobSink do } } """ - @tag :wip - test "login user can sink a job", ~m(user_conn community job)a do + + test "login user can sink a job", ~m(community job)a do variables = %{id: job.id, communityId: community.id} passport_rules = %{community.raw => %{"job.sink" => true}} rule_conn = simu_conn(:user, cms: passport_rules) @@ -40,7 +40,6 @@ defmodule GroupherServer.Test.Mutation.Sink.JobSink do assert job.active_at == job.inserted_at end - @tag :wip test "unauth user sink a job fails", ~m(guest_conn community job)a do variables = %{id: job.id, communityId: community.id} @@ -54,7 +53,7 @@ defmodule GroupherServer.Test.Mutation.Sink.JobSink do } } """ - @tag :wip + test "login user can undo sink to a job", ~m(community job)a do variables = %{id: job.id, communityId: community.id} diff --git a/test/groupher_server_web/mutation/cms/sink/post_sink_test.exs b/test/groupher_server_web/mutation/cms/sink/post_sink_test.exs index 407039508..15b7a4829 100644 --- a/test/groupher_server_web/mutation/cms/sink/post_sink_test.exs +++ b/test/groupher_server_web/mutation/cms/sink/post_sink_test.exs @@ -26,8 +26,8 @@ defmodule GroupherServer.Test.Mutation.Sink.PostSink do } } """ - @tag :wip - test "login user can sink a post", ~m(user_conn community post)a do + + test "login user can sink a post", ~m(community post)a do variables = %{id: post.id, communityId: community.id} passport_rules = %{community.raw => %{"post.sink" => true}} rule_conn = simu_conn(:user, cms: passport_rules) @@ -40,7 +40,6 @@ defmodule GroupherServer.Test.Mutation.Sink.PostSink do assert post.active_at == post.inserted_at end - @tag :wip test "unauth user sink a post fails", ~m(guest_conn community post)a do variables = %{id: post.id, communityId: community.id} @@ -54,7 +53,7 @@ defmodule GroupherServer.Test.Mutation.Sink.PostSink do } } """ - @tag :wip + test "login user can undo sink to a post", ~m(community post)a do variables = %{id: post.id, communityId: community.id} diff --git a/test/groupher_server_web/mutation/cms/sink/repo_sink_test.exs b/test/groupher_server_web/mutation/cms/sink/repo_sink_test.exs index 8de7d91de..2731c0621 100644 --- a/test/groupher_server_web/mutation/cms/sink/repo_sink_test.exs +++ b/test/groupher_server_web/mutation/cms/sink/repo_sink_test.exs @@ -26,8 +26,8 @@ defmodule GroupherServer.Test.Mutation.Sink.RepoSink do } } """ - @tag :wip - test "login user can sink a repo", ~m(user_conn community repo)a do + + test "login user can sink a repo", ~m(community repo)a do variables = %{id: repo.id, communityId: community.id} passport_rules = %{community.raw => %{"repo.sink" => true}} rule_conn = simu_conn(:user, cms: passport_rules) @@ -40,7 +40,6 @@ defmodule GroupherServer.Test.Mutation.Sink.RepoSink do assert repo.active_at == repo.inserted_at end - @tag :wip test "unauth user sink a repo fails", ~m(guest_conn community repo)a do variables = %{id: repo.id, communityId: community.id} @@ -54,7 +53,7 @@ defmodule GroupherServer.Test.Mutation.Sink.RepoSink do } } """ - @tag :wip + test "login user can undo sink to a repo", ~m(community repo)a do variables = %{id: repo.id, communityId: community.id} diff --git a/test/groupher_server_web/query/cms/paged_articles/paged_posts_test.exs b/test/groupher_server_web/query/cms/paged_articles/paged_posts_test.exs index 21b699afc..8e41e4e61 100644 --- a/test/groupher_server_web/query/cms/paged_articles/paged_posts_test.exs +++ b/test/groupher_server_web/query/cms/paged_articles/paged_posts_test.exs @@ -315,7 +315,7 @@ defmodule GroupherServer.Test.Query.PagedArticles.PagedPosts do } } """ - @tag :wip2 + test "latest commented post should appear on top", ~m(guest_conn post_last_week user)a do variables = %{filter: %{page: 1, size: 20}} results = guest_conn |> query_result(@query, variables, "pagedPosts") @@ -333,7 +333,6 @@ defmodule GroupherServer.Test.Query.PagedArticles.PagedPosts do assert first_post["id"] == to_string(post_last_week.id) end - @tag :wip2 test "comment on very old post have no effect", ~m(guest_conn post_last_year user)a do variables = %{filter: %{page: 1, size: 20}} @@ -346,7 +345,6 @@ defmodule GroupherServer.Test.Query.PagedArticles.PagedPosts do assert first_post["id"] !== to_string(post_last_year.id) end - @tag :wip2 test "latest post author commented post have no effect", ~m(guest_conn post_last_week)a do variables = %{filter: %{page: 1, size: 20}}