Ticket #71 (closed task: fixed)

Opened 4 years ago

Last modified 4 years ago

Support ajax for read/unread

Reported by: zeborah Owned by: zeborah
Priority: minor Milestone: verbosify.org launch
Component: AJAX Keywords: read
Cc: Sensitive: no

Description

Or else tell me that it's already supported and I just need more learnings in order to implement it, and then I'll go away and get more learnings.

--Actually, pursuant to a quick google search, I'm leaning towards the latter, so this ticket may be really easy for you to close...? :-)

(Basically I want for the button people click to not have to reload the page.)

Change History

comment:1 Changed 4 years ago by ajk

  • Status changed from new to accepted

It requires no additional support from the server; you just need to do an AJAX request instead of a standard form.

Leaving it open for now, because AJAX is on my to do list as well.

comment:2 Changed 4 years ago by ajk

  • Component changed from HTTP to AJAX

comment:3 Changed 4 years ago by ajk

(My plan is to eventually have all the functionality relevant Javascript in the alue codebase instead of template codebase, but that should not stop you from doing whatever you feel is necessary – I can always move them over once the support for that is there.)

(By the way, I have been looking into using jQuery in the functionality related Javascript. It may be a good idea for you to investigate it as well, if you do functionality related JS stuff.)

comment:4 Changed 4 years ago by ajk

  • Owner changed from ajk to zeborah
  • Status changed from accepted to assigned

On the assumption that you're eager to work on the AJAX part, I'm assigning this to you. As I said, I expect that the server side support is already there.

By the way, you should see about getting a local installation of Alue, for two reasons: 1) easier to test templates without having to publish all the attempts and 2) once functionality related Javascript is moved to the Alue code, you need it to be able to test AJAX code.

comment:5 Changed 4 years ago by zeborah

  • Status changed from assigned to accepted

I'll work on this today - it looks rather straightforward actually but we'll see how deceptive that is...

I've been meaning to get a local installation - may need some talking through (from you for Alue things and/or my father for Mac things) so maybe this weekend's the best time to attempt it.

comment:6 Changed 4 years ago by ajk

Please note AJAX protocol change. The new protocol is:

  • URL is /markread/ajax
  • msgid is required
  • format=txt is recommended for future compatibility but is currently ignored
  • if mark action desired, POST without the undo field
  • if unmark action desired, POST with undo=yes
  • if just want to query, GET
  • responses are:
    • AJAX YES if the message is now marked read
    • AJAX NO if the message is now not marked read
    • AJAX ERR followed by error code indicates and error:
      • AJAX ERR NOAUTH if connection is not authenticated
      • AJAX ERR NOMSG if the message is not in the database
      • for future compatibility, be prepared for other error codes after AJAX ERR
  • responses are always terminated by CRLF (\r\n)
  • for future compatibility, ignore anything after the first line in the response

comment:7 Changed 4 years ago by zeborah

  • Status changed from accepted to closed
  • Resolution set to fixed

Mark read/unread ajax is all happy and supported.

Note: See TracTickets for help on using tickets.