Work on block/ unblock
This commit is contained in:
@@ -81,7 +81,6 @@ public class ContactDatabase {
|
||||
}
|
||||
return !currentlyBlocked;
|
||||
} else {
|
||||
// اگر رابطه وجود نداره، اول باید کاربر رو به contact ها اضافه کنیم
|
||||
String insertSql = "INSERT INTO contacts (user_id, contact_id, is_blocked) VALUES (?, ?, ?)";
|
||||
try (PreparedStatement insertStmt = conn.prepareStatement(insertSql)) {
|
||||
insertStmt.setObject(1, userId);
|
||||
@@ -151,8 +150,13 @@ public class ContactDatabase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean eitherBlocks(UUID userA, UUID userB) {
|
||||
return isBlocked(userA, userB) || isBlocked(userB, userA);
|
||||
}
|
||||
|
||||
public boolean isBlocked(UUID user_id, UUID contact_id) {
|
||||
|
||||
|
||||
public static boolean isBlocked(UUID user_id, UUID contact_id) {
|
||||
String sql = "SELECT is_blocked FROM contacts WHERE user_id = ? AND contact_id = ?";
|
||||
try (Connection connection = getConnection()) {
|
||||
PreparedStatement stmt = connection.prepareStatement(sql);
|
||||
|
||||
Reference in New Issue
Block a user