second round of public beta bugfixes:
- fixed a bug in navigation between conferences via post links - fixed the "your post is 'new'" bug (this was actually another bug, in postNewMessage()) - some other stuff
This commit is contained in:
parent
8f31704563
commit
3d32fe95c5
|
@ -12,6 +12,7 @@ can't
|
|||
cartman
|
||||
cdt
|
||||
checkouts
|
||||
communityware
|
||||
couldn't
|
||||
crewmember
|
||||
crewmembers
|
||||
|
|
|
@ -475,14 +475,29 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
public void setUnreadMessages(int count) throws DataException
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("[raw] setUnreadMessages(" + count + ") entry");
|
||||
|
||||
if (conf.userIsAnonymous())
|
||||
return; // no-op
|
||||
{ // this is effectively a no-op, but log it
|
||||
logger.debug("reject 1: anonymous user");
|
||||
return;
|
||||
|
||||
} // end if
|
||||
if (count>(top_message+1)) // constrain count to [0, top_message+1]
|
||||
count = top_message + 1;
|
||||
else if (count<0)
|
||||
count = 0;
|
||||
if ((count==unread) || deleted)
|
||||
return; // no-op
|
||||
{ // this is effectively a no-op, but log it
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("reject 2: count=" + count + ", unread=" + unread + ", deleted=" + deleted);
|
||||
return;
|
||||
|
||||
} // end if
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("[cooked] setUnreadMessages(" + count + ") entry");
|
||||
|
||||
int last_msg = top_message - count;
|
||||
Connection conn = null; // pooled database connection
|
||||
|
@ -498,8 +513,11 @@ class TopicUserContextImpl implements TopicContext
|
|||
StringBuffer sql = new StringBuffer("UPDATE topicsettings SET last_message = ");
|
||||
sql.append(last_msg).append(" WHERE topicid = ").append(topicid).append(" AND uid = ");
|
||||
sql.append(conf.realUID()).append(';');
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
if (stmt.executeUpdate(sql.toString())>0)
|
||||
{ // that was all we needed - just save the flag and exit
|
||||
logger.debug("--> bailed out after update - done with setUnreadMessages{");
|
||||
conf.touchRead(conn);
|
||||
unread = count;
|
||||
return;
|
||||
|
@ -509,9 +527,12 @@ class TopicUserContextImpl implements TopicContext
|
|||
// OK, check: Is the topic still there?!?
|
||||
sql.setLength(0);
|
||||
sql.append("SELECT topicid from topics WHERE topicid = ").append(topicid).append(';');
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
ResultSet rs = stmt.executeQuery(sql.toString());
|
||||
if (!(rs.next()))
|
||||
{ // the topic's been deleted - bail out
|
||||
logger.debug("--> bailed out because topic is deleted - done with setUnreadMessages{");
|
||||
makeDeleted();
|
||||
return;
|
||||
|
||||
|
@ -521,6 +542,8 @@ class TopicUserContextImpl implements TopicContext
|
|||
sql.setLength(0);
|
||||
sql.append("INSERT INTO topicsettings (topicid, uid, last_message) VALUES (").append(topicid);
|
||||
sql.append(", ").append(conf.realUID()).append(", ").append(last_msg).append(");");
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("SQL: " + sql.toString());
|
||||
stmt.executeUpdate(sql.toString());
|
||||
conf.touchRead(conn);
|
||||
unread = count; // successful completion
|
||||
|
@ -589,6 +612,9 @@ class TopicUserContextImpl implements TopicContext
|
|||
public TopicMessageContext postNewMessage(long parent, String pseud, String text)
|
||||
throws DataException, AccessError
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
logger.info("postNewMessage(" + parent + ", '" + pseud + "',<text>) entry");
|
||||
|
||||
if (!(conf.userCanPost()))
|
||||
{ // they can't post in this topic!
|
||||
logger.error("trying to post w/o permission!");
|
||||
|
@ -642,6 +668,8 @@ class TopicUserContextImpl implements TopicContext
|
|||
real_pseud = pseud_ch.getValue();
|
||||
real_text = text_ch.getValue();
|
||||
text_linecount = text_ch.getLines();
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("new post has " + text_linecount + " lines");
|
||||
|
||||
} // end try
|
||||
catch (NotYetFinishedException e)
|
||||
|
@ -691,6 +719,8 @@ class TopicUserContextImpl implements TopicContext
|
|||
|
||||
// Determine what the new post number is.
|
||||
new_post_num = top_message + 1;
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("New post number: " + new_post_num);
|
||||
|
||||
// Add the post "header" to the posts table.
|
||||
StringBuffer sql = new StringBuffer("INSERT INTO posts (parent, topicid, num, linecount, creator_uid, "
|
||||
|
@ -708,6 +738,8 @@ class TopicUserContextImpl implements TopicContext
|
|||
if (!(rs.next()))
|
||||
throw new InternalStateError("postMessage(): Unable to get new post ID!");
|
||||
new_post_id = rs.getLong(1);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("New post ID: " + new_post_id);
|
||||
|
||||
// Touch the topic values to reflect the added post.
|
||||
sql.setLength(0);
|
||||
|
@ -727,9 +759,14 @@ class TopicUserContextImpl implements TopicContext
|
|||
conf.touchUpdate(conn,posted_date);
|
||||
conf.touchPost(conn,posted_date);
|
||||
|
||||
// fill in our own local variables to reflect the update
|
||||
// Fill in our own local variables to reflect the update. This includes the recalculation
|
||||
// of "unread" based on the new value of "top_message".
|
||||
int tmp_last_msg = top_message - unread;
|
||||
top_message = new_post_num;
|
||||
lastupdate = posted_date;
|
||||
unread = top_message - tmp_last_msg;
|
||||
|
||||
logger.debug("message post completed successfully");
|
||||
|
||||
} // end try
|
||||
finally
|
||||
|
|
|
@ -75,7 +75,7 @@ public class ConfDisplay extends VeniceServlet
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static Category logger = Category.getInstance(ConfDisplay.class.getName());
|
||||
private static Category logger = Category.getInstance(ConfDisplay.class);
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Internal functions
|
||||
|
|
|
@ -80,12 +80,12 @@ public class ConfOperations extends VeniceServlet
|
|||
|
||||
private static boolean validateNewTopic(ServletRequest request, String on_error) throws ErrorBox
|
||||
{
|
||||
boolean is_title_null, is_zp_null;
|
||||
//boolean is_title_null, is_zp_null;
|
||||
|
||||
String foo = request.getParameter("title");
|
||||
if (foo==null)
|
||||
throw new ErrorBox(null,"Title parameter was not specified.",on_error);
|
||||
is_title_null = (foo.length()==0);
|
||||
//is_title_null = (foo.length()==0);
|
||||
|
||||
foo = request.getParameter("pseud");
|
||||
if (foo==null)
|
||||
|
@ -94,9 +94,13 @@ public class ConfOperations extends VeniceServlet
|
|||
foo = request.getParameter("pb");
|
||||
if (foo==null)
|
||||
throw new ErrorBox(null,"Body text was not specified.",on_error);
|
||||
is_zp_null = (foo.length()==0);
|
||||
//is_zp_null = (foo.length()==0);
|
||||
|
||||
/* EJB 4/5/2001 - remove this for consistency. FUTURE: bring it back under a global option?
|
||||
return is_title_null || is_zp_null;
|
||||
-- end removed code */
|
||||
|
||||
return false;
|
||||
|
||||
} // end validateNewTopic
|
||||
|
||||
|
@ -709,8 +713,11 @@ public class ConfOperations extends VeniceServlet
|
|||
|
||||
} // end catch
|
||||
|
||||
/* EJB 4/5/2001 - code removed for consistency - FUTURE: bring it back controlled by
|
||||
a global option?
|
||||
if (ntf.isNullRequest())
|
||||
return null; // no title or text specified - "204 No Content"
|
||||
-- end removed code */
|
||||
|
||||
setMyLocation(request,"confops?sig=" + sig.getSIGID() + "&conf=" + conf.getConfID() + "&cmd=T");
|
||||
return ntf;
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.silverwrist.venice.servlets.format;
|
|||
import java.util.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
import org.apache.log4j.*;
|
||||
import com.silverwrist.util.StringUtil;
|
||||
import com.silverwrist.venice.core.*;
|
||||
|
||||
|
@ -30,6 +31,8 @@ public class TopicPosts implements JSPRender
|
|||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
private static Category logger = Category.getInstance(TopicPosts.class);
|
||||
|
||||
// Attribute name for request attribute
|
||||
protected static final String ATTR_NAME = "com.silverwrist.venice.content.TopicPosts";
|
||||
|
||||
|
@ -60,6 +63,10 @@ public class TopicPosts implements JSPRender
|
|||
TopicContext topic, int first, int last, boolean read_new, boolean show_advanced)
|
||||
throws DataException, AccessError
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("TopicPosts: sig=" + sig.getSIGID() + ", conf=" + conf.getConfID() + ", topic="
|
||||
+ topic.getTopicNumber() + ", range=[" + first + ", " + last + "], rnm=" + read_new
|
||||
+ ", shac=" + show_advanced);
|
||||
this.engine = engine;
|
||||
this.sig = sig;
|
||||
this.conf = conf;
|
||||
|
@ -70,9 +77,12 @@ public class TopicPosts implements JSPRender
|
|||
this.unread = topic.getUnreadMessages();
|
||||
if (read_new)
|
||||
topic.setUnreadMessages(0);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug(this.unread + " unread messages");
|
||||
this.messages = topic.getMessages(first,last);
|
||||
this.visit_order = TopicVisitOrder.retrieve(request.getSession(true),conf.getConfID());
|
||||
visit_order.visit(topic.getTopicNumber());
|
||||
if (visit_order!=null)
|
||||
visit_order.visit(topic.getTopicNumber());
|
||||
List aliases = conf.getAliases();
|
||||
topic_stem = (String)(aliases.get(0)) + "." + String.valueOf(topic.getTopicNumber()) + ".";
|
||||
|
||||
|
@ -173,7 +183,10 @@ public class TopicPosts implements JSPRender
|
|||
|
||||
public int getNextTopicNumber()
|
||||
{
|
||||
return visit_order.getNext();
|
||||
if (visit_order!=null)
|
||||
return visit_order.getNext();
|
||||
else
|
||||
return -1;
|
||||
|
||||
} // end getNextTopicNumber
|
||||
|
||||
|
@ -203,8 +216,9 @@ public class TopicPosts implements JSPRender
|
|||
public String getNextLocator()
|
||||
{
|
||||
StringBuffer buf = new StringBuffer("sig=");
|
||||
buf.append(sig.getSIGID()).append("&conf=").append(conf.getConfID()).append("&top=");
|
||||
buf.append(visit_order.getNext());
|
||||
buf.append(sig.getSIGID()).append("&conf=").append(conf.getConfID());
|
||||
if (visit_order!=null)
|
||||
buf.append("&top=").append(visit_order.getNext());
|
||||
return buf.toString();
|
||||
|
||||
} // end getNextLocator
|
||||
|
@ -257,7 +271,10 @@ public class TopicPosts implements JSPRender
|
|||
|
||||
public boolean canDoNextTopic()
|
||||
{
|
||||
return visit_order.isNext();
|
||||
if (visit_order!=null)
|
||||
return visit_order.isNext();
|
||||
else
|
||||
return false;
|
||||
|
||||
} // end canDoNextTopic
|
||||
|
||||
|
|
|
@ -99,13 +99,9 @@ public class TopicVisitOrder
|
|||
TopicVisitOrder tvo = (TopicVisitOrder)(session.getAttribute(ATTRIBUTE));
|
||||
if (tvo!=null)
|
||||
{ // make sure the conference is OK
|
||||
if (tvo.confid!=confid)
|
||||
{ // wrong conference - remove this
|
||||
session.removeAttribute(ATTRIBUTE);
|
||||
if (tvo.confid!=confid) // wrong conference - remove this
|
||||
tvo = null;
|
||||
|
||||
} // end if
|
||||
|
||||
} // end if
|
||||
|
||||
return tvo;
|
||||
|
|
Loading…
Reference in New Issue
Block a user