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
92b29d31
Valider
92b29d31
rédigé
il y a 13 ans
par
Diaspora Europe
Validation de
Maxwell Salzberg
il y a 13 ans
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
added user_is_following method, added 2 model specs
parent
55cb328f
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/tags_controller.rb
+1
-4
1 ajout, 4 suppressions
app/controllers/tags_controller.rb
app/models/tag_following.rb
+5
-0
5 ajouts, 0 suppression
app/models/tag_following.rb
spec/models/tag_following_spec.rb
+9
-0
9 ajouts, 0 suppression
spec/models/tag_following_spec.rb
avec
15 ajouts
et
4 suppressions
app/controllers/tags_controller.rb
+
1
−
4
Voir le fichier @
92b29d31
...
@@ -40,10 +40,7 @@ class TagsController < ApplicationController
...
@@ -40,10 +40,7 @@ class TagsController < ApplicationController
end
end
def
tag_followed?
def
tag_followed?
if
@tag_followed
.
nil?
TagFollowing
.
user_is_following?
(
current_user
,
params
[
:name
])
@tag_followed
=
TagFollowing
.
joins
(
:tag
).
where
(
:tags
=>
{
:name
=>
params
[
:name
].
downcase
},
:user_id
=>
current_user
.
id
).
exists?
end
@tag_followed
end
end
def
prep_tags_for_javascript
def
prep_tags_for_javascript
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
app/models/tag_following.rb
+
5
−
0
Voir le fichier @
92b29d31
...
@@ -3,4 +3,9 @@ class TagFollowing < ActiveRecord::Base
...
@@ -3,4 +3,9 @@ class TagFollowing < ActiveRecord::Base
belongs_to
:tag
,
:class_name
=>
"ActsAsTaggableOn::Tag"
belongs_to
:tag
,
:class_name
=>
"ActsAsTaggableOn::Tag"
validates_uniqueness_of
:tag_id
,
:scope
=>
:user_id
validates_uniqueness_of
:tag_id
,
:scope
=>
:user_id
def
self
.
user_is_following?
(
user
,
tagname
)
tagname
.
nil?
?
false
:
joins
(
:tag
).
where
(
:tags
=>
{
:name
=>
tagname
.
downcase
},
:user_id
=>
user
.
id
).
exists?
end
end
end
Ce diff est replié.
Cliquez pour l'agrandir.
spec/models/tag_following_spec.rb
+
9
−
0
Voir le fichier @
92b29d31
...
@@ -13,4 +13,13 @@ describe TagFollowing do
...
@@ -13,4 +13,13 @@ describe TagFollowing do
it
'allows multiple tag followings for different users'
do
it
'allows multiple tag followings for different users'
do
TagFollowing
.
new
(
:tag
=>
@tag
,
:user
=>
bob
).
valid?
.
should
be_true
TagFollowing
.
new
(
:tag
=>
@tag
,
:user
=>
bob
).
valid?
.
should
be_true
end
end
it
'user is following a tag'
do
TagFollowing
.
user_is_following?
(
alice
,
@tag
.
name
).
should
be_true
end
it
'user not following a tag'
do
TagFollowing
.
user_is_following?
(
bob
,
@tag
.
name
).
should
be_false
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