]> code.citadel.org Git - citadel.git/commitdiff
Keep track of the last message number we saw
authorArt Cancro <ajc@citadel.org>
Sat, 12 Feb 2022 23:10:22 +0000 (18:10 -0500)
committerArt Cancro <ajc@citadel.org>
Sat, 12 Feb 2022 23:10:22 +0000 (18:10 -0500)
webcit-ng/static/index.html
webcit-ng/static/js/main.js
webcit-ng/static/js/view_forum.js

index 4ad83b00831dfd38ee235602559f995172e34cde..2db6bf63ae145ba0caeb7faffd4f3dcff6b9cc9b 100644 (file)
@@ -31,10 +31,10 @@ LOADING
                <span id="ctdl_banner_title" class="w3-bar-item">XXX</span>
        </span>
        <span class="w3-right">
-               <button class="w3-bar-item w3-button" onclick="entmsg_dispatcher();" style="display:none" id="ctdl-newmsg-button">enter</button>
-               <button class="w3-bar-item w3-button" onclick="gotonext(0);">ungoto</button>
-               <button class="w3-bar-item w3-button" onclick="gotonext(1);">skip</button>
-               <button class="w3-bar-item w3-button" onclick="gotonext(2);">goto</button>
+               <button id="ctdl-newmsg-button" style="display:none" class="w3-bar-item w3-button" onclick="entmsg_dispatcher();">enter</button>
+               <button id="ctdl-skip-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(0);">ungoto</button>
+               <button id="ctdl-skip-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(1);">skip</button>
+               <button id="ctdl-goto-button" style="display:none" class="w3-bar-item w3-button" onclick="gotonext(2);">goto</button>
                <span id="lilo" class="w3-bar-item">Login</span>
        </span>
 </div>
index 66131ebf0b5b3fafa2a1fcf33589cce12959df74..039a1e64b04a9ef2568b2b81642796b4eeaa382b 100644 (file)
@@ -74,7 +74,7 @@ function update_banner() {
        }
        document.getElementById("current_user").innerHTML = current_user ;
        if (logged_in) {
-               document.getElementById("lilo").innerHTML = "<a href=\"/ctdl/a/logout\">" + _("Log off") + "</a>" ;
+               document.getElementById("lilo").innerHTML = "<a href=\"/ctdl/a/logout\"><i class=\"fa-regular fa-right-from-bracket\"></i>" + _("Log off") + "</a>" ;
        }
        else {
                document.getElementById("lilo").innerHTML = "<a href=\"javascript:display_login_screen('')\">" + _("Log in") + "</a>" ;
@@ -106,7 +106,12 @@ function gotoroom(roomname) {
 // Goto next room with unread messages
 // which_oper is 0=ungoto, 1=skip, 2=goto
 function gotonext(which_oper) {
-       if ((which_oper == 1) || (which_oper == 2)) {
+
+       if (which_oper == 2) {                                  // Goto needs to mark messages as seen
+               console.log("FIXME set lrp to " + last_seen);
+       }
+
+       if ((which_oper == 1) || (which_oper == 2)) {           // Skip or Goto both take us to the "next" room
                if (march_list.length == 0) {
                        console.log("Loading march list");
                        load_new_march_list(which_oper);        // we will recurse back here
index fb803844041ba37c74da35e3e55486f102dab858..89f8d652af3c5a45968767fde3cf83eba37b92ac 100644 (file)
@@ -101,9 +101,16 @@ function forum_readmessages(target_div_name, gt_msg, lt_msg) {
        }
        fetch_msg_list();
 
-       // make the new message button appear
-       document.getElementById("ctdl-newmsg-button").innerHTML = "<i class=\"far fa-edit\"></i>" + _("Post message");
+       // make the nav buttons appear (post a new message, skip this room, goto next room)
+
+       document.getElementById("ctdl-newmsg-button").innerHTML = "<i class=\"fa fa-edit\"></i>" + _("Post message");
        document.getElementById("ctdl-newmsg-button").style.display = "block";
+
+       document.getElementById("ctdl-skip-button").innerHTML = "<i class=\"fa fa-arrow-alt-circle-right\"></i>" + _("Skip this room");
+       document.getElementById("ctdl-skip-button").style.display = "block";
+
+       document.getElementById("ctdl-goto-button").innerHTML = "<i class=\"fa fa-arrow-circle-right\"></i>" + _("Goto next room");
+       document.getElementById("ctdl-goto-button").style.display = "block";
 }
 
 
@@ -149,6 +156,12 @@ function forum_render_messages(message_numbers, msgs_div_name, scroll_to) {
        }
 
        fetch_msg_list();
+
+       // Make a note of the highest message number we saw, so we can mark it when we "Goto next room"
+       // (Compared to the text client, this is actually more like <A>bandon than <G>oto)
+       if ((num_msgs > 0) && (message_numbers[num_msgs-1] > last_seen)) {
+               last_seen = message_numbers[num_msgs-1];
+       }
 }