Add moderator function.
This commit is contained in:
parent
1bc34de4df
commit
5bc810c452
@ -41,7 +41,9 @@ def render("user.json", %{user: user = %User{}} = assigns) do
|
|||||||
"profile_image_url_https" => image,
|
"profile_image_url_https" => image,
|
||||||
"profile_image_url_profile_size" => image,
|
"profile_image_url_profile_size" => image,
|
||||||
"profile_image_url_original" => image,
|
"profile_image_url_original" => image,
|
||||||
"rights" => %{},
|
"rights" => %{
|
||||||
|
"delete_others_notice" => !!user.info["is_moderator"]
|
||||||
|
},
|
||||||
"screen_name" => user.nickname,
|
"screen_name" => user.nickname,
|
||||||
"statuses_count" => user_info[:note_count],
|
"statuses_count" => user_info[:note_count],
|
||||||
"statusnet_profile_url" => user.ap_id,
|
"statusnet_profile_url" => user.ap_id,
|
||||||
|
@ -53,7 +53,9 @@ test "A user" do
|
|||||||
"following" => false,
|
"following" => false,
|
||||||
"follows_you" => false,
|
"follows_you" => false,
|
||||||
"statusnet_blocking" => false,
|
"statusnet_blocking" => false,
|
||||||
"rights" => %{},
|
"rights" => %{
|
||||||
|
"delete_others_notice" => false
|
||||||
|
},
|
||||||
"statusnet_profile_url" => user.ap_id,
|
"statusnet_profile_url" => user.ap_id,
|
||||||
"cover_photo" => banner,
|
"cover_photo" => banner,
|
||||||
"background_image" => nil,
|
"background_image" => nil,
|
||||||
@ -86,7 +88,9 @@ test "A user for a given other follower", %{user: user} do
|
|||||||
"following" => true,
|
"following" => true,
|
||||||
"follows_you" => false,
|
"follows_you" => false,
|
||||||
"statusnet_blocking" => false,
|
"statusnet_blocking" => false,
|
||||||
"rights" => %{},
|
"rights" => %{
|
||||||
|
"delete_others_notice" => false
|
||||||
|
},
|
||||||
"statusnet_profile_url" => user.ap_id,
|
"statusnet_profile_url" => user.ap_id,
|
||||||
"cover_photo" => banner,
|
"cover_photo" => banner,
|
||||||
"background_image" => nil,
|
"background_image" => nil,
|
||||||
@ -120,7 +124,9 @@ test "A user that follows you", %{user: user} do
|
|||||||
"following" => false,
|
"following" => false,
|
||||||
"follows_you" => true,
|
"follows_you" => true,
|
||||||
"statusnet_blocking" => false,
|
"statusnet_blocking" => false,
|
||||||
"rights" => %{},
|
"rights" => %{
|
||||||
|
"delete_others_notice" => false
|
||||||
|
},
|
||||||
"statusnet_profile_url" => follower.ap_id,
|
"statusnet_profile_url" => follower.ap_id,
|
||||||
"cover_photo" => banner,
|
"cover_photo" => banner,
|
||||||
"background_image" => nil,
|
"background_image" => nil,
|
||||||
@ -130,6 +136,13 @@ test "A user that follows you", %{user: user} do
|
|||||||
assert represented == UserView.render("show.json", %{user: follower, for: user})
|
assert represented == UserView.render("show.json", %{user: follower, for: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "a user that is a moderator" do
|
||||||
|
user = insert(:user, %{info: %{"is_moderator" => true}})
|
||||||
|
represented = UserView.render("show.json", %{user: user, for: user})
|
||||||
|
|
||||||
|
assert represented["rights"]["delete_others_notice"]
|
||||||
|
end
|
||||||
|
|
||||||
test "A blocked user for the blocker" do
|
test "A blocked user for the blocker" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
blocker = insert(:user)
|
blocker = insert(:user)
|
||||||
@ -154,7 +167,9 @@ test "A blocked user for the blocker" do
|
|||||||
"following" => false,
|
"following" => false,
|
||||||
"follows_you" => false,
|
"follows_you" => false,
|
||||||
"statusnet_blocking" => true,
|
"statusnet_blocking" => true,
|
||||||
"rights" => %{},
|
"rights" => %{
|
||||||
|
"delete_others_notice" => false
|
||||||
|
},
|
||||||
"statusnet_profile_url" => user.ap_id,
|
"statusnet_profile_url" => user.ap_id,
|
||||||
"cover_photo" => banner,
|
"cover_photo" => banner,
|
||||||
"background_image" => nil,
|
"background_image" => nil,
|
||||||
|
Loading…
Reference in New Issue
Block a user