Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
J
jasette-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
jasette-facil
Validations
44829d82
Non vérifiée
Valider
44829d82
rédigé
il y a 7 ans
par
Eugen Rochko
Validation de
GitHub
il y a 7 ans
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Fix missing focalPoint in ActivityPub JSON (#6609)
parent
49092945
Aucune branche associée trouvée
Aucune étiquette associée trouvée
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/serializers/activitypub/note_serializer.rb
+9
-0
9 ajouts, 0 suppression
app/serializers/activitypub/note_serializer.rb
spec/lib/activitypub/activity/create_spec.rb
+27
-2
27 ajouts, 2 suppressions
spec/lib/activitypub/activity/create_spec.rb
avec
36 ajouts
et
2 suppressions
app/serializers/activitypub/note_serializer.rb
+
9
−
0
Voir le fichier @
44829d82
...
@@ -90,6 +90,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
...
@@ -90,6 +90,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
include
RoutingHelper
include
RoutingHelper
attributes
:type
,
:media_type
,
:url
,
:name
attributes
:type
,
:media_type
,
:url
,
:name
attribute
:focal_point
,
if: :focal_point?
def
type
def
type
'Document'
'Document'
...
@@ -106,6 +107,14 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
...
@@ -106,6 +107,14 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
def
url
def
url
object
.
local?
?
full_asset_url
(
object
.
file
.
url
(
:original
,
false
))
:
object
.
remote_url
object
.
local?
?
full_asset_url
(
object
.
file
.
url
(
:original
,
false
))
:
object
.
remote_url
end
end
def
focal_point?
object
.
file
.
meta
.
is_a?
(
Hash
)
&&
object
.
file
.
meta
[
'focus'
].
is_a?
(
Hash
)
end
def
focal_point
[
object
.
file
.
meta
[
'focus'
][
'x'
],
object
.
file
.
meta
[
'focus'
][
'y'
]]
end
end
end
class
MentionSerializer
<
ActiveModel
::
Serializer
class
MentionSerializer
<
ActiveModel
::
Serializer
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
spec/lib/activitypub/activity/create_spec.rb
+
27
−
2
Voir le fichier @
44829d82
...
@@ -202,7 +202,7 @@ RSpec.describe ActivityPub::Activity::Create do
...
@@ -202,7 +202,7 @@ RSpec.describe ActivityPub::Activity::Create do
attachment:
[
attachment:
[
{
{
type:
'Document'
,
type:
'Document'
,
m
ime_t
ype:
'image/png'
,
m
ediaT
ype:
'image/png'
,
url:
'http://example.com/attachment.png'
,
url:
'http://example.com/attachment.png'
,
},
},
],
],
...
@@ -217,6 +217,31 @@ RSpec.describe ActivityPub::Activity::Create do
...
@@ -217,6 +217,31 @@ RSpec.describe ActivityPub::Activity::Create do
end
end
end
end
context
'with media attachments with focal points'
do
let
(
:object_json
)
do
{
id:
[
ActivityPub
::
TagManager
.
instance
.
uri_for
(
sender
),
'#bar'
].
join
,
type:
'Note'
,
content:
'Lorem ipsum'
,
attachment:
[
{
type:
'Document'
,
mediaType:
'image/png'
,
url:
'http://example.com/attachment.png'
,
focalPoint:
[
0.5
,
-
0.7
],
},
],
}
end
it
'creates status'
do
status
=
sender
.
statuses
.
first
expect
(
status
).
to_not
be_nil
expect
(
status
.
media_attachments
.
map
(
&
:focus
)).
to
include
(
'0.5,-0.7'
)
end
end
context
'with media attachments missing url'
do
context
'with media attachments missing url'
do
let
(
:object_json
)
do
let
(
:object_json
)
do
{
{
...
@@ -226,7 +251,7 @@ RSpec.describe ActivityPub::Activity::Create do
...
@@ -226,7 +251,7 @@ RSpec.describe ActivityPub::Activity::Create do
attachment:
[
attachment:
[
{
{
type:
'Document'
,
type:
'Document'
,
m
ime_t
ype:
'image/png'
,
m
ediaT
ype:
'image/png'
,
},
},
],
],
}
}
...
...
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