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
c3875566
Valider
c3875566
rédigé
il y a 14 ans
par
maxwell
Parcourir les fichiers
Options
Téléchargements
Plain Diff
Merge branch 'master' of github.com:diaspora/diaspora into rails_rc
parents
fec0a5ed
ef15cddf
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/models/photo.rb
+9
-9
9 ajouts, 9 suppressions
app/models/photo.rb
app/views/photos/_photo.haml
+1
-1
1 ajout, 1 suppression
app/views/photos/_photo.haml
spec/models/photo_spec.rb
+21
-0
21 ajouts, 0 suppression
spec/models/photo_spec.rb
avec
31 ajouts
et
10 suppressions
app/models/photo.rb
+
9
−
9
Voir le fichier @
c3875566
...
...
@@ -30,27 +30,27 @@ class Photo < Post
validates_true_for
:album_id
,
:logic
=>
lambda
{
self
.
validate_album_person
}
before_destroy
:ensure_user_picture
key
:remote_photo_path
key
:remote_photo_name
def
validate_album_person
album
.
person_id
==
person_id
end
def
remote_photo
url
image
.
url
.
nil?
?
(
remote_photo_path
+
'/'
+
remote_photo_name
)
:
image
.
url
end
def
remote_photo
=
remote_path
name_start
=
remote_path
.
rindex
'/'
@remote_photo_path
=
remote_path
.
slice
(
0
,
name_start
)
@remote_photo_name
=
remote_path
.
slice
(
name_start
,
remote_path
.
length
)
save
raise
"Failed to set path for :
#{
self
.
inspect
}
"
if
Photo
.
first
(
:id
=>
self
.
id
).
url
.
nil?
self
.
remote_photo_path
=
remote_path
.
slice
(
0
,
name_start
)
self
.
remote_photo_name
=
remote_path
.
slice
(
name_start
+
1
,
remote_path
.
length
)
end
def
url
name
=
nil
if
@remote_photo_path
@remote_photo_path
+
name
.
to_s
+
@remote_photo_name
def
url
(
name
=
nil
)
if
remote_photo_path
name
=
name
.
to_s
+
"_"
if
name
person
.
url
.
chop
+
remote_photo_path
+
"/"
+
name
.
to_s
+
remote_photo_name
else
image
.
url
name
end
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
app/views/photos/_photo.haml
+
1
−
1
Voir le fichier @
c3875566
...
...
@@ -8,7 +8,7 @@
=
link_to
post
.
album
.
name
,
object_path
(
post
.
album
)
%br
=
link_to
(
image_tag
post
.
image
.
url
(
:thumb_large
)),
object_path
(
post
)
=
link_to
(
image_tag
post
.
url
(
:thumb_large
)),
object_path
(
post
)
%div
.time
=
link_to
(
how_long_ago
(
post
),
photo_path
(
post
))
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/models/photo_spec.rb
+
21
−
0
Voir le fichier @
c3875566
...
...
@@ -108,5 +108,26 @@ describe Photo do
xml
=
@photo
.
to_xml
.
to_s
xml
.
include?
(
@photo
.
album_id
.
to_s
).
should
be
true
end
it
'should set the remote_photo on marshalling'
do
@photo
.
image
.
store!
File
.
open
(
@fixture_name
)
@photo
.
save
@photo
.
reload
url
=
@photo
.
url
thumb_url
=
@photo
.
url
:thumb_medium
xml
=
@photo
.
to_diaspora_xml
id
=
@photo
.
id
@photo
.
destroy
@user
.
receive
xml
new_photo
=
Photo
.
first
(
:id
=>
id
)
new_photo
.
url
.
nil?
.
should
be
false
new_photo
.
url
.
include?
(
url
).
should
be
true
new_photo
.
url
(
:thumb_medium
).
include?
(
thumb_url
).
should
be
true
end
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