Mercurial Hosting > nabble
changeset 51:f88ed76ca757
add back noArchive
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 02 Jul 2021 00:32:31 -0600 |
parents | 806d3297f92b |
children | 7df8ec497281 |
files | src/nabble/model/UserImpl.java |
diffstat | 1 files changed, 24 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
diff -r 806d3297f92b -r f88ed76ca757 src/nabble/model/UserImpl.java --- a/src/nabble/model/UserImpl.java Sun Jun 27 18:26:58 2021 -0600 +++ b/src/nabble/model/UserImpl.java Fri Jul 02 00:32:31 2021 -0600 @@ -56,6 +56,7 @@ private String passwordDigest; private String name; private Date registered; + private boolean noArchive; private Message signature = null; private int bounces; @@ -68,6 +69,7 @@ passwordDigest = rs.getString("password_digest"); name = rs.getString("name"); registered = DbUtils.getDate(rs,"registered"); + noArchive = rs.getBoolean("no_archive"); String signatureRaw = rs.getString("signature"); String signatureFormatS = rs.getString("signature_format"); if( signatureRaw!=null && signatureFormatS!=null ) { @@ -113,7 +115,27 @@ } public boolean isDeactivated() { - return !isRegistered(); + return !isRegistered() && noArchive; + } + + private void setNoArchive(boolean noArchive) { + if( this.noArchive == noArchive ) + return; + + if( !db().isInTransaction() ) { + db().beginTransaction(); + try { + UserImpl user = DbUtils.getGoodCopy(this); + user.setNoArchive(noArchive); + user.getDbRecord().update(); + db().commitTransaction(); + return; + } finally { + db().endTransaction(); + } + } + this.noArchive = noArchive; + record.fields().put("no_archive",DbNull.fix(noArchive)); } public String getEmail() { @@ -756,6 +778,7 @@ db().beginTransaction(); try { UserImpl user = DbUtils.getGoodCopy(this); + user.setNoArchive(true); user.setRegistered(null); user.setPasswordDigest(null); user.record.update();