fixed bugs in post nuke, base.jsp display (simplified it), and global
audit record display
This commit is contained in:
@@ -723,7 +723,7 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
||||
|
||||
// lock the tables we reference
|
||||
stmt.executeUpdate("LOCK TABLES posts WRITE, postdata WRITE, postattach WRITE, postdogear WRITE, "
|
||||
+ "postpublish WRITE;");
|
||||
+ "postpublish WRITE, topics WRITE;");
|
||||
|
||||
try
|
||||
{ // first, make sure we have the right status for our post
|
||||
@@ -731,6 +731,13 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
||||
if (nuked)
|
||||
return; // nuking a nuked post is futile
|
||||
|
||||
// We need the post's topic ID and post number to renumber the topic afterwards, so grab 'em.
|
||||
ResultSet rs = stmt.executeQuery("SELECT topicid, num FROM posts WHERE postid = " + postid + ";");
|
||||
if (!(rs.next()))
|
||||
throw new InternalStateError("lost the post to be nuked after refresh?");
|
||||
int x_topic_id = rs.getInt(1);
|
||||
int x_post_num = rs.getInt(2);
|
||||
|
||||
// Delete any and all references to this post!
|
||||
stmt.executeUpdate("DELETE FROM posts WHERE postid = " + postid + ";");
|
||||
stmt.executeUpdate("DELETE FROM postdata WHERE postid = " + postid + ";");
|
||||
@@ -739,6 +746,14 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
||||
if (stmt.executeUpdate("DELETE FROM postpublish WHERE postid = " + postid + ";")>0)
|
||||
engine.unpublish(postid);
|
||||
|
||||
// Phase 1 of renumber - Renumber all posts that had a number higher than the one
|
||||
// we just blew to hell.
|
||||
stmt.executeUpdate("UPDATE posts SET num = (num - 1) WHERE num > " + x_post_num + ";");
|
||||
|
||||
// Phase 2 of renumber - The topic now has one less post in it. Reflect that.
|
||||
stmt.executeUpdate("UPDATE topics SET top_message = (top_message - 1) WHERE topicid = "
|
||||
+ x_topic_id + ";");
|
||||
|
||||
// Update our internal variables.
|
||||
linecount = 0;
|
||||
creator_uid = -1;
|
||||
|
||||
@@ -78,7 +78,7 @@ class TopicUserContextImpl implements TopicContext
|
||||
this.lastupdate = lastupdate;
|
||||
this.name = name;
|
||||
this.hidden = hidden;
|
||||
this.unread = unread;
|
||||
this.unread = (unread<0 ? 0 : unread);
|
||||
|
||||
} // end constructor
|
||||
|
||||
@@ -151,6 +151,8 @@ class TopicUserContextImpl implements TopicContext
|
||||
lastupdate = SQLUtil.getFullDateTime(rs,8);
|
||||
hidden = rs.getBoolean(10);
|
||||
unread = rs.getInt(11);
|
||||
if (unread<0)
|
||||
unread = 0;
|
||||
|
||||
} // end if
|
||||
else // this topic must have been deleted - fsck it
|
||||
|
||||
@@ -64,6 +64,8 @@ public class AuditRecord implements AuditData
|
||||
|
||||
String getUserName(int uid) throws SQLException, DataException
|
||||
{
|
||||
if (uid==0)
|
||||
return ""; // UID 0 = no user
|
||||
Integer uid_x = new Integer(uid);
|
||||
String rc = (String)(uname_cache.get(uid_x));
|
||||
if (rc==null)
|
||||
|
||||
Reference in New Issue
Block a user