Bugfixes im Dating und im Profil
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled

This commit is contained in:
2026-04-04 15:45:55 +02:00
parent d386f5a7a9
commit b81ad25c9f
427 changed files with 4796 additions and 324 deletions

View File

@@ -7,41 +7,54 @@ import de.oaa.xxx.user.Neigung;
import de.oaa.xxx.user.UserEntity;
import de.oaa.xxx.user.UserRepository;
import de.oaa.xxx.user.UserService;
import de.oaa.xxx.vorlieben.UserVorliebeRepository;
import de.oaa.xxx.vorlieben.VorliebeItemEntity;
import de.oaa.xxx.vorlieben.VorliebeItemRepository;
import de.oaa.xxx.vorlieben.VorliebeBewertung;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import java.security.Principal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/dating")
public class DatingController {
private static final Set<VorliebeBewertung> POSITIVE_RATINGS = Set.of(
VorliebeBewertung.MAG_ICH, VorliebeBewertung.UNBEDINGT, VorliebeBewertung.WILL_AUSPROBIEREN);
private final DatingService datingService;
private final UserService userService;
private final UserRepository userRepository;
private final DatingPassRepository passRepository;
private final SubscriptionLimitService subscriptionLimitService;
private final SseService sseService;
private final UserVorliebeRepository userVorliebeRepository;
private final VorliebeItemRepository vorliebeItemRepository;
public DatingController(DatingService datingService, UserService userService,
UserRepository userRepository,
DatingPassRepository passRepository,
SubscriptionLimitService subscriptionLimitService,
SseService sseService) {
SseService sseService,
UserVorliebeRepository userVorliebeRepository,
VorliebeItemRepository vorliebeItemRepository) {
this.datingService = datingService;
this.userService = userService;
this.userRepository = userRepository;
this.passRepository = passRepository;
this.subscriptionLimitService = subscriptionLimitService;
this.sseService = sseService;
this.userVorliebeRepository = userVorliebeRepository;
this.vorliebeItemRepository = vorliebeItemRepository;
}
record VorliebeChipDto(String name, String bewertung) {}
// ── Profilsuche ───────────────────────────────────────────────────────────
@GetMapping("/profile-ids")
@@ -168,6 +181,61 @@ public class DatingController {
return ResponseEntity.ok(datingService.getMatches(me.getUserId()));
}
/**
* Prüft ob ein Match mit dem angegebenen User besteht.
*/
@GetMapping("/match/{userId}")
public ResponseEntity<Map<String, Boolean>> checkMatch(
@PathVariable UUID userId, Principal principal) {
UserEntity me = userService.requireUser(principal);
boolean isMatch = datingService.isMatch(me.getUserId(), userId);
return ResponseEntity.ok(Map.of("isMatch", isMatch));
}
/**
* Match mit dem angegebenen User auflösen (beide Likes werden entfernt).
*/
@DeleteMapping("/match/{userId}")
public ResponseEntity<Void> unmatch(
@PathVariable UUID userId, Principal principal) {
UserEntity me = userService.requireUser(principal);
datingService.unmatch(me.getUserId(), userId);
return ResponseEntity.noContent().build();
}
/**
* Gibt bis zu 5 zufällige positive Vorlieben (MAG_ICH, UNBEDINGT, WILL_AUSPROBIEREN)
* eines Users zurück für die Profilvorschau im Dating-Bereich.
*/
@GetMapping("/vorlieben/{userId}")
public ResponseEntity<List<VorliebeChipDto>> getDatingVorlieben(
@PathVariable UUID userId, Principal principal) {
userService.requireUser(principal);
var positive = userVorliebeRepository.findByUserId(userId).stream()
.filter(uv -> POSITIVE_RATINGS.contains(uv.getBewertung()))
.collect(Collectors.toList());
if (positive.isEmpty()) return ResponseEntity.ok(List.of());
Collections.shuffle(positive);
List<UUID> sampleIds = positive.stream()
.limit(5)
.map(de.oaa.xxx.vorlieben.UserVorliebeEntity::getItemId)
.toList();
Map<UUID, String> nameById = vorliebeItemRepository.findAllById(sampleIds).stream()
.collect(Collectors.toMap(VorliebeItemEntity::getItemId, VorliebeItemEntity::getName));
List<VorliebeChipDto> result = positive.stream()
.limit(5)
.filter(uv -> nameById.containsKey(uv.getItemId()))
.map(uv -> new VorliebeChipDto(nameById.get(uv.getItemId()), uv.getBewertung().name()))
.toList();
return ResponseEntity.ok(result);
}
// ── Helpers ───────────────────────────────────────────────────────────────
private UserEntity requireDatingUser(Principal principal) {

View File

@@ -0,0 +1,43 @@
package de.oaa.xxx.dating;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
* Löscht täglich abgelaufene Dates und deren Interessenten-Einträge.
* - Dates mit Termin: laufen nach dem Termin ab (expiresAt = scheduledAt)
* - Dates ohne Termin: laufen 30 Tage nach Erstellung ab (expiresAt = createdAt + 30 Tage)
*/
@Component
public class DatingDateCleanupTask {
private static final Logger LOGGER = LoggerFactory.getLogger(DatingDateCleanupTask.class);
private final DatingDateRepository dateRepository;
private final DatingDateInterestRepository interestRepository;
public DatingDateCleanupTask(DatingDateRepository dateRepository,
DatingDateInterestRepository interestRepository) {
this.dateRepository = dateRepository;
this.interestRepository = interestRepository;
}
@Scheduled(cron = "0 0 3 * * *") // täglich um 03:00 Uhr
@Transactional
public void deleteExpiredDates() {
List<DatingDateEntity> expired = dateRepository.findAllByExpiresAtBefore(LocalDateTime.now());
if (expired.isEmpty()) return;
for (DatingDateEntity date : expired) {
interestRepository.deleteByDateId(date.getDateId());
}
dateRepository.deleteAll(expired);
LOGGER.info("Dating-Cleanup: {} abgelaufene Date(s) gelöscht", expired.size());
}
}

View File

@@ -0,0 +1,396 @@
package de.oaa.xxx.dating;
import de.oaa.xxx.social.SystemMessageService;
import de.oaa.xxx.social.entity.MessageCause;
import de.oaa.xxx.social.repository.BlockRepository;
import de.oaa.xxx.subscription.SubscriptionLimitService;
import de.oaa.xxx.user.Geschlecht;
import de.oaa.xxx.user.Neigung;
import de.oaa.xxx.user.UserEntity;
import de.oaa.xxx.user.UserRepository;
import de.oaa.xxx.user.UserService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import java.security.Principal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/dating/dates")
public class DatingDateController {
private static final int MAX_DATES_STANDARD = 1;
private static final int MAX_DATES_PRO = 5;
private final DatingDateRepository dateRepository;
private final DatingDateInterestRepository interestRepository;
private final DatingService datingService;
private final UserService userService;
private final UserRepository userRepository;
private final BlockRepository blockRepository;
private final SubscriptionLimitService subscriptionLimitService;
private final SystemMessageService systemMessageService;
public DatingDateController(DatingDateRepository dateRepository,
DatingDateInterestRepository interestRepository,
DatingService datingService,
UserService userService,
UserRepository userRepository,
BlockRepository blockRepository,
SubscriptionLimitService subscriptionLimitService,
SystemMessageService systemMessageService) {
this.dateRepository = dateRepository;
this.interestRepository = interestRepository;
this.datingService = datingService;
this.userService = userService;
this.userRepository = userRepository;
this.blockRepository = blockRepository;
this.subscriptionLimitService = subscriptionLimitService;
this.systemMessageService = systemMessageService;
}
// ── DTOs ──────────────────────────────────────────────────────────────────
record DatingDateDto(
UUID dateId,
UUID creatorId,
String creatorName,
String creatorProfilePicture,
String title,
String description,
String imageData,
LocalDateTime scheduledAt,
LocalDateTime createdAt,
int interestCount,
boolean myInterest
) {}
record DatesResult(List<DatingDateDto> mine, List<DatingDateDto> available) {}
record CreateDateRequest(String title, String description, String imageData, LocalDateTime scheduledAt) {}
record InterestResult(boolean myInterest, int interestCount) {}
record DateInterestDto(UUID userId, String name, String profilePicture, LocalDateTime interestedAt, boolean blocked) {}
// ── Dates abrufen ─────────────────────────────────────────────────────────
/**
* Gibt eigene Dates (ungefiltert) + verfügbare Dates (gefiltert nach Suchkriterien) zurück.
* Erfordert Dating aktiv + Standort (gleiche Voraussetzung wie Entdecken-Tab).
*/
@GetMapping
public ResponseEntity<DatesResult> getDates(
@RequestParam(name = "maxDistanceKm", defaultValue = "50") int maxDistanceKm,
@RequestParam(name = "minAge", defaultValue = "18") int minAge,
@RequestParam(name = "maxAge", defaultValue = "99") int maxAge,
@RequestParam(name = "geschlechter", required = false) List<String> geschlechter,
@RequestParam(name = "neigungen", required = false) List<String> neigungen,
@RequestParam(name = "vorliebenIds", required = false) List<UUID> vorliebenIds,
@RequestParam(name = "vorliebenUnd", defaultValue = "false") boolean vorliebenUnd,
Principal principal) {
UserEntity me = requireDatingUser(principal);
UUID myId = me.getUserId();
LocalDateTime now = LocalDateTime.now();
// Meine eigenen Dates (aktive)
List<DatingDateEntity> myDates = dateRepository.findByCreatorIdOrderByCreatedAtDesc(myId).stream()
.filter(d -> d.getExpiresAt().isAfter(now))
.toList();
// Alle fremden, noch nicht abgelaufenen Dates
List<DatingDateEntity> candidates = dateRepository.findAvailableExcluding(myId, now);
// Ersteller-IDs filtern (gleiche Kriterien wie Entdecken-Tab)
Set<UUID> creatorIds = candidates.stream().map(DatingDateEntity::getCreatorId).collect(Collectors.toSet());
DatingService.DatingFilter filter = new DatingService.DatingFilter(
Math.max(maxDistanceKm, 1),
Math.max(minAge, 0),
Math.min(maxAge, 120),
parseEnumList(geschlechter, Geschlecht.class),
parseEnumList(neigungen, Neigung.class),
vorliebenIds != null ? vorliebenIds : List.of(),
vorliebenUnd
);
Set<UUID> matchingCreators = datingService.filterUserIds(creatorIds, filter,
me.getDatingLat(), me.getDatingLon());
List<DatingDateEntity> available = candidates.stream()
.filter(d -> matchingCreators.contains(d.getCreatorId()))
.toList();
// Creator-User-Daten laden
Set<UUID> allCreatorIds = new HashSet<>(creatorIds);
myDates.forEach(d -> allCreatorIds.add(d.getCreatorId()));
Map<UUID, UserEntity> creators = userRepository.findAllById(allCreatorIds).stream()
.collect(Collectors.toMap(UserEntity::getUserId, u -> u));
// Alle relevanten Date-IDs
Set<UUID> allDateIds = new HashSet<>();
myDates.forEach(d -> allDateIds.add(d.getDateId()));
available.forEach(d -> allDateIds.add(d.getDateId()));
// Meine Interessen und Interest-Counts
Set<UUID> myInterests = new HashSet<>();
Map<UUID, Long> interestCounts = new HashMap<>();
for (UUID dateId : allDateIds) {
if (interestRepository.existsByDateIdAndUserId(dateId, myId)) myInterests.add(dateId);
interestCounts.put(dateId, interestRepository.countByDateId(dateId));
}
List<DatingDateDto> mineDtos = myDates.stream()
.map(d -> toDto(d, creators, myInterests, interestCounts))
.toList();
List<DatingDateDto> availableDtos = available.stream()
.map(d -> toDto(d, creators, myInterests, interestCounts))
.toList();
return ResponseEntity.ok(new DatesResult(mineDtos, availableDtos));
}
// ── Dates eines bestimmten Users abrufen (Profilansicht) ─────────────────
/**
* Gibt die aktiven Dates eines bestimmten Users zurück.
* Nur abrufbar, wenn der anfragende User selbst Dating aktiviert hat.
*/
@GetMapping("/by-user/{userId}")
public ResponseEntity<List<DatingDateDto>> getDatesByUser(
@PathVariable("userId") UUID userId,
Principal principal) {
UserEntity me = requireDatingUser(principal);
LocalDateTime now = LocalDateTime.now();
List<DatingDateEntity> dates = dateRepository.findByCreatorIdOrderByCreatedAtDesc(userId).stream()
.filter(d -> d.getExpiresAt().isAfter(now))
.toList();
if (dates.isEmpty()) return ResponseEntity.ok(List.of());
UserEntity creator = userRepository.findById(userId).orElse(null);
Map<UUID, UserEntity> creators = creator != null ? Map.of(userId, creator) : Map.of();
Set<UUID> myInterests = new HashSet<>();
Map<UUID, Long> interestCounts = new HashMap<>();
for (DatingDateEntity d : dates) {
if (interestRepository.existsByDateIdAndUserId(d.getDateId(), me.getUserId()))
myInterests.add(d.getDateId());
interestCounts.put(d.getDateId(), interestRepository.countByDateId(d.getDateId()));
}
return ResponseEntity.ok(dates.stream()
.map(d -> toDto(d, creators, myInterests, interestCounts))
.toList());
}
// ── Date erstellen ────────────────────────────────────────────────────────
@PostMapping
public ResponseEntity<DatingDateDto> createDate(@RequestBody CreateDateRequest req, Principal principal) {
UserEntity me = requireDatingUser(principal);
if (req.title() == null || req.title().isBlank())
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Titel fehlt");
if (req.description() == null || req.description().isBlank())
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Beschreibung fehlt");
if (req.title().length() > 200)
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Titel zu lang");
boolean pro = subscriptionLimitService.hasActivePaidSubscription(me.getUserId());
int maxDates = pro ? MAX_DATES_PRO : MAX_DATES_STANDARD;
long existing = dateRepository.countByCreatorId(me.getUserId());
if (existing >= maxDates) {
throw new ResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY,
pro ? "Maximal 5 Dates erlaubt (Pro)" : "Als Standardmitglied ist nur 1 Date erlaubt");
}
LocalDateTime now = LocalDateTime.now();
LocalDateTime expiresAt = req.scheduledAt() != null ? req.scheduledAt() : now.plusDays(30);
DatingDateEntity entity = new DatingDateEntity();
entity.setDateId(UUID.randomUUID());
entity.setCreatorId(me.getUserId());
entity.setTitle(req.title().strip());
entity.setDescription(req.description().strip());
entity.setImageData(req.imageData());
entity.setScheduledAt(req.scheduledAt());
entity.setCreatedAt(now);
entity.setExpiresAt(expiresAt);
dateRepository.save(entity);
Map<UUID, UserEntity> creators = Map.of(me.getUserId(), me);
return ResponseEntity.status(HttpStatus.CREATED)
.body(toDto(entity, creators, Set.of(), Map.of(entity.getDateId(), 0L)));
}
// ── Date bearbeiten ───────────────────────────────────────────────────────
@PutMapping("/{dateId}")
public ResponseEntity<DatingDateDto> updateDate(@PathVariable("dateId") UUID dateId,
@RequestBody CreateDateRequest req,
Principal principal) {
UserEntity me = requireDatingUser(principal);
DatingDateEntity entity = requireMyDate(dateId, me.getUserId());
if (req.title() == null || req.title().isBlank())
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Titel fehlt");
if (req.description() == null || req.description().isBlank())
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Beschreibung fehlt");
if (req.title().length() > 200)
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Titel zu lang");
entity.setTitle(req.title().strip());
entity.setDescription(req.description().strip());
if (req.imageData() != null) entity.setImageData(req.imageData().isBlank() ? null : req.imageData());
entity.setScheduledAt(req.scheduledAt());
entity.setExpiresAt(req.scheduledAt() != null ? req.scheduledAt() : entity.getCreatedAt().plusDays(30));
dateRepository.save(entity);
long count = interestRepository.countByDateId(dateId);
boolean myInterest = interestRepository.existsByDateIdAndUserId(dateId, me.getUserId());
Map<UUID, UserEntity> creators = Map.of(me.getUserId(), me);
return ResponseEntity.ok(toDto(entity, creators, myInterest ? Set.of(dateId) : Set.of(),
Map.of(dateId, count)));
}
// ── Date löschen ──────────────────────────────────────────────────────────
@DeleteMapping("/{dateId}")
@Transactional
public ResponseEntity<Void> deleteDate(@PathVariable("dateId") UUID dateId, Principal principal) {
UserEntity me = requireDatingUser(principal);
requireMyDate(dateId, me.getUserId());
interestRepository.deleteByDateId(dateId);
dateRepository.deleteById(dateId);
return ResponseEntity.noContent().build();
}
// ── Interesse bekunden / zurückziehen ──────────────────────────────────────
@PostMapping("/{dateId}/interest")
@Transactional
public ResponseEntity<InterestResult> toggleInterest(@PathVariable("dateId") UUID dateId,
Principal principal) {
UserEntity me = userService.requireUser(principal);
DatingDateEntity date = dateRepository.findById(dateId)
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Date nicht gefunden"));
if (date.getCreatorId().equals(me.getUserId()))
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Eigenes Date");
if (date.getExpiresAt().isBefore(LocalDateTime.now()))
throw new ResponseStatusException(HttpStatus.GONE, "Date abgelaufen");
Optional<DatingDateInterestEntity> existing =
interestRepository.findByDateIdAndUserId(dateId, me.getUserId());
boolean myInterest;
if (existing.isPresent()) {
interestRepository.delete(existing.get());
myInterest = false;
} else {
DatingDateInterestEntity interest = new DatingDateInterestEntity();
interest.setInterestId(UUID.randomUUID());
interest.setDateId(dateId);
interest.setUserId(me.getUserId());
interest.setInterestedAt(LocalDateTime.now());
interestRepository.save(interest);
myInterest = true;
// Benachrichtigung an Ersteller
String text = me.getName() + " hat Interesse an deinem Date \"" + date.getTitle() + "\" bekundet.";
systemMessageService.send(me.getUserId(), date.getCreatorId(), text,
"/dating.html?tab=dates", MessageCause.DATE_INTEREST);
}
long count = interestRepository.countByDateId(dateId);
return ResponseEntity.ok(new InterestResult(myInterest, (int) count));
}
// ── Interessenten abrufen (nur Ersteller) ─────────────────────────────────
@GetMapping("/{dateId}/interests")
public ResponseEntity<List<DateInterestDto>> getInterests(@PathVariable("dateId") UUID dateId,
Principal principal) {
UserEntity me = userService.requireUser(principal);
DatingDateEntity date = dateRepository.findById(dateId)
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Date nicht gefunden"));
if (!date.getCreatorId().equals(me.getUserId()))
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "Kein Zugriff");
List<DatingDateInterestEntity> interests = interestRepository.findByDateIdOrderByInterestedAtDesc(dateId);
Set<UUID> userIds = interests.stream().map(DatingDateInterestEntity::getUserId).collect(Collectors.toSet());
Map<UUID, UserEntity> users = userRepository.findAllById(userIds).stream()
.collect(Collectors.toMap(UserEntity::getUserId, u -> u));
List<DateInterestDto> dtos = interests.stream()
.map(i -> {
UserEntity u = users.get(i.getUserId());
if (u == null) return null;
boolean blocked = blockRepository.existsBlock(me.getUserId(), u.getUserId());
return new DateInterestDto(u.getUserId(), u.getName(),
u.getProfilePicture(), i.getInterestedAt(), blocked);
})
.filter(Objects::nonNull)
.toList();
return ResponseEntity.ok(dtos);
}
// ── Helpers ───────────────────────────────────────────────────────────────
private UserEntity requireDatingUser(Principal principal) {
UserEntity me = userService.requireUser(principal);
if (!me.isDatingAktiv())
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "Dating nicht aktiviert");
if (me.getDatingLat() == null || me.getDatingLon() == null)
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Standort nicht gesetzt");
return me;
}
private DatingDateEntity requireMyDate(UUID dateId, UUID userId) {
DatingDateEntity entity = dateRepository.findById(dateId)
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, "Date nicht gefunden"));
if (!entity.getCreatorId().equals(userId))
throw new ResponseStatusException(HttpStatus.FORBIDDEN, "Kein Zugriff");
return entity;
}
private DatingDateDto toDto(DatingDateEntity d, Map<UUID, UserEntity> creators,
Set<UUID> myInterests, Map<UUID, Long> interestCounts) {
UserEntity creator = creators.get(d.getCreatorId());
return new DatingDateDto(
d.getDateId(),
d.getCreatorId(),
creator != null ? creator.getName() : null,
creator != null ? creator.getProfilePicture() : null,
d.getTitle(),
d.getDescription(),
d.getImageData(),
d.getScheduledAt(),
d.getCreatedAt(),
interestCounts.getOrDefault(d.getDateId(), 0L).intValue(),
myInterests.contains(d.getDateId())
);
}
private <E extends Enum<E>> List<E> parseEnumList(List<String> values, Class<E> enumClass) {
if (values == null || values.isEmpty()) return List.of();
return values.stream()
.map(s -> {
try { return Enum.valueOf(enumClass, s); }
catch (IllegalArgumentException e) { return null; }
})
.filter(Objects::nonNull)
.toList();
}
}

View File

@@ -0,0 +1,46 @@
package de.oaa.xxx.dating;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.UUID;
@Getter
@Setter
@Entity
@Table(name = "dating_date")
public class DatingDateEntity {
@Id
@Column
private UUID dateId;
@Column(nullable = false)
private UUID creatorId;
@Column(length = 200, nullable = false)
private String title;
@Column(columnDefinition = "MEDIUMTEXT", nullable = false)
private String description;
/** Optional base64-kodiertes Bild */
@Column(columnDefinition = "MEDIUMTEXT")
private String imageData;
/** Optionaler Termin wenn gesetzt, läuft das Date danach ab */
@Column
private LocalDateTime scheduledAt;
@Column(nullable = false)
private LocalDateTime createdAt;
/**
* Ablaufzeitpunkt: scheduledAt (wenn gesetzt) oder createdAt + 30 Tage.
* Wird vom CleanupTask zum Löschen herangezogen.
*/
@Column(nullable = false)
private LocalDateTime expiresAt;
}

View File

@@ -0,0 +1,29 @@
package de.oaa.xxx.dating;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.UUID;
@Getter
@Setter
@Entity
@Table(name = "dating_date_interest",
uniqueConstraints = @UniqueConstraint(columnNames = {"date_id", "user_id"}))
public class DatingDateInterestEntity {
@Id
@Column
private UUID interestId;
@Column(name = "date_id", nullable = false)
private UUID dateId;
@Column(name = "user_id", nullable = false)
private UUID userId;
@Column(nullable = false)
private LocalDateTime interestedAt;
}

View File

@@ -0,0 +1,27 @@
package de.oaa.xxx.dating;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
public interface DatingDateInterestRepository extends JpaRepository<DatingDateInterestEntity, UUID> {
List<DatingDateInterestEntity> findByDateIdOrderByInterestedAtDesc(UUID dateId);
Optional<DatingDateInterestEntity> findByDateIdAndUserId(UUID dateId, UUID userId);
boolean existsByDateIdAndUserId(UUID dateId, UUID userId);
long countByDateId(UUID dateId);
@Modifying
@Transactional
@Query("DELETE FROM DatingDateInterestEntity i WHERE i.dateId = :dateId")
void deleteByDateId(@Param("dateId") UUID dateId);
}

View File

@@ -0,0 +1,22 @@
package de.oaa.xxx.dating;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
public interface DatingDateRepository extends JpaRepository<DatingDateEntity, UUID> {
List<DatingDateEntity> findByCreatorIdOrderByCreatedAtDesc(UUID creatorId);
long countByCreatorId(UUID creatorId);
@Query("SELECT d FROM DatingDateEntity d WHERE d.creatorId != :excludeId AND d.expiresAt > :now ORDER BY d.createdAt DESC")
List<DatingDateEntity> findAvailableExcluding(@Param("excludeId") UUID excludeId,
@Param("now") LocalDateTime now);
List<DatingDateEntity> findAllByExpiresAtBefore(LocalDateTime now);
}

View File

@@ -60,11 +60,13 @@ public class DatingService {
Integer alter,
double distanzKm,
String profilePicture,
String profilePictureHq,
String neigung,
String geschlecht,
String datingStadt,
String beschreibung,
boolean likedByMe
boolean likedByMe,
List<UUID> matchingVorliebenIds
) {}
record LikeResult(boolean liked, boolean newMatch) {}
@@ -130,10 +132,34 @@ public class DatingService {
.map(DatingLikeEntity::getLikedId)
.collect(Collectors.toSet());
// Meine positiven Vorlieben
Set<UUID> myPositive = userVorliebeRepository.findByUserId(currentUserId).stream()
.filter(uv -> POSITIVE_RATINGS.contains(uv.getBewertung()))
.map(UserVorliebeEntity::getItemId)
.collect(Collectors.toSet());
// Positive Vorlieben aller Kandidaten (Batch-Query)
Set<UUID> candidateIds = ids.stream().filter(byId::containsKey).collect(Collectors.toSet());
Map<UUID, Set<UUID>> candidatePositive = myPositive.isEmpty()
? Map.of()
: userVorliebeRepository.findByUserIdIn(candidateIds).stream()
.filter(uv -> POSITIVE_RATINGS.contains(uv.getBewertung()))
.collect(Collectors.groupingBy(
UserVorliebeEntity::getUserId,
Collectors.mapping(UserVorliebeEntity::getItemId, Collectors.toSet())
));
return ids.stream()
.map(byId::get)
.filter(Objects::nonNull)
.map(u -> toDto(u, currentUserId, likedByMe, myLat, myLon))
.map(u -> {
Set<UUID> theirPositive = candidatePositive.getOrDefault(u.getUserId(), Set.of());
List<UUID> matching = myPositive.stream()
.filter(theirPositive::contains)
.limit(5)
.toList();
return toDto(u, currentUserId, likedByMe, myLat, myLon, matching);
})
.toList();
}
@@ -216,6 +242,17 @@ public class DatingService {
.toList();
}
public boolean isMatch(UUID userId, UUID otherId) {
return matchRepository.existsByUsers(userId, otherId);
}
public void unmatch(UUID userId, UUID otherId) {
matchRepository.deleteByUsers(userId, otherId);
// Gegenseitige Likes entfernen, damit kein Re-Match beim nächsten Like entsteht
likeRepository.deleteByLikerIdAndLikedId(userId, otherId);
likeRepository.deleteByLikerIdAndLikedId(otherId, userId);
}
public List<UUID> getLikedByMe(UUID userId) {
return likeRepository.findByLikerId(userId).stream()
.map(DatingLikeEntity::getLikedId)
@@ -273,6 +310,39 @@ public class DatingService {
return ids;
}
// ── Filter-Utility für andere Services im Package ─────────────────────────
/**
* Filtert eine Menge von User-IDs nach dem übergebenen DatingFilter.
* Verwendet dieselbe Logik wie findSortedIds().
* Voraussetzung: Die Kandidaten müssen bereits datingAktiv=true + Koordinaten haben.
*/
Set<UUID> filterUserIds(Collection<UUID> candidateIds, DatingFilter filter,
double myLat, double myLon) {
List<UserEntity> candidates = userRepository.findAllById(candidateIds).stream()
.filter(u -> u.getDatingLat() != null && u.getDatingLon() != null)
.toList();
candidates = filterByDistance(candidates, myLat, myLon, filter.maxDistanceKm());
candidates = filterByAge(candidates, filter.minAge(), filter.maxAge());
if (!filter.geschlechter().isEmpty()) {
candidates = candidates.stream()
.filter(u -> u.getGeschlecht() != null && filter.geschlechter().contains(u.getGeschlecht()))
.toList();
}
if (!filter.neigungen().isEmpty()) {
candidates = candidates.stream()
.filter(u -> u.getNeigung() != null && filter.neigungen().contains(u.getNeigung()))
.toList();
}
if (!filter.vorliebenIds().isEmpty()) {
candidates = filterByVorlieben(candidates, filter.vorliebenIds(), filter.vorliebenUnd());
}
return candidates.stream().map(UserEntity::getUserId).collect(Collectors.toSet());
}
// ── Private helpers ───────────────────────────────────────────────────────
private List<UserEntity> filterByDistance(List<UserEntity> users, double myLat, double myLon, int maxKm) {
@@ -316,7 +386,8 @@ public class DatingService {
.toList();
}
private DatingProfileDto toDto(UserEntity u, UUID currentUserId, Set<UUID> likedByMe, double myLat, double myLon) {
private DatingProfileDto toDto(UserEntity u, UUID currentUserId, Set<UUID> likedByMe,
double myLat, double myLon, List<UUID> matchingVorliebenIds) {
double dist = Math.round(haversineKm(myLat, myLon, u.getDatingLat(), u.getDatingLon()) * 10.0) / 10.0;
return new DatingProfileDto(
u.getUserId(),
@@ -324,11 +395,13 @@ public class DatingService {
u.getAlter(),
dist,
u.getProfilePicture(),
u.getProfilePictureHq(),
u.getNeigung() != null ? u.getNeigung().getLabel() : null,
u.getGeschlecht() != null ? u.getGeschlecht().getLabel() : null,
u.getDatingStadt(),
u.getBeschreibung(),
likedByMe.contains(u.getUserId())
likedByMe.contains(u.getUserId()),
matchingVorliebenIds
);
}

View File

@@ -57,8 +57,9 @@ public class SystemMessageService {
.findByUserIdAndCause(receiverId, cause)
.orElseGet(() -> NotificationPreferenceEntity.defaultFor(receiverId, cause));
// FRIENDREQUEST und INVITATION sind immer nur in-app, kein E-Mail
boolean sendInApp = cause == MessageCause.FRIENDREQUEST || cause == MessageCause.INVITATION || pref.isInApp();
// FRIENDREQUEST, INVITATION und DATE_INTEREST sind immer nur in-app, kein E-Mail
boolean sendInApp = cause == MessageCause.FRIENDREQUEST || cause == MessageCause.INVITATION
|| cause == MessageCause.DATE_INTEREST || pref.isInApp();
if (sendInApp) {
MessageEntity msg = new MessageEntity();
@@ -76,7 +77,7 @@ public class SystemMessageService {
sseService.push(receiverId, "NOTIFICATION", Map.of("unreadCount", unread, "text", text));
}
if (pref.isEmail() && cause != MessageCause.INVITATION) {
if (pref.isEmail() && cause != MessageCause.INVITATION && cause != MessageCause.DATE_INTEREST) {
userRepository.findById(receiverId).ifPresent(user -> {
try {
Email email = new Email();
@@ -107,6 +108,7 @@ public class SystemMessageService {
case EMERGENCY -> "XXX The Game ⚠️ Notfall";
case FRIENDREQUEST -> "XXX The Game Neue Freundschaftsanfrage";
case SUPPORT -> "xXx Sphere Nachricht vom Support";
case DATE_INTEREST -> "xXx Sphere Interesse an deinem Date";
};
}

View File

@@ -5,5 +5,6 @@ public enum MessageCause {
GAME_STATE,
EMERGENCY,
FRIENDREQUEST,
SUPPORT
SUPPORT,
DATE_INTEREST
}

View File

@@ -12,6 +12,7 @@ import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseCookie;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -94,6 +95,8 @@ public class UserController {
record DatingRequest(boolean datingAktiv, String datingStadt, Double datingLat, Double datingLon,
List<String> datingGeschlechter,
Integer datingMaxDistanzKm, Integer datingMinAlter, Integer datingMaxAlter) {}
record DatingFilterRequest(List<String> datingGeschlechter,
Integer datingMaxDistanzKm, Integer datingMinAlter, Integer datingMaxAlter) {}
record PrivacyRequest(
Sichtbarkeit sichtbarkeitGrunddaten,
Sichtbarkeit sichtbarkeitGalerie,
@@ -112,22 +115,51 @@ public class UserController {
}
var user = userService.requireUser(principal);
user.setDatingAktiv(request.datingAktiv());
user.setDatingStadt(request.datingAktiv() ? request.datingStadt().trim() : null);
user.setDatingLat(request.datingAktiv() ? request.datingLat() : null);
user.setDatingLon(request.datingAktiv() ? request.datingLon() : null);
if (request.datingGeschlechter() != null && !request.datingGeschlechter().isEmpty()) {
if (!request.datingAktiv()) {
// Alle Dating-Einstellungen zurücksetzen
user.setDatingStadt(null);
user.setDatingLat(null);
user.setDatingLon(null);
user.setDatingGeschlechter(null);
user.setDatingMaxDistanzKm(null);
user.setDatingMinAlter(null);
user.setDatingMaxAlter(null);
} else {
user.setDatingStadt(request.datingStadt().trim());
user.setDatingLat(request.datingLat());
user.setDatingLon(request.datingLon());
if (request.datingGeschlechter() != null && !request.datingGeschlechter().isEmpty()) {
String joined = request.datingGeschlechter().stream()
.filter(g -> { try { Geschlecht.valueOf(g); return true; } catch (IllegalArgumentException e) { return false; } })
.collect(Collectors.joining(","));
user.setDatingGeschlechter(joined.isBlank() ? null : joined);
} else {
user.setDatingGeschlechter(null);
}
if (request.datingMaxDistanzKm() != null) user.setDatingMaxDistanzKm(Math.max(1, Math.min(500, request.datingMaxDistanzKm())));
if (request.datingMinAlter() != null) user.setDatingMinAlter(Math.max(18, Math.min(99, request.datingMinAlter())));
if (request.datingMaxAlter() != null) user.setDatingMaxAlter(Math.max(18, Math.min(99, request.datingMaxAlter())));
}
userRepository.save(user);
LOGGER.info("User {} hat Dating-Einstellungen aktualisiert: aktiv={}", user.getUserId(), request.datingAktiv());
return ResponseEntity.ok().build();
}
@PutMapping("/me/dating-filter")
public ResponseEntity<Void> updateDatingFilter(@RequestBody DatingFilterRequest request, Principal principal) {
var user = userService.requireUser(principal);
if (!user.isDatingAktiv())
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
if (request.datingGeschlechter() != null) {
String joined = request.datingGeschlechter().stream()
.filter(g -> { try { Geschlecht.valueOf(g); return true; } catch (IllegalArgumentException e) { return false; } })
.collect(Collectors.joining(","));
user.setDatingGeschlechter(joined.isBlank() ? null : joined);
} else {
user.setDatingGeschlechter(null);
}
if (request.datingMaxDistanzKm() != null) user.setDatingMaxDistanzKm(Math.max(1, Math.min(500, request.datingMaxDistanzKm())));
if (request.datingMinAlter() != null) user.setDatingMinAlter(Math.max(18, Math.min(99, request.datingMinAlter())));
if (request.datingMaxAlter() != null) user.setDatingMaxAlter(Math.max(18, Math.min(99, request.datingMaxAlter())));
if (request.datingMinAlter() != null) user.setDatingMinAlter(Math.max(18, Math.min(99, request.datingMinAlter())));
if (request.datingMaxAlter() != null) user.setDatingMaxAlter(Math.max(18, Math.min(99, request.datingMaxAlter())));
userRepository.save(user);
LOGGER.info("User {} hat Dating-Einstellungen aktualisiert: aktiv={}", user.getUserId(), request.datingAktiv());
return ResponseEntity.ok().build();
}

View File

@@ -1,15 +1,19 @@
package de.oaa.xxx.user;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDate;
import java.time.Period;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@Entity

View File

@@ -55,6 +55,7 @@ server.port=8080
server.servlet.context-path=/
server.shutdown=graceful
spring.lifecycle.timeout-per-shutdown-phase=5s
server.tomcat.max-http-header-size=65536
# Jackson Datumsformat als ISO-8601 String statt numerischem Array
spring.jackson.serialization.write-dates-as-timestamps=false

View File

@@ -74,22 +74,60 @@
.profil-actions {
display: flex;
gap: 0.5rem;
justify-content: center;
flex-wrap: wrap;
align-items: center;
width: 100%;
padding: 0.85rem 0;
border-top: 1px solid var(--color-secondary);
border-bottom: 1px solid var(--color-secondary);
margin: 0.5rem 0 0.25rem;
}
.profil-actions:empty { display: none; }
.profil-actions-spacer { flex: 1; }
/* Aktionen-Dropdown */
.aktionen-wrap { position: relative; }
.aktionen-btn {
background: none; border: 1px solid var(--color-secondary);
color: var(--color-muted); border-radius: 6px;
padding: 0.55rem 1.2rem; cursor: pointer;
display: flex; align-items: center; gap: 0.35rem; margin: 0; width: auto;
}
.aktionen-btn:hover { color: var(--color-text); }
.aktionen-menu {
display: none; position: absolute; right: 0; top: calc(100% + 6px);
background: var(--color-card); border: 1px solid var(--color-secondary);
border-radius: 8px; min-width: 190px; z-index: 200;
box-shadow: 0 6px 24px rgba(0,0,0,0.55); overflow: hidden;
}
.aktionen-menu.open { display: block; }
.aktionen-wrap .aktionen-menu button {
display: block; width: 100%; text-align: left; box-sizing: border-box;
background: none; border: none;
border-bottom: 1px solid var(--color-secondary);
color: var(--color-text); padding: 0.65rem 1rem;
font-size: 0.9rem; cursor: pointer; margin: 0; border-radius: 0;
}
.aktionen-wrap .aktionen-menu button:last-child { border-bottom: none; }
.aktionen-wrap .aktionen-menu button:hover { background: var(--color-secondary); }
.aktionen-wrap .aktionen-menu button.danger { color: #c0392b; }
.aktionen-wrap .aktionen-menu button:disabled { color: var(--color-muted); cursor: default; }
/* Match-Name */
.profil-name.is-match {
border: 2px solid var(--color-primary);
border-radius: 8px; padding: 0.15rem 0.75rem;
}
.profil-actions button,
.profil-actions a.btn {
margin-top: 0;
width: auto;
padding: 0.55rem 1.2rem;
display: inline-flex;
align-items: center;
line-height: 1;
box-sizing: border-box;
font-size: 0.9rem;
}
/* ── Section labels ── */
@@ -104,6 +142,86 @@
padding-top: 1.5rem;
}
/* ── Profil-Dates ── */
#datesList {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 1rem;
}
.date-card {
background: var(--color-card);
border: 1px solid var(--color-secondary);
border-radius: 12px;
overflow: hidden;
cursor: pointer;
transition: border-color 0.15s, box-shadow 0.15s;
display: flex;
flex-direction: column;
}
.date-card:hover { border-color: var(--color-primary); box-shadow: 0 4px 18px rgba(0,0,0,0.35); }
.date-card-img {
width: 100%; aspect-ratio: 16/9;
background: var(--color-secondary);
display: flex; align-items: center; justify-content: center;
font-size: 2.5rem; color: var(--color-muted);
overflow: hidden; flex-shrink: 0;
}
.date-card-img img { width: 100%; height: 100%; object-fit: cover; }
.date-card-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.date-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.date-card-desc {
font-size: 0.78rem; color: var(--color-muted); line-height: 1.4;
overflow: hidden; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.date-card-footer {
display: flex; align-items: center; gap: 0.5rem;
padding: 0.5rem 0.75rem;
border-top: 1px solid var(--color-secondary);
font-size: 0.76rem; flex-shrink: 0;
}
.date-card-meta { color: var(--color-muted); white-space: nowrap; }
.date-card-date { color: var(--color-muted); font-size: 0.73rem; }
/* ── Profil-Date-Dialog (gleiche Optik wie auf der Dates-Seite) ── */
.date-dialog-bg {
display: none; position: fixed; inset: 0;
background: rgba(0,0,0,0.65); z-index: 500;
align-items: center; justify-content: center; padding: 1rem;
}
.date-dialog-bg.open { display: flex; }
.date-dialog {
background: var(--color-card); border-radius: 16px;
width: 100%; max-width: 520px; max-height: 92vh;
overflow-y: auto; position: relative; display: flex; flex-direction: column;
}
.date-dialog-img {
width: 100%; aspect-ratio: 16/9; background: var(--color-secondary);
display: flex; align-items: center; justify-content: center;
font-size: 3rem; color: var(--color-muted);
overflow: hidden; flex-shrink: 0; border-radius: 16px 16px 0 0;
}
.date-dialog-img img { width: 100%; height: 100%; object-fit: cover; }
.date-dialog-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.date-dialog-close {
position: absolute; top: 0.75rem; right: 0.85rem;
background: rgba(0,0,0,0.45); border: none; color: #fff;
width: 2rem; height: 2rem; border-radius: 50%;
font-size: 1rem; cursor: pointer;
display: flex; align-items: center; justify-content: center;
padding: 0; z-index: 1;
}
.date-dialog-close:hover { background: rgba(0,0,0,0.65); }
.date-dialog-title { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
.date-dialog-when { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--color-muted); }
.date-dialog-desc {
background: var(--color-secondary); border-radius: 8px;
padding: 0.85rem 1rem; font-size: 0.9rem; line-height: 1.55; white-space: pre-wrap;
}
.date-dialog-stats { font-size: 0.82rem; color: var(--color-muted); }
.date-dialog-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.date-interest-btn { flex: 1; min-width: 120px; }
.date-interest-btn.active { background: var(--color-primary); color: #fff; }
/* ── Gallery Carousel ── */
.gallery-strip {
display: grid;
@@ -183,7 +301,8 @@
align-items: center;
gap: 0.3rem;
cursor: pointer;
flex: 0 0 calc(20% - 0.6rem);
flex: 0 0 76px;
width: 76px;
min-width: 0;
}
@@ -208,7 +327,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 64px;
width: 76px;
}
.friend-thumb:hover span { color: var(--color-primary); }
@@ -397,7 +516,8 @@
/* ── Post / Bild Lightbox ── */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.88); z-index:400; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lb-layout { display:flex; max-width:920px; width:95vw; max-height:90vh; background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-layout { display:flex; max-width:min(1340px, calc(100vw - 2rem)); width:95vw; height:min(90vh, 1100px); background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-post-side .post-bild { max-height:1024px; }
.lb-close { position:absolute; top:0.6rem; right:0.6rem; background:rgba(0,0,0,0.55); border:none; color:#fff; font-size:1.1rem; width:2rem; height:2rem; border-radius:50%; cursor:pointer; z-index:10; display:flex; align-items:center; justify-content:center; padding:0; margin:0; }
.lb-post-side { flex:1; overflow-y:auto; padding:1.25rem; border-right:1px solid var(--color-secondary); min-width:0; }
.lb-comments-panel { width:300px; flex-shrink:0; display:flex; flex-direction:column; }
@@ -410,7 +530,7 @@
.lb-comment-compose button { width:auto; margin:0; padding:0.35rem 0.75rem; font-size:0.8rem; }
.lb-img-nav { display:flex; gap:0.75rem; align-items:center; justify-content:center; margin-top:0.75rem; flex-wrap:wrap; }
.compose-action-btn { background:none; border:1px solid var(--color-secondary); color:var(--color-muted); border-radius:6px; padding:0.35rem 0.6rem; font-size:0.95rem; cursor:pointer; margin:0; width:auto; }
@media (max-width:650px) { .lb-layout { flex-direction:column; max-height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
@media (max-width:650px) { .lb-layout { flex-direction:column; height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
</style>
</head>
<body class="app">
@@ -450,15 +570,23 @@
<div id="vorliebenDisplay"></div>
</div>
<!-- Dates -->
<div id="datesSection" style="display:none; margin-top:1rem;">
<div class="section-label">Dates</div>
<div id="datesList"></div>
</div>
<!-- Freunde -->
<div id="friendsSection" style="display:none; margin-top:1rem;">
<div class="section-label">Freunde <span id="friendsCount" style="font-weight:400;color:var(--color-muted);font-size:0.85rem;"></span></div>
<div class="friends-strip" id="friendsStrip"></div>
<div class="gallery-nav" id="friendsNav" style="display:none;">
<button id="friendsPrev" onclick="friendsPage(-1)" disabled>&#8592;</button>
<span class="gallery-pos" id="friendsPos"></span>
<button id="friendsNext" onclick="friendsPage(1)">&#8594;</button>
<div style="display:flex; align-items:center; justify-content:space-between;">
<div class="section-label" style="margin-bottom:0.5rem;">Freunde <span id="friendsCount" style="font-weight:400;color:var(--color-muted);font-size:0.85rem;"></span></div>
<div id="friendsNav" style="display:none; align-items:center; gap:0.3rem; flex-shrink:0;">
<button id="friendsPrev" onclick="friendsPage(-1)" disabled style="padding:0.2rem 0.6rem; font-size:0.85rem;">&#8592;</button>
<span class="gallery-pos" id="friendsPos"></span>
<button id="friendsNext" onclick="friendsPage(1)" style="padding:0.2rem 0.6rem; font-size:0.85rem;">&#8594;</button>
</div>
</div>
<div class="friends-strip" id="friendsStrip"></div>
</div>
<!-- Tabs: Feed | Pinnwand | Spielhistorie | Keyholder-Angebote -->
@@ -617,6 +745,11 @@
renderGallery();
}
// ── Dates (nur wenn Besucher selbst Dating aktiviert hat und Profil-User auch) ──
if (me && me.datingAktiv && profile.datingAktiv) {
loadProfilDates(profile.userId);
}
// ── Freunde ──
if (canSee(profile.sichtbarkeitFreunde, isFriend, isOwnProfile)) {
loadFriends();
@@ -691,30 +824,91 @@
// eigenes Profil im Preview-Modus keine Aktionsbuttons anzeigen
actions.innerHTML = '';
} else {
let html = '';
if (!blockedByMe) {
html += `<a href="/community/nachrichten.html?userId=${profile.userId}" class="btn">✉ Nachricht</a>`;
let friendItem = '';
if (profile.friendStatus === 'PENDING_SENT') {
html += ` <button disabled>Anfrage gesendet</button>`;
friendItem = `<button disabled>Anfrage gesendet</button>`;
} else if (profile.friendStatus === 'PENDING_RECEIVED') {
html += ` <button id="friendActionBtn" onclick="acceptFriend()">✓ Anfrage annehmen</button>`;
friendItem = `<button id="friendActionBtn" onclick="closeAktionen();acceptFriend()">✓ Anfrage annehmen</button>`;
} else if (profile.friendStatus !== 'FRIEND') {
html += ` <button id="friendActionBtn" onclick="addFriend()">+ Freund hinzufügen</button>`;
friendItem = `<button id="friendActionBtn" onclick="closeAktionen();addFriend()">+ Freund hinzufügen</button>`;
}
html += ` <button onclick="openMeldungDialog('PROFIL','${profile.userId}')" style="background:none;border:1px solid var(--color-secondary);color:var(--color-muted);border-radius:6px;padding:0.4rem 0.8rem;cursor:pointer;font-size:0.85rem;">⚑ Melden</button>`;
html += ` <button onclick="confirmBlock('${profile.userId}','${esc(profile.name)}')" style="background:none;border:1px solid #7a1a1a;color:#c0392b;border-radius:6px;padding:0.4rem 0.8rem;cursor:pointer;font-size:0.85rem;">⊘ Blockieren</button>`;
actions.innerHTML = `
<div class="profil-actions-spacer"></div>
<div id="profileActionsCenter" style="display:flex;gap:0.5rem;align-items:center;">
<a href="/community/nachrichten.html?userId=${profile.userId}" class="btn">✉ Nachricht</a>
${friendItem}
<div class="aktionen-wrap">
<button class="aktionen-btn" onclick="toggleAktionen(event)">Aktionen ▾</button>
<div class="aktionen-menu" id="aktionenMenu">
<button onclick="closeAktionen();openMeldungDialog('PROFIL','${profile.userId}')">⚑ Melden</button>
<button class="danger" onclick="closeAktionen();confirmBlock('${profile.userId}','${esc(profile.name)}')">⊘ Blockieren</button>
</div>
</div>
</div>
<div class="profil-actions-spacer"></div>`;
} else {
html += `<button onclick="unblockUser('${profile.userId}')" style="background:none;border:1px solid var(--color-secondary);color:var(--color-muted);border-radius:6px;padding:0.4rem 0.8rem;cursor:pointer;font-size:0.85rem;">Blockierung aufheben</button>`;
actions.innerHTML = `<button onclick="unblockUser('${profile.userId}')" style="background:none;border:1px solid var(--color-secondary);color:var(--color-muted);border-radius:6px;padding:0.4rem 0.8rem;cursor:pointer;font-size:0.85rem;">Blockierung aufheben</button>`;
}
actions.innerHTML = html;
// Dating-Like-Button nur anzeigen wenn Ziel-User Dating aktiviert hat und nicht blockiert
if (profile.datingAktiv && !blockedByMe) {
loadDatingLikeButton(profile.userId);
}
// Match-Badge laden
if (!blockedByMe) {
loadMatchBadge(profile.userId, profile.name);
}
}
}
async function loadMatchBadge(userId, userName) {
try {
const res = await fetch('/dating/match/' + userId);
if (!res.ok) return;
const data = await res.json();
if (!data.isMatch) return;
// Wrap name with heart emojis + red border
const nameEl = document.getElementById('profileName');
nameEl.textContent = `💕 ${nameEl.textContent} 💕`;
nameEl.classList.add('is-match');
// Add "Match auflösen" to Aktionen dropdown
const menu = document.getElementById('aktionenMenu');
if (menu) {
const btn = document.createElement('button');
btn.className = 'danger';
btn.textContent = '💔 Match auflösen';
btn.onclick = () => { closeAktionen(); confirmUnmatch(userId, userName); };
menu.appendChild(btn);
}
} catch { /* Dating evtl. nicht aktiv ignorieren */ }
}
async function confirmUnmatch(userId, userName) {
if (!confirm(`Match mit ${userName} wirklich auflösen?\n\nBeide Likes werden entfernt.`)) return;
try {
await fetch('/dating/match/' + userId, { method: 'DELETE' });
// Remove match styling from name
const nameEl = document.getElementById('profileName');
nameEl.textContent = nameEl.textContent.replace(/^💕 /, '').replace(/ 💕$/, '');
nameEl.classList.remove('is-match');
// Remove button from dropdown
document.getElementById('aktionenMenu')?.querySelectorAll('button').forEach(b => {
if (b.textContent.includes('Match auflösen')) b.remove();
});
} catch { alert('Fehler beim Auflösen des Matches.'); }
}
window.toggleAktionen = function(e) {
e.stopPropagation();
document.getElementById('aktionenMenu')?.classList.toggle('open');
};
window.closeAktionen = function() {
document.getElementById('aktionenMenu')?.classList.remove('open');
};
document.addEventListener('click', () => closeAktionen());
// ── Privacy helpers ──
function canSee(sichtbarkeit, isFriend, isOwn) {
if (isOwn || !sichtbarkeit) return true;
@@ -754,6 +948,107 @@
}
// ── Profil-Dates ──
async function loadProfilDates(userId) {
try {
const res = await fetch('/dating/dates/by-user/' + userId);
if (!res.ok) return;
const dates = await res.json();
if (!dates.length) return;
const section = document.getElementById('datesSection');
const list = document.getElementById('datesList');
list.innerHTML = '';
dates.forEach(d => {
const card = document.createElement('div');
card.className = 'date-card';
const thumb = d.imageData
? `<img src="${escV(d.imageData)}" alt="">`
: '📅';
const dateHint = d.scheduledAt
? `<div class="date-card-date">🗓️ ${formatProfilDate(d.scheduledAt)}</div>` : '';
card.innerHTML = `
<div class="date-card-img">${thumb}</div>
<div class="date-card-body">
<div class="date-card-title">${escV(d.title)}</div>
<div class="date-card-desc">${escV(d.description)}</div>
${dateHint}
</div>
<div class="date-card-footer">
<span class="date-card-meta">♥ ${d.interestCount}</span>
</div>`;
card.addEventListener('click', () => openProfilDateDialog(d));
list.appendChild(card);
});
section.style.display = '';
} catch(e) { /* ignorieren */ }
}
function formatProfilDate(iso) {
if (!iso) return '';
try {
const d = new Date(iso);
return d.toLocaleString('de-DE', { day:'2-digit', month:'2-digit', year:'numeric', hour:'2-digit', minute:'2-digit' });
} catch { return iso; }
}
// ── Profil-Date-Dialog ──
let _profilDateCurrent = null;
function openProfilDateDialog(d) {
_profilDateCurrent = d;
document.getElementById('pddImg').innerHTML = d.imageData
? `<img src="${escV(d.imageData)}" alt="">` : '📅';
document.getElementById('pddTitle').textContent = d.title;
const whenEl = document.getElementById('pddWhen');
if (d.scheduledAt) {
whenEl.textContent = '🗓️ ' + formatProfilDate(d.scheduledAt);
whenEl.style.display = '';
} else {
whenEl.style.display = 'none';
}
document.getElementById('pddDesc').textContent = d.description;
document.getElementById('pddStats').textContent =
d.interestCount + ' Person' + (d.interestCount === 1 ? '' : 'en') + ' interessiert';
const btn = document.getElementById('pddInterestBtn');
btn.className = 'btn date-interest-btn' + (d.myInterest ? ' active' : '');
btn.textContent = d.myInterest ? '♥ Interesse bekundet' : '♥ Interesse bekunden';
btn.disabled = false;
document.getElementById('profilDateDialogBg').classList.add('open');
}
window.closeProfilDateDialog = function(e) {
if (e && e.target !== document.getElementById('profilDateDialogBg')) return;
document.getElementById('profilDateDialogBg').classList.remove('open');
};
window.closeProfilDateDialogBtn = function() {
document.getElementById('profilDateDialogBg').classList.remove('open');
};
window.toggleProfilDateInterest = async function() {
if (!_profilDateCurrent) return;
const btn = document.getElementById('pddInterestBtn');
btn.disabled = true;
try {
const res = await fetch('/dating/dates/' + _profilDateCurrent.dateId + '/interest', { method: 'POST' });
if (!res.ok) return;
const data = await res.json();
_profilDateCurrent = { ..._profilDateCurrent, myInterest: data.myInterest, interestCount: data.interestCount };
btn.className = 'btn date-interest-btn' + (data.myInterest ? ' active' : '');
btn.textContent = data.myInterest ? '♥ Interesse bekundet' : '♥ Interesse bekunden';
document.getElementById('pddStats').textContent =
data.interestCount + ' Person' + (data.interestCount === 1 ? '' : 'en') + ' interessiert';
} finally {
btn.disabled = false;
}
};
// ── Vorlieben anzeigen ──
const BEWERTUNG_ORDER = ['UNBEDINGT','MAG_ICH','WILL_AUSPROBIEREN','NEUTRAL','EHER_NICHT','GEHT_GAR_NICHT'];
const BEWERTUNG_LABEL = {
@@ -792,6 +1087,7 @@
if (!grouped[bw]) grouped[bw] = [];
grouped[bw].push(itemNames[itemId] || itemId);
});
Object.values(grouped).forEach(names => names.sort((a, b) => a.localeCompare(b, 'de')));
const visibleGroups = BEWERTUNG_ORDER.filter(bw => grouped[bw]?.length);
if (!visibleGroups.length) {
@@ -919,7 +1215,7 @@
const nav = document.getElementById('friendsNav');
if (allFriends.length > FRIENDS_PAGE) {
nav.style.display = '';
nav.style.display = 'flex';
document.getElementById('friendsPrev').disabled = friendsOffset === 0;
document.getElementById('friendsNext').disabled = friendsOffset + FRIENDS_PAGE >= allFriends.length;
const cur = Math.floor(friendsOffset / FRIENDS_PAGE) + 1;
@@ -959,7 +1255,7 @@
const likeClass = img.likedByMe ? ' active' : '';
document.getElementById('lbPostBody').innerHTML = `
<img src="data:image/jpeg;base64,${img.imageData}" alt=""
style="width:100%;max-height:360px;object-fit:contain;border-radius:8px;display:block;">
style="width:100%;max-height:1024px;object-fit:contain;border-radius:8px;display:block;">
<div class="lb-img-nav">
<button class="post-action-btn" ${prevDisabled} onclick="lbGalleryNav(-1)">← Zurück</button>
${!isOwnProfile ? `<button class="post-action-btn${likeClass}" id="lbImgLikeBtn" onclick="lbToggleImageLike()">
@@ -1473,8 +1769,8 @@
const btn = document.createElement('button');
btn.id = 'datingLikeBtn';
btn.title = liked ? 'Unlike' : 'Like';
btn.style.cssText = 'padding:0.4rem 0.9rem;font-size:0.9rem;' +
(liked ? 'background:var(--color-primary);color:#fff;' : 'background:none;border:1px solid var(--color-primary);color:var(--color-primary);') +
btn.style.cssText = 'padding:0.55rem 1.2rem;font-size:0.9rem;' +
(liked ? 'background:var(--color-primary);color:#fff;border:none;' : 'background:none;border:1px solid var(--color-primary);color:var(--color-primary);') +
'border-radius:6px;cursor:pointer;';
btn.textContent = liked ? '♥ Liked' : '♥ Liken';
btn.addEventListener('click', async () => {
@@ -1504,8 +1800,35 @@
btn.disabled = false;
}
});
document.getElementById('profileActions').appendChild(btn);
const center = document.getElementById('profileActionsCenter');
if (center) {
const aktionenWrap = center.querySelector('.aktionen-wrap');
if (aktionenWrap) {
center.insertBefore(btn, aktionenWrap);
} else {
center.appendChild(btn);
}
} else {
document.getElementById('profileActions').appendChild(btn);
}
}
</script>
<!-- ── Profil-Date-Dialog ── -->
<div id="profilDateDialogBg" class="date-dialog-bg" onclick="closeProfilDateDialog(event)">
<div class="date-dialog">
<button class="date-dialog-close" onclick="closeProfilDateDialogBtn()"></button>
<div class="date-dialog-img" id="pddImg"></div>
<div class="date-dialog-body">
<div class="date-dialog-title" id="pddTitle"></div>
<div class="date-dialog-when" id="pddWhen" style="display:none;"></div>
<div class="date-dialog-desc" id="pddDesc"></div>
<div class="date-dialog-stats" id="pddStats"></div>
<div class="date-dialog-actions">
<button id="pddInterestBtn" class="btn date-interest-btn" onclick="toggleProfilDateInterest()">♥ Interesse bekunden</button>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -71,7 +71,8 @@
/* Lightbox */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.88); z-index:300; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lb-layout { display:flex; max-width:920px; width:95vw; max-height:90vh; background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-layout { display:flex; max-width:min(1340px, calc(100vw - 2rem)); width:95vw; height:min(90vh, 1100px); background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-post-side .post-bild { max-height:1024px; }
.lb-close { position:absolute; top:0.6rem; right:0.6rem; background:rgba(0,0,0,0.55); border:none; color:#fff; font-size:1.1rem; width:2rem; height:2rem; border-radius:50%; cursor:pointer; z-index:10; display:flex; align-items:center; justify-content:center; padding:0; margin:0; }
.lb-post-side { flex:1; overflow-y:auto; padding:1.25rem; border-right:1px solid var(--color-secondary); min-width:0; }
.lb-comments-panel { width:300px; flex-shrink:0; display:flex; flex-direction:column; }
@@ -82,7 +83,7 @@
.lb-comment-compose textarea:focus { border-color:var(--color-primary); }
.lb-comment-compose-actions { display:flex; gap:0.5rem; justify-content:flex-end; }
.lb-comment-compose button { width:auto; margin:0; padding:0.35rem 0.75rem; font-size:0.8rem; }
@media (max-width:650px) { .lb-layout { flex-direction:column; max-height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
@media (max-width:650px) { .lb-layout { flex-direction:column; height:95vh; } .lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; } .lb-comments-panel { width:100%; } }
/* Comment + Like-Stile kommen aus shared.js */
</style>

View File

@@ -114,7 +114,8 @@
/* Post lightbox */
.lightbox { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.88); z-index:300; align-items:center; justify-content:center; }
.lightbox.open { display:flex; }
.lb-layout { display:flex; max-width:920px; width:95vw; max-height:90vh; background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-layout { display:flex; max-width:min(1340px, calc(100vw - 2rem)); width:95vw; height:min(90vh, 1100px); background:var(--color-card); border-radius:12px; overflow:hidden; position:relative; }
.lb-post-side .post-bild { max-height:1024px; }
.lb-close { position:absolute; top:0.6rem; right:0.6rem; background:rgba(0,0,0,0.55); border:none; color:#fff; font-size:1.1rem; width:2rem; height:2rem; border-radius:50%; cursor:pointer; z-index:10; display:flex; align-items:center; justify-content:center; padding:0; margin:0; }
.lb-post-side { flex:1; overflow-y:auto; padding:1.25rem; border-right:1px solid var(--color-secondary); min-width:0; }
.lb-comments-panel { width:300px; flex-shrink:0; display:flex; flex-direction:column; }
@@ -125,7 +126,7 @@
.lb-comment-compose-actions { display:flex; gap:0.5rem; justify-content:flex-end; }
.lb-comment-compose button { width:auto; margin:0; padding:0.35rem 0.75rem; font-size:0.8rem; }
@media (max-width:650px) {
.lb-layout { flex-direction:column; max-height:95vh; }
.lb-layout { flex-direction:column; height:95vh; }
.lb-post-side { border-right:none; border-bottom:1px solid var(--color-secondary); max-height:55vh; }
.lb-comments-panel { width:100%; }
}

File diff suppressed because it is too large Load Diff

View File

@@ -147,8 +147,8 @@ class ImageViewer {
s.textContent = `
#imageViewer{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.88);z-index:500;align-items:center;justify-content:center;padding:2rem}
#imageViewer.open{display:flex}
#ivLayout{display:flex;flex-direction:row;gap:1rem;height:min(78vh,660px);max-width:calc(100vw - 4rem);align-items:stretch}
#ivImageSide{width:660px;flex-shrink:1;min-width:0;display:flex;flex-direction:column}
#ivLayout{display:flex;flex-direction:row;gap:1rem;height:min(90vh,1024px);max-width:min(1340px,calc(100vw - 4rem));align-items:stretch}
#ivImageSide{width:1024px;flex-shrink:1;min-width:0;display:flex;flex-direction:column}
.iv-image-box{flex:1;position:relative;background:var(--color-card);border:1px solid var(--color-secondary);border-radius:12px;overflow:hidden;display:flex;align-items:center;justify-content:center}
#ivImg{width:100%;height:100%;object-fit:contain;display:block}
.iv-overlay{position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent,rgba(0,0,0,0.6));border-radius:0 0 12px 12px;padding:2rem 0.75rem 0.6rem;display:flex;align-items:center;justify-content:space-between;gap:0.5rem}

View File

@@ -806,6 +806,20 @@
</div>
</div>
<!-- Dating-Alter-Hinweis Modal -->
<div class="modal-backdrop" id="datingAlterModal">
<div class="modal" style="max-width:360px;text-align:center;">
<h2>Geburtsdatum erforderlich</h2>
<p style="font-size:0.9rem;color:var(--color-muted);margin:0.5rem 0 1rem;">
Um Dating zu aktivieren, musst du zuerst dein Geburtsdatum hinterlegen.
</p>
<div class="modal-actions">
<button class="secondary" onclick="closeDatingAlterModal()">Abbrechen</button>
<button onclick="closeDatingAlterModal(); openGeburtsdatumDialog();">Jetzt eintragen</button>
</div>
</div>
</div>
<!-- Geburtsdatum Modal -->
<div class="modal-backdrop" id="geburtsdatumModal">
<div class="modal">
@@ -1067,7 +1081,7 @@
}
// Modal-Backdrop-Klick schließt Modals
['nameModal','geburtsdatumModal','emailModal','deleteModal'].forEach(id => {
['nameModal','geburtsdatumModal','emailModal','deleteModal','datingAlterModal'].forEach(id => {
document.getElementById(id).addEventListener('click', e => {
if (e.target === document.getElementById(id)) document.getElementById(id).classList.remove('visible');
});
@@ -1245,10 +1259,13 @@
// ── Dating ──────────────────────────────────────────────────────────────
let _myAge = null;
async function loadDating() {
const res = await fetch('/login/me');
if (!res.ok) return;
const user = await res.json();
if (user.alter != null) _myAge = user.alter;
document.getElementById('datingAktiv').checked = !!user.datingAktiv;
if (user.datingStadt) {
const input = document.getElementById('datingStadt');
@@ -1333,10 +1350,51 @@
updateDatingAgeSlider();
})();
function closeDatingAlterModal() {
document.getElementById('datingAlterModal').classList.remove('visible');
}
function onDatingToggle() {
const show = document.getElementById('datingAktiv').checked ? '' : 'none';
document.getElementById('datingStadtRow').style.display = show;
document.getElementById('datingSucheRow').style.display = show;
const aktiv = document.getElementById('datingAktiv').checked;
if (aktiv && _myAge == null) {
document.getElementById('datingAktiv').checked = false;
document.getElementById('datingAlterModal').classList.add('visible');
return;
}
document.getElementById('datingStadtRow').style.display = aktiv ? '' : 'none';
document.getElementById('datingSucheRow').style.display = aktiv ? '' : 'none';
if (!aktiv) {
// Alle Felder zurücksetzen
const stadtInput = document.getElementById('datingStadt');
stadtInput.value = '';
stadtInput.readOnly = false;
document.getElementById('datingStadtClear').style.display = 'none';
_datingLat = null;
_datingLon = null;
document.getElementById('sucheWeiblich').checked = false;
document.getElementById('sucheMaennlich').checked = false;
document.getElementById('sucheDivers').checked = false;
document.getElementById('datingMaxDistanz').value = 50;
document.getElementById('datingDistValDisplay').textContent = '50 km';
_datingAgeFrom = 18;
_datingAgeTo = 60;
updateDatingAgeSlider();
} else {
// Standardwerte setzen
document.getElementById('datingMaxDistanz').value = 50;
document.getElementById('datingDistValDisplay').textContent = '50 km';
if (_myAge != null) {
_datingAgeFrom = Math.max(18, _myAge - 10);
_datingAgeTo = _myAge + 10;
} else {
_datingAgeFrom = 18;
_datingAgeTo = 60;
}
updateDatingAgeSlider();
}
}
let _stadtSuggestTimer = null;
@@ -1436,6 +1494,13 @@
msgEl.style.color = 'var(--color-primary)';
return;
}
const geschlechter = ['sucheWeiblich','sucheMaennlich','sucheDivers']
.filter(id => document.getElementById(id).checked);
if (aktiv && geschlechter.length === 0) {
msgEl.textContent = 'Bitte mindestens ein Geschlecht auswählen.';
msgEl.style.color = 'var(--color-primary)';
return;
}
const btn = document.getElementById('saveDatingBtn');
btn.disabled = true;
try {
@@ -1447,9 +1512,7 @@
datingStadt: stadt || null,
datingLat: _datingLat,
datingLon: _datingLon,
datingGeschlechter: ['sucheWeiblich','sucheMaennlich','sucheDivers']
.filter(id => document.getElementById(id).checked)
.map(id => document.getElementById(id).value),
datingGeschlechter: geschlechter.map(id => document.getElementById(id).value),
datingMaxDistanzKm: parseInt(document.getElementById('datingMaxDistanz').value),
datingMinAlter: _datingAgeFrom,
datingMaxAlter: _datingAgeTo

View File

@@ -367,6 +367,24 @@
<button class="full-width" id="saveBtn" onclick="saveProfile()">Profil speichern</button>
<div id="datingInfoSection" style="display:none;margin-top:1.5rem;">
<div class="gallery-section-label">Dating</div>
<div style="display:flex;flex-direction:column;gap:0.5rem;background:var(--color-secondary);border-radius:8px;padding:0.85rem 1rem;font-size:0.9rem;">
<div style="display:flex;align-items:center;gap:0.5rem;">
<span style="color:var(--color-muted);min-width:90px;">Wohnort</span>
<span id="datingInfoStadt" style="font-weight:600;"></span>
</div>
<div style="display:flex;align-items:baseline;gap:0.5rem;">
<span style="color:var(--color-muted);min-width:90px;">Suche nach</span>
<div id="datingInfoGeschlechter" style="display:flex;flex-wrap:wrap;gap:0.35rem;"></div>
</div>
</div>
<a href="/konto/einstellungen.html#sec-dating"
style="display:inline-block;margin-top:0.5rem;font-size:0.8rem;color:var(--color-muted);">
→ Dating-Einstellungen ändern
</a>
</div>
<div class="gallery-section-label" style="margin-top:1.5rem;">Vorlieben</div>
<p class="vorlieben-hint">Wähle für jede Vorliebe aus, wie du dazu stehst. Nicht ausgefüllte Einträge werden nicht angezeigt.</p>
<div id="vorliebenSection"><p style="color:var(--color-muted);font-size:0.85rem;">Wird geladen…</p></div>
@@ -422,6 +440,15 @@
updateCharCount();
}
myUserId = user.userId;
if (user.datingAktiv) {
document.getElementById('datingInfoSection').style.display = '';
document.getElementById('datingInfoStadt').textContent = user.datingStadt || '—';
const g = user.datingGeschlechter || [];
const labels = { WEIBLICH: '♀ weiblich', MAENNLICH: '♂ männlich', DIVERS: '⚧ divers' };
document.getElementById('datingInfoGeschlechter').innerHTML = g.length
? g.map(v => `<span style="padding:0.15rem 0.55rem;border-radius:20px;background:var(--color-card);font-size:0.8rem;">${labels[v] || v}</span>`).join('')
: '<span style="color:var(--color-muted);">—</span>';
}
loadOwnGallery();
loadVorliebenEdit();
})

View File

@@ -115,56 +115,55 @@
<h1 style="margin:0 0 0.15rem;">Home</h1>
<p class="welcome" id="greeting"></p>
<div class="game-grid">
<div class="game-card">
<div class="game-card-icon"></div>
<h2 class="game-card-title">Vanilla Game</h2>
<p class="game-card-desc">
Entdecke spielerische Rollenspiele und Aufgaben in einem entspannten Rahmen.
Ideal für den Einstieg ohne Regeln, nur Spaß zu zweit oder in der Gruppe.
</p>
<a href="/games/vanilla/sessionvanilla.html"><button class="game-card-btn">Neue Session starten</button></a>
</div>
<div class="game-card">
<div class="game-card-icon"></div>
<h2 class="game-card-title">BDSM Game</h2>
<p class="game-card-desc">
Tauche ein in strukturierte Sessions mit Aufgaben, Toys und klaren Rollen.
Definiere Grenzen, vergib Aufgaben und erlebe intensive Momente mit deinem Partner.
</p>
<a href="/games/bdsm/neubdsm.html"><button class="game-card-btn">Neue Session starten</button></a>
</div>
<div class="game-card">
<div class="game-card-icon"></div>
<h2 class="game-card-title">Chastity Game</h2>
<p class="game-card-desc">
Erlebe Keuschheit auf eine neue Art: Kartenbasierte Locks, Keyholder-System,
Community-Abstimmungen und tägliche Verifizierungen machen jedes Lock einzigartig.
</p>
<a href="/games/chastity/neulock.html"><button class="game-card-btn">Neues Lock erstellen</button></a>
</div>
</div>
<!-- Profilbesucher -->
<div id="visitorsSection" style="display:none;">
<div class="section-label">Profilbesucher</div>
<div class="section-label">Profilbesucher 👀</div>
<div class="visitors-strip" id="visitorsStrip"></div>
</div>
<!-- Wer hat mich geliked (Dating) -->
<div id="likesSection" style="display:none;">
<div class="section-label">Dating Wer mag mich ♥</div>
<div class="section-label">Likes ❤️</div>
<div class="dating-strip" id="likesStrip"></div>
</div>
<!-- Matches -->
<div id="matchesSection" style="display:none;">
<div class="section-label">Dating Matches 🎉</div>
<div class="section-label">Matches 💕</div>
<div class="dating-strip" id="matchesStrip"></div>
</div>
</div>
<div class="game-grid">
<div class="game-card">
<div class="game-card-icon">❤️</div>
<h2 class="game-card-title">Vanilla Game</h2>
<p class="game-card-desc">
</p>
<a href="/games/vanilla/sessionvanilla.html"><button class="game-card-btn">Neue Session starten</button></a>
</div>
<div class="game-card">
<div class="game-card-icon">⛓️</div>
<h2 class="game-card-title">BDSM Game</h2>
<p class="game-card-desc">
Tauche ein in strukturierte Sessions mit Aufgaben, Toys und klaren Rollen.
Definiere Grenzen, vergib Aufgaben und erlebe intensive Momente mit deinen Spielpartner*Innen.
</p>
<a href="/games/bdsm/neubdsm.html"><button class="game-card-btn">Neue Session starten</button></a>
</div>
<div class="game-card">
<div class="game-card-icon">🔒</div>
<h2 class="game-card-title">Chastity Game</h2>
<p class="game-card-desc">
Erlebe Keuschheit auf eine neue Art: Kartenbasierte Locks, Keyholder-System,
Community-Abstimmungen und tägliche Verifizierungen machen jedes Lock einzigartig.
</p>
<a href="/games/chastity/neulock.html"><button class="game-card-btn">Neues Lock erstellen</button></a>
</div>
</div>
</div>
<script src="/js/icons.js"></script>