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
3578daa1
Valider
3578daa1
rédigé
il y a 14 ans
par
zhitomirskiyi
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
IZ MS more photo controller specs
parent
5e9d70f8
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/controllers/photos_controller.rb
+7
-3
7 ajouts, 3 suppressions
app/controllers/photos_controller.rb
lib/diaspora/user/friending.rb
+0
-4
0 ajout, 4 suppressions
lib/diaspora/user/friending.rb
spec/controllers/photos_controller_spec.rb
+21
-5
21 ajouts, 5 suppressions
spec/controllers/photos_controller_spec.rb
avec
28 ajouts
et
12 suppressions
app/controllers/photos_controller.rb
+
7
−
3
Voir le fichier @
3578daa1
...
...
@@ -10,7 +10,7 @@ class PhotosController < ApplicationController
def
index
if
params
[
:person_id
]
@person
=
current_user
.
visible_people
.
find_by
_person_id
(
params
[
:person_id
])
@person
=
current_user
.
contact_for
_person_id
(
params
[
:person_id
])
.
person
end
@person
||=
current_user
.
person
...
...
@@ -87,6 +87,10 @@ class PhotosController < ApplicationController
@photo
.
destroy
flash
[
:notice
]
=
I18n
.
t
'photos.destroy.notice'
redirect
=
@photo
.
album
redirect
||=
photos_path
respond_with
:location
=>
@photo
.
album
end
...
...
@@ -104,9 +108,9 @@ class PhotosController < ApplicationController
def
edit
@photo
=
current_user
.
find_visible_post_by_id
params
[
:id
]
@album
=
@photo
.
album
@album
=
@photo
.
album
redirect_to
@photo
unless
current_user
.
owns?
@
album
redirect_to
@photo
#
unless current_user.owns? @
photo
end
def
update
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
lib/diaspora/user/friending.rb
+
0
−
4
Voir le fichier @
3578daa1
...
...
@@ -127,10 +127,6 @@ module Diaspora
aspect
.
save
end
def
contact_for
(
person
)
friends
.
first
(
:person_id
=>
person
.
id
)
end
def
request_from_me?
(
request
)
request
.
callback_url
==
person
.
receive_url
end
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/controllers/photos_controller_spec.rb
+
21
−
5
Voir le fichier @
3578daa1
...
...
@@ -16,6 +16,7 @@ describe PhotosController do
let
(
:fixture_name
)
{
File
.
join
(
File
.
dirname
(
__FILE__
),
'..'
,
'fixtures'
,
filename
)}
let
(
:image
)
{
File
.
open
(
fixture_name
)}
let!
(
:photo
){
user
.
post
(
:photo
,
:album_id
=>
album
.
id
,
:user_file
=>
image
,
:to
=>
aspect
.
id
)}
let
(
:photo_no_album
){
user
.
post
(
:photo
,
:user_file
=>
image
,
:to
=>
aspect
.
id
)}
before
do
friend_users
(
user
,
aspect
,
user2
,
aspect2
)
...
...
@@ -36,7 +37,6 @@ describe PhotosController do
describe
'#index'
do
it
'defaults to returning all of users pictures'
do
pending
get
:index
assigns
[
:person
].
should
==
user
.
person
assigns
[
:photos
].
should
==
[
photo
]
...
...
@@ -44,12 +44,9 @@ describe PhotosController do
end
it
'sets the person to a friend if person_id is set'
do
pending
puts
user
.
visible_people
.
inspect
user
.
should_not_receive
(
:person
)
get
:index
,
:person_id
=>
user2
.
person
.
id
assigns
[
:person
].
should
==
[
user2
.
person
]
assigns
[
:person
].
should
==
user2
.
person
assigns
[
:photos
].
should
==
[]
assigns
[
:albums
].
should
==
[]
end
...
...
@@ -62,11 +59,30 @@ describe PhotosController do
end
describe
'#show'
do
it
'assigns the photo based on the photo id'
do
get
:show
,
:id
=>
photo
.
id
assigns
[
:photo
].
should
==
photo
assigns
[
:album
].
should
==
album
assigns
[
:ownership
].
should
==
true
end
end
describe
'#edit'
do
it
'should let you edit a photo with an album'
do
pending
get
:edit
,
:id
=>
photo
.
id
response
.
should_not
redirect_to
(
photo
)
end
it
'should let you edit a photo you own that does not have an album'
do
pending
get
:edit
,
:id
=>
photo_no_album
.
id
response
.
should_not
redirect_to
(
photo
)
end
end
...
...
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