EmailList: export user nickname
This commit is contained in:
parent
53796b6344
commit
385d432ce7
@ -11,7 +11,7 @@ defmodule Pleroma.User.EmailList do
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.User
|
||||
|
||||
@header_row ["Email Address"]
|
||||
@header_row ["Email Address", "Nickname"]
|
||||
|
||||
defp query(:subscribers) do
|
||||
User.Query.build(%{
|
||||
@ -43,7 +43,9 @@ defmodule Pleroma.User.EmailList do
|
||||
|> build_csv()
|
||||
end
|
||||
|
||||
defp build_row(%User{email: email}), do: [email]
|
||||
defp build_row(%User{email: email, nickname: nickname}) do
|
||||
[email, nickname]
|
||||
end
|
||||
|
||||
defp build_csv(lines) do
|
||||
[@header_row | lines]
|
||||
|
@ -16,10 +16,10 @@ defmodule Pleroma.User.EmailListTest do
|
||||
insert(:user, accepts_email_list: false)
|
||||
|
||||
expected = """
|
||||
Email Address\r
|
||||
#{user1.email}\r
|
||||
#{user2.email}\r
|
||||
#{user3.email}\r
|
||||
Email Address,Nickname\r
|
||||
#{user1.email},#{user1.nickname}\r
|
||||
#{user2.email},#{user2.nickname}\r
|
||||
#{user3.email},#{user3.nickname}\r
|
||||
"""
|
||||
|
||||
assert EmailList.generate_csv(:subscribers) == expected
|
||||
@ -32,9 +32,9 @@ defmodule Pleroma.User.EmailListTest do
|
||||
insert(:user, accepts_email_list: true)
|
||||
|
||||
expected = """
|
||||
Email Address\r
|
||||
#{user1.email}\r
|
||||
#{user2.email}\r
|
||||
Email Address,Nickname\r
|
||||
#{user1.email},#{user1.nickname}\r
|
||||
#{user2.email},#{user2.nickname}\r
|
||||
"""
|
||||
|
||||
assert EmailList.generate_csv(:unsubscribers) == expected
|
||||
|
Loading…
Reference in New Issue
Block a user