[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:
Sheldan
2020-10-19 23:55:51 +02:00
parent 1b98436736
commit dca98c2953
75 changed files with 952 additions and 592 deletions

View File

@@ -5,6 +5,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
/**
* A role for which the experience gain in a particular server has been disabled.
@@ -16,9 +17,10 @@ import javax.persistence.*;
@Table(name = "disabled_experience_roles")
@Getter
@Setter
@EqualsAndHashCode
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ADisabledExpRole {
public class ADisabledExpRole implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

View File

@@ -6,7 +6,6 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
/**
* Represents an existing level to reach and the total necessary experience needed to reach that level.
@@ -18,6 +17,7 @@ import java.util.Objects;
@Table(name = "experience_level")
@Getter
@Setter
@EqualsAndHashCode
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AExperienceLevel implements Serializable {
@@ -47,17 +47,4 @@ public class AExperienceLevel implements Serializable {
this.updated = Instant.now();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AExperienceLevel that = (AExperienceLevel) o;
return Objects.equals(level, that.level) &&
Objects.equals(experienceNeeded, that.experienceNeeded);
}
@Override
public int hashCode() {
return Objects.hash(level, experienceNeeded);
}
}

View File

@@ -10,7 +10,6 @@ import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* Represents a role which is given when the user reaches a certain level. These roles are configurable per server and
@@ -23,6 +22,7 @@ import java.util.Objects;
@Table(name = "experience_role")
@Getter
@Setter
@EqualsAndHashCode
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AExperienceRole implements Serializable {
@@ -81,20 +81,5 @@ public class AExperienceRole implements Serializable {
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<AUserExperience> users = new ArrayList<>();
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AExperienceRole that = (AExperienceRole) o;
return Objects.equals(id, that.id) &&
Objects.equals(level, that.level) &&
Objects.equals(roleServer, that.roleServer) &&
Objects.equals(role, that.role) &&
Objects.equals(users, that.users);
}
@Override
public int hashCode() {
return Objects.hash(id, level, roleServer, role, users);
}
}

View File

@@ -7,7 +7,6 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
/**
@@ -21,6 +20,7 @@ import java.util.Objects;
@Table(name = "user_experience")
@Getter
@Setter
@EqualsAndHashCode
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AUserExperience implements Serializable {
@@ -83,22 +83,4 @@ public class AUserExperience implements Serializable {
public Integer getLevelOrDefault() {
return currentLevel != null ? currentLevel.getLevel() : 0;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AUserExperience that = (AUserExperience) o;
return Objects.equals(id, that.id) &&
Objects.equals(user, that.user) &&
Objects.equals(experience, that.experience) &&
Objects.equals(messageCount, that.messageCount) &&
Objects.equals(currentLevel, that.currentLevel) &&
Objects.equals(currentExperienceRole, that.currentExperienceRole);
}
@Override
public int hashCode() {
return Objects.hash(id, user, experience, messageCount, currentLevel, currentExperienceRole);
}
}