Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
P
parlote-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
parlote-facil
Validations
2be06442
Non vérifiée
Valider
2be06442
rédigé
7 years ago
par
Rete2
Validation de
Benjamin Neff
7 years ago
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Issue #6559: Changed default mail FROM header and tests
parent
da904ac0
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
app/mailers/notification_mailers/base.rb
+3
-2
3 ajouts, 2 suppressions
app/mailers/notification_mailers/base.rb
spec/mailers/notifier_spec.rb
+21
-7
21 ajouts, 7 suppressions
spec/mailers/notifier_spec.rb
spec/mailers/report_spec.rb
+5
-0
5 ajouts, 0 suppression
spec/mailers/report_spec.rb
avec
29 ajouts
et
9 suppressions
app/mailers/notification_mailers/base.rb
+
3
−
2
Voir le fichier @
2be06442
...
...
@@ -38,8 +38,9 @@ module NotificationMailers
host:
"
#{
AppConfig
.
pod_uri
.
host
}
"
,
to:
name_and_address
(
@recipient
.
name
,
@recipient
.
email
)
}
headers
[
:from
]
=
"
\"
#{
@sender
.
name
}
(diaspora*)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
if
@sender
.
present?
return
headers
if
@sender
.
blank?
sender_in_header
=
@sender
.
profile
.
full_name
.
empty?
?
@sender
.
username
:
@sender
.
name
headers
[
:from
]
=
"
\"
Diaspora* (
#{
sender_in_header
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
headers
end
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/mailers/notifier_spec.rb
+
21
−
7
Voir le fichier @
2be06442
...
...
@@ -246,7 +246,7 @@ describe Notifier, type: :mailer do
end
it
"FROM: contains the sender's name"
do
expect
(
@mail
[
"From"
].
to_s
).
to
eq
(
"
\"
#{
@cnv
.
author
.
name
}
(diaspora*
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
expect
(
@mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
@cnv
.
author
.
name
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
it
"should use a generic subject"
do
...
...
@@ -290,7 +290,7 @@ describe Notifier, type: :mailer do
end
it
"FROM: contains the sender's name"
do
expect
(
comment_mail
[
"From"
].
to_s
).
to
eq
(
"
\"
#{
eve
.
name
}
(diaspora*
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
expect
(
comment_mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
eve
.
name
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
it
"SUBJECT: has a snippet of the post contents, without markdown and without newlines"
do
...
...
@@ -331,7 +331,7 @@ describe Notifier, type: :mailer do
end
it
"FROM: has the name of person commenting as the sender"
do
expect
(
comment_mail
[
"From"
].
to_s
).
to
eq
(
"
\"
#{
eve
.
name
}
(diaspora*
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
expect
(
comment_mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
eve
.
name
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
it
"SUBJECT: has a snippet of the post contents, without markdown and without newlines"
do
...
...
@@ -386,7 +386,7 @@ describe Notifier, type: :mailer do
end
it
"FROM: contains the sender's name"
do
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
#{
bob
.
name
}
(diaspora*
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
bob
.
name
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
it
"SUBJECT: does not show the limited post"
do
...
...
@@ -411,7 +411,7 @@ describe Notifier, type: :mailer do
end
it
"FROM: contains the sender's name"
do
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
#{
bob
.
name
}
(diaspora*
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
bob
.
name
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
it
"SUBJECT: does not show the limited post"
do
...
...
@@ -442,7 +442,7 @@ describe Notifier, type: :mailer do
end
it
"FROM: contains the sender's name"
do
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
#{
bob
.
name
}
(diaspora*
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
bob
.
name
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
it
"SUBJECT: does not show the limited post"
do
...
...
@@ -478,7 +478,11 @@ describe Notifier, type: :mailer do
expect
(
@confirm_email
.
to
).
to
eq
([
bob
.
unconfirmed_email
])
end
it
"has the unconfirmed emil in the subject"
do
it
"FROM: header should be the default sender address"
do
expect
(
@confirm_email
[
"From"
].
to_s
).
to
eq
(
AppConfig
.
mail
.
sender_address
.
to_s
)
end
it
"has the unconfirmed email in the subject"
do
expect
(
@confirm_email
.
subject
).
to
include
(
bob
.
unconfirmed_email
)
end
...
...
@@ -502,6 +506,10 @@ describe Notifier, type: :mailer do
expect
(
email
.
to
).
to
eq
([
alice
.
email
])
end
it
"FROM: header should be the default sender address"
do
expect
(
email
[
"From"
].
to_s
).
to
eq
(
AppConfig
.
mail
.
sender_address
.
to_s
)
end
it
"has the correct subject"
do
expect
(
email
.
subject
).
to
eq
(
I18n
.
translate
(
"notifier.csrf_token_fail.subject"
,
name:
alice
.
name
))
end
...
...
@@ -535,5 +543,11 @@ describe Notifier, type: :mailer do
Notifier
.
send_notification
(
"started_sharing"
,
bob
.
id
,
person
.
id
)
}.
to_not
raise_error
end
it
"FROM: header should be 'Diaspora* (username)' when there is no first and last name"
do
bob
.
person
.
profile
.
update_attributes
(
first_name:
""
,
last_name:
""
)
mail
=
Notifier
.
send_notification
(
"started_sharing"
,
alice
.
id
,
bob
.
person
.
id
)
expect
(
mail
[
"From"
].
to_s
).
to
eq
(
"
\"
Diaspora* (
#{
bob
.
person
.
username
}
)
\"
<
#{
AppConfig
.
mail
.
sender_address
}
>"
)
end
end
end
Ce diff est replié.
Cliquez pour l'agrandir.
spec/mailers/report_spec.rb
+
5
−
0
Voir le fichier @
2be06442
...
...
@@ -41,6 +41,11 @@ describe Report, type: :mailer do
expect
(
ActionMailer
::
Base
.
deliveries
[
1
].
to
[
0
]).
to
include
(
@user2
.
email
)
end
it
"FROM: header should be the default sender address"
do
ReportMailer
.
new_report
(
@post_report
.
id
).
each
(
&
:deliver_now
)
expect
(
ReportMailer
.
default
[
:from
].
to_s
).
to
eq
(
AppConfig
.
mail
.
sender_address
.
to_s
)
end
it
"should send mail in recipent's prefered language"
do
ReportMailer
.
new_report
(
@post_report
.
id
).
each
(
&
:deliver_now
)
expect
(
ActionMailer
::
Base
.
deliveries
[
0
].
subject
).
to
match
(
"Ein neuer post wurde als anstößig markiert"
)
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter