Fossil

Check-in [b12d69d9f4]
Login

Check-in [b12d69d9f4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:chat message deletion: admins now have both delete local and delete global options, in case they want to remove something from local view without deleting it for all users.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b12d69d9f4686cef96dab5b37902b0d48581116228d0f74c91fa93d9a0d0b664
User & Date: stephan 2020-12-24 22:07:40.399
Context
2020-12-24
22:21
chat poll again uses "quiet" error handling to avoid posting toast error messages when it times out (which it does every 10 minutes or so when idle). ... (check-in: b6de299bb7 user: stephan tags: trunk)
22:07
chat message deletion: admins now have both delete local and delete global options, in case they want to remove something from local view without deleting it for all users. ... (check-in: b12d69d9f4 user: stephan tags: trunk)
20:18
Initial impl of buttons to load older chat messages. The UI code is a bit more involved than might seem necessary, but is so largely because it needs to avoid UI/ajax race conditions. ... (check-in: 6d676f6eb5 user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/chat.js.
295
296
297
298
299
300
301
302
303
304
305
306

307
308
309
310
311

312
313
314
315


316





317

318
319
320
321
322
323
324
          D.clearElement(this.e);
          const d = new Date(eMsg.dataset.timestamp+"Z");
          if(d.getMinutes().toString()!=="NaN"){
            // Date works, render informative timestamps
            D.append(this.e,
                     D.append(D.span(), localTimeString(d)," client-local"),
                     D.append(D.span(), iso8601ish(d)));
          }else{
            // Date doesn't work, so dumb it down...
            D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," GMT"));
          }
          const toolbar = D.addClass(D.div(), 'toolbar');

          const btnDelete = D.button("Delete "+
                                     (Chat.userMayDelete(eMsg)
                                      ? "globally" : "locally"));
          const self = this;
          btnDelete.addEventListener('click', function(){

            self.hide();
            Chat.deleteMessage(eMsg);
          });
          D.append(this.e, toolbar);


          D.append(toolbar, btnDelete);





        }

      });
      f.popup.installClickToHide();
      f.popup.hide = function(){
        delete this._eMsg;
        D.clearElement(this.e);
        return this.show(false);
      };







|




>
|
|
<

|
>

|

<
>
>
|
>
>
>
>
>
|
>







295
296
297
298
299
300
301
302
303
304
305
306
307
308
309

310
311
312
313
314
315

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
          D.clearElement(this.e);
          const d = new Date(eMsg.dataset.timestamp+"Z");
          if(d.getMinutes().toString()!=="NaN"){
            // Date works, render informative timestamps
            D.append(this.e,
                     D.append(D.span(), localTimeString(d)," client-local"),
                     D.append(D.span(), iso8601ish(d)));
           }else{
            // Date doesn't work, so dumb it down...
            D.append(this.e, D.append(D.span(), eMsg.dataset.timestamp," GMT"));
          }
          const toolbar = D.addClass(D.div(), 'toolbar');
          D.append(this.e, toolbar);
          const btnDeleteLocal = D.button("Delete locally");
          D.append(toolbar, btnDeleteLocal);

          const self = this;
          btnDeleteLocal.addEventListener('click', function(){
            console.debug("local-only delete");
            self.hide();
            Chat.deleteMessageElem(eMsg);
          });

          if(Chat.userMayDelete(eMsg)){
            const btnDeleteGlobal = D.button("Delete globally");
            D.append(toolbar, btnDeleteGlobal);
            btnDeleteGlobal.addEventListener('click', function(){
              console.debug("global delete");
              self.hide();
              Chat.deleteMessage(eMsg);
            });
          }
        }/*refresh()*/
      });
      f.popup.installClickToHide();
      f.popup.hide = function(){
        delete this._eMsg;
        D.clearElement(this.e);
        return this.show(false);
      };
Changes to src/default.css.
1510
1511
1512
1513
1514
1515
1516

1517
1518
1519
1520
1521
1522
1523







1524
1525
1526
1527
1528
1529
1530
  font-family: monospace;
  font-size: 0.8em;
  text-align: left;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  align-items: stretch;

}
body.chat .chat-message-popup > span { white-space: nowrap; }
body.chat .chat-message-popup > .toolbar {
  padding: 0.2em;
  margin: 0;
  border: 2px inset rgba(0,0,0,0.3);
  border-radius: 0.25em;







}

body.chat .load-msg-toolbar  {
  border-radius: 0.25em;
  padding: 0.1em 0.2em;
}
body.chat .load-msg-toolbar.all-done {







>







>
>
>
>
>
>
>







1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
  font-family: monospace;
  font-size: 0.8em;
  text-align: left;
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0.25em;
}
body.chat .chat-message-popup > span { white-space: nowrap; }
body.chat .chat-message-popup > .toolbar {
  padding: 0.2em;
  margin: 0;
  border: 2px inset rgba(0,0,0,0.3);
  border-radius: 0.25em;
  display: flex;
  flex-direction: row;
  justify-content: stretch;
  flex-wrap: wrap;
}
body.chat .chat-message-popup > .toolbar > button {
  flex: 1 1 auto;
}

body.chat .load-msg-toolbar  {
  border-radius: 0.25em;
  padding: 0.1em 0.2em;
}
body.chat .load-msg-toolbar.all-done {