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
8b743e7e
Valider
8b743e7e
rédigé
il y a 13 ans
par
Raphael Sofaer
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Fix stack level too deep error on reshares
parent
31b55aef
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
4
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
4 fichiers modifiés
app/models/post.rb
+1
-1
1 ajout, 1 suppression
app/models/post.rb
app/models/reshare.rb
+2
-5
2 ajouts, 5 suppressions
app/models/reshare.rb
lib/diaspora/user/querying.rb
+6
-0
6 ajouts, 0 suppression
lib/diaspora/user/querying.rb
spec/models/reshare_spec.rb
+11
-1
11 ajouts, 1 suppression
spec/models/reshare_spec.rb
avec
20 ajouts
et
7 suppressions
app/models/post.rb
+
1
−
1
Voir le fichier @
8b743e7e
...
@@ -86,7 +86,7 @@ class Post < ActiveRecord::Base
...
@@ -86,7 +86,7 @@ class Post < ActiveRecord::Base
local_post
=
Post
.
where
(
:guid
=>
self
.
guid
).
first
local_post
=
Post
.
where
(
:guid
=>
self
.
guid
).
first
if
local_post
&&
local_post
.
author_id
==
self
.
author_id
if
local_post
&&
local_post
.
author_id
==
self
.
author_id
known_post
=
user
.
visible_post
s
.
where
(
:guid
=>
self
.
guid
).
first
known_post
=
user
.
find_
visible_post
_by_id
(
self
.
guid
,
:key
=>
:guid
)
if
known_post
if
known_post
if
known_post
.
mutable?
if
known_post
.
mutable?
known_post
.
update_attributes
(
self
.
attributes
)
known_post
.
update_attributes
(
self
.
attributes
)
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
app/models/reshare.rb
+
2
−
5
Voir le fichier @
8b743e7e
...
@@ -20,12 +20,9 @@ class Reshare < Post
...
@@ -20,12 +20,9 @@ class Reshare < Post
def
receive
(
recipient
,
sender
)
def
receive
(
recipient
,
sender
)
local_reshare
=
Reshare
.
where
(
:guid
=>
self
.
guid
).
first
local_reshare
=
Reshare
.
where
(
:guid
=>
self
.
guid
).
first
if
local_reshare
&&
local_reshare
.
root
.
author_id
==
recipient
.
person
.
id
if
local_reshare
&&
local_reshare
.
root
.
author_id
==
recipient
.
person
.
id
if
recipient
.
contact_for
(
sender
)
return
unless
recipient
.
has_contact_for?
(
sender
)
local_reshare
.
receive
(
recipient
,
sender
)
end
else
super
(
recipient
,
sender
)
end
end
super
(
recipient
,
sender
)
end
end
def
comment_email_subject
def
comment_email_subject
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
lib/diaspora/user/querying.rb
+
6
−
0
Voir le fichier @
8b743e7e
...
@@ -66,6 +66,12 @@ module Diaspora
...
@@ -66,6 +66,12 @@ module Diaspora
Contact
.
where
(
:user_id
=>
self
.
id
,
:person_id
=>
person_id
).
includes
(
:person
=>
:profile
).
first
Contact
.
where
(
:user_id
=>
self
.
id
,
:person_id
=>
person_id
).
includes
(
:person
=>
:profile
).
first
end
end
# @param [Person] person
# @return [Boolean] whether person is a contact of this user
def
has_contact_for?
(
person
)
Contact
.
exists?
(
:user_id
=>
self
.
id
,
:person_id
=>
person
.
id
)
end
def
people_in_aspects
(
requested_aspects
,
opts
=
{})
def
people_in_aspects
(
requested_aspects
,
opts
=
{})
allowed_aspects
=
self
.
aspects
&
requested_aspects
allowed_aspects
=
self
.
aspects
&
requested_aspects
person_ids
=
contacts_in_aspects
(
allowed_aspects
).
collect
{
|
contact
|
contact
.
person_id
}
person_ids
=
contacts_in_aspects
(
allowed_aspects
).
collect
{
|
contact
|
contact
.
person_id
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/models/reshare_spec.rb
+
11
−
1
Voir le fichier @
8b743e7e
...
@@ -26,19 +26,29 @@ describe Reshare do
...
@@ -26,19 +26,29 @@ describe Reshare do
end
end
describe
"#receive"
do
describe
"#receive"
do
let
(
:receive
)
{
@reshare
.
receive
(
@root
.
author
.
owner
,
@reshare
.
author
)}
before
do
before
do
@reshare
=
Factory
.
create
(
:reshare
,
:root
=>
Factory
(
:status_message
,
:author
=>
bob
.
person
,
:public
=>
true
))
@reshare
=
Factory
.
create
(
:reshare
,
:root
=>
Factory
(
:status_message
,
:author
=>
bob
.
person
,
:public
=>
true
))
@root
=
@reshare
.
root
@root
=
@reshare
.
root
@reshare
.
receive
(
@root
.
author
.
owner
,
@reshare
.
author
)
end
end
it
'increments the reshare count'
do
it
'increments the reshare count'
do
receive
@root
.
resharers
.
count
.
should
==
1
@root
.
resharers
.
count
.
should
==
1
end
end
it
'adds the resharer to the re-sharers of the post'
do
it
'adds the resharer to the re-sharers of the post'
do
receive
@root
.
resharers
.
should
include
(
@reshare
.
author
)
@root
.
resharers
.
should
include
(
@reshare
.
author
)
end
end
it
'does not error if the root author has a contact for the resharer'
do
bob
.
share_with
@reshare
.
author
,
bob
.
aspects
.
first
proc
{
Timeout
.
timeout
(
5
)
do
receive
#This doesn't ever terminate on my machine before it was fixed.
end
}.
should_not
raise_error
end
end
end
describe
"XML"
do
describe
"XML"
do
...
...
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