Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SAE4.A02.1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maxime Gosselin
SAE4.A02.1
Commits
6b84a06b
Commit
6b84a06b
authored
2 months ago
by
Maxime Gosselin
Browse files
Options
Downloads
Patches
Plain Diff
On ne peut plus rejoindre un thread si on ne le follow pas
parent
d553306a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
WEB-INF/src/controleur/ThreadController.java
+5
-1
5 additions, 1 deletion
WEB-INF/src/controleur/ThreadController.java
WEB-INF/src/modele/dao/DaoFollower.java
+14
-0
14 additions, 0 deletions
WEB-INF/src/modele/dao/DaoFollower.java
with
19 additions
and
1 deletion
WEB-INF/src/controleur/ThreadController.java
+
5
−
1
View file @
6b84a06b
...
...
@@ -52,7 +52,11 @@ public class ThreadController extends HttpServlet {
vue
=
"WEB-INF/vue/accueil.jsp"
;
break
;
case
"open"
:
vue
=
"WEB-INF/vue/chat.jsp?id="
+
idThread
;
if
(
daoFollower
.
userIsInThread
(
username
,
idThread
)){
vue
=
"WEB-INF/vue/chat.jsp?id="
+
idThread
;
break
;
}
vue
=
"WEB-INF/vue/fils.jsp"
;
break
;
case
"create"
:
String
name
=
req
.
getParameter
(
"name"
);
...
...
This diff is collapsed.
Click to expand it.
WEB-INF/src/modele/dao/DaoFollower.java
+
14
−
0
View file @
6b84a06b
...
...
@@ -99,4 +99,18 @@ public class DaoFollower {
}
return
res
;
}
public
boolean
userIsInThread
(
String
username
,
int
idThread
){
DS
bdd
=
DS
.
getInstance
();
try
(
Connection
con
=
bdd
.
getConnection
())
{
PreparedStatement
ps
=
con
.
prepareStatement
(
"SELECT * FROM followers WHERE id_thread = ? AND username = ?"
);
ps
.
setInt
(
1
,
idThread
);
ps
.
setString
(
2
,
username
);
ResultSet
rs
=
ps
.
executeQuery
();
return
rs
.
next
();
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment