mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-15 04:02:53 +00:00
[AB-96] adding ability to edit/delete modmail messages via editing/deleting the original message causing the message,
adding featuremode to modmail to define whether or not there is a separate message posted to the mod mail thread, to see it easier, renaming modmail related tables to singular, adding some necessary methods (caching) to all entities
This commit is contained in:
@@ -5,10 +5,11 @@ import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import dev.sheldan.abstracto.core.models.ServerSpecificId;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Table used to store mutes in order to track when the mute was cast and when it ended.
|
||||
@@ -20,7 +21,10 @@ import java.util.Objects;
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class Mute {
|
||||
@EqualsAndHashCode
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
|
||||
public class Mute implements Serializable {
|
||||
|
||||
/**
|
||||
* The globally unique id of the mute.
|
||||
@@ -102,26 +106,4 @@ public class Mute {
|
||||
this.updated = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Mute mute = (Mute) o;
|
||||
return Objects.equals(muteId, mute.muteId) &&
|
||||
Objects.equals(mutedUser, mute.mutedUser) &&
|
||||
Objects.equals(mutingUser, mute.mutingUser) &&
|
||||
Objects.equals(reason, mute.reason) &&
|
||||
Objects.equals(muteDate, mute.muteDate) &&
|
||||
Objects.equals(muteTargetDate, mute.muteTargetDate) &&
|
||||
Objects.equals(muteEnded, mute.muteEnded) &&
|
||||
Objects.equals(messageId, mute.messageId) &&
|
||||
Objects.equals(server, mute.server) &&
|
||||
Objects.equals(mutingChannel, mute.mutingChannel) &&
|
||||
Objects.equals(triggerKey, mute.triggerKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(muteId, mutedUser, mutingUser, reason, muteDate, muteTargetDate, muteEnded, messageId, server, mutingChannel, triggerKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package dev.sheldan.abstracto.moderation.models.database;
|
||||
import dev.sheldan.abstracto.core.models.database.ARole;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents a role to be used for muting users on a certain server
|
||||
@@ -18,7 +19,10 @@ import java.util.Objects;
|
||||
@Table(name = "mute_role")
|
||||
@Getter
|
||||
@Setter
|
||||
public class MuteRole {
|
||||
@EqualsAndHashCode
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
|
||||
public class MuteRole implements Serializable {
|
||||
|
||||
/**
|
||||
* The abstracto unique id of this mute role.
|
||||
@@ -59,18 +63,4 @@ public class MuteRole {
|
||||
this.updated = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MuteRole muteRole = (MuteRole) o;
|
||||
return Objects.equals(id, muteRole.id) &&
|
||||
Objects.equals(roleServer, muteRole.roleServer) &&
|
||||
Objects.equals(role, muteRole.role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, roleServer, role);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@ import dev.sheldan.abstracto.core.models.ServerSpecificId;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
@Entity
|
||||
@@ -15,7 +17,10 @@ import java.time.Instant;
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserNote {
|
||||
@EqualsAndHashCode
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
|
||||
public class UserNote implements Serializable {
|
||||
|
||||
@EmbeddedId
|
||||
private ServerSpecificId userNoteId;
|
||||
|
||||
@@ -4,10 +4,11 @@ import dev.sheldan.abstracto.core.models.ServerSpecificId;
|
||||
import dev.sheldan.abstracto.core.models.database.AServer;
|
||||
import dev.sheldan.abstracto.core.models.database.AUserInAServer;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A warning which was given a member with a special reason by a moderating member. This warning is bound to a server.
|
||||
@@ -17,7 +18,10 @@ import java.util.Objects;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Warning {
|
||||
@EqualsAndHashCode
|
||||
@Cacheable
|
||||
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
|
||||
public class Warning implements Serializable {
|
||||
|
||||
/**
|
||||
* The globally unique id of this warning
|
||||
@@ -94,23 +98,4 @@ public class Warning {
|
||||
this.updated = Instant.now();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Warning warning = (Warning) o;
|
||||
return Objects.equals(warnId, warning.warnId) &&
|
||||
Objects.equals(warnedUser, warning.warnedUser) &&
|
||||
Objects.equals(warningUser, warning.warningUser) &&
|
||||
Objects.equals(reason, warning.reason) &&
|
||||
Objects.equals(warnDate, warning.warnDate) &&
|
||||
Objects.equals(decayed, warning.decayed) &&
|
||||
Objects.equals(decayDate, warning.decayDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(warnId, warnedUser, warningUser, reason, warnDate, decayed, decayDate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user