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
3387c20b
Valider
3387c20b
rédigé
il y a 13 ans
par
Raphael Sofaer
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Fix redirect away from conversation
parent
1df287b2
Aucune branche associée trouvée
Branches contenant la validation
Aucune étiquette associée trouvée
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Modifications
2
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
app/controllers/conversations_controller.rb
+10
-7
10 ajouts, 7 suppressions
app/controllers/conversations_controller.rb
spec/controllers/conversations_controller_spec.rb
+12
-14
12 ajouts, 14 suppressions
spec/controllers/conversations_controller_spec.rb
avec
22 ajouts
et
21 suppressions
app/controllers/conversations_controller.rb
+
10
−
7
Voir le fichier @
3387c20b
...
...
@@ -42,14 +42,17 @@ class ConversationsController < ApplicationController
end
def
show
@conversation
=
Conversation
.
joins
(
:conversation_visibilities
).
where
(
:id
=>
params
[
:id
],
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
.
id
}).
first
if
@visibility
=
ConversationVisibility
.
where
(
:conversation_id
=>
params
[
:id
],
:person_id
=>
current_user
.
person
.
id
).
first
@visibility
.
unread
=
0
@visibility
.
save
end
if
@conversation
=
Conversation
.
joins
(
:conversation_visibilities
).
where
(
:id
=>
params
[
:id
],
:conversation_visibilities
=>
{
:person_id
=>
current_user
.
person
.
id
}).
first
if
@visibility
=
ConversationVisibility
.
where
(
:conversation_id
=>
params
[
:id
],
:person_id
=>
current_user
.
person
.
id
).
first
@visibility
.
unread
=
0
@visibility
.
save
end
respond_with
@conversation
respond_with
@conversation
else
redirect_to
conversations_path
end
end
def
new
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/controllers/conversations_controller_spec.rb
+
12
−
14
Voir le fichier @
3387c20b
...
...
@@ -4,8 +4,7 @@ describe ConversationsController do
render_views
before
do
@alice
=
alice
sign_in
:user
,
@alice
sign_in
:user
,
alice
end
describe
'#new'
do
...
...
@@ -16,11 +15,11 @@ describe ConversationsController do
response
.
should
be_success
end
it
"assigns a list of the user's contacts"
do
assigns
(
:all_contacts_and_ids
).
should
==
@
alice
.
contacts
.
collect
{
|
c
|
{
"value"
=>
c
.
id
,
"name"
=>
c
.
person
.
name
}}
assigns
(
:all_contacts_and_ids
).
should
==
alice
.
contacts
.
collect
{
|
c
|
{
"value"
=>
c
.
id
,
"name"
=>
c
.
person
.
name
}}
end
it
"assigns a contact if passed a contact id"
do
get
:new
,
:contact_id
=>
@
alice
.
contacts
.
first
.
id
assigns
(
:contact
).
should
==
@
alice
.
contacts
.
first
get
:new
,
:contact_id
=>
alice
.
contacts
.
first
.
id
assigns
(
:contact
).
should
==
alice
.
contacts
.
first
end
end
...
...
@@ -31,7 +30,7 @@ describe ConversationsController do
end
it
'retrieves all conversations for a user'
do
hash
=
{
:author
=>
@
alice
.
person
,
:participant_ids
=>
[
@
alice
.
contacts
.
first
.
person
.
id
,
@
alice
.
person
.
id
],
hash
=
{
:author
=>
alice
.
person
,
:participant_ids
=>
[
alice
.
contacts
.
first
.
person
.
id
,
alice
.
person
.
id
],
:subject
=>
'not spam'
,
:text
=>
'cool stuff'
}
3
.
times
{
Conversation
.
create
(
hash
)
}
...
...
@@ -46,7 +45,7 @@ describe ConversationsController do
:conversation
=>
{
:subject
=>
"secret stuff"
,
:text
=>
'text'
},
:contact_ids
=>
[
@
alice
.
contacts
.
first
.
id
]
:contact_ids
=>
[
alice
.
contacts
.
first
.
id
]
}
end
...
...
@@ -65,15 +64,15 @@ describe ConversationsController do
it
'sets the author to the current_user'
do
@hash
[
:author
]
=
Factory
.
create
(
:user
)
post
:create
,
@hash
Message
.
first
.
author
.
should
==
@
alice
.
person
Conversation
.
first
.
author
.
should
==
@
alice
.
person
Message
.
first
.
author
.
should
==
alice
.
person
Conversation
.
first
.
author
.
should
==
alice
.
person
end
it
'dispatches the conversation'
do
cnv
=
Conversation
.
create
(
@hash
[
:conversation
].
merge
({
:author
=>
@
alice
.
person
,
:participant_ids
=>
[
@
alice
.
contacts
.
first
.
person
.
id
]}))
@hash
[
:conversation
].
merge
({
:author
=>
alice
.
person
,
:participant_ids
=>
[
alice
.
contacts
.
first
.
person
.
id
]}))
p
=
Postzord
::
Dispatch
.
new
(
@
alice
,
cnv
)
p
=
Postzord
::
Dispatch
.
new
(
alice
,
cnv
)
Postzord
::
Dispatch
.
stub!
(
:new
).
and_return
(
p
)
p
.
should_receive
(
:post
)
post
:create
,
@hash
...
...
@@ -82,7 +81,7 @@ describe ConversationsController do
describe
'#show'
do
before
do
hash
=
{
:author
=>
@
alice
.
person
,
:participant_ids
=>
[
@
alice
.
contacts
.
first
.
person
.
id
,
@
alice
.
person
.
id
],
hash
=
{
:author
=>
alice
.
person
,
:participant_ids
=>
[
alice
.
contacts
.
first
.
person
.
id
,
alice
.
person
.
id
],
:subject
=>
'not spam'
,
:text
=>
'cool stuff'
}
@conversation
=
Conversation
.
create
(
hash
)
end
...
...
@@ -94,8 +93,7 @@ describe ConversationsController do
end
it
'does not let you access conversations where you are not a recipient'
do
user2
=
eve
sign_in
:user
,
user2
sign_in
:user
,
eve
get
:show
,
:id
=>
@conversation
.
id
response
.
code
.
should
==
'302'
...
...
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