Commit 6b4fbd16 authored by Adam Rambousek's avatar Adam Rambousek
Browse files

fix #152 api notifkace

parent 90ba0034
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -959,6 +959,11 @@ class TeCu < DictSedna
    @notif_db.execute(query, [term_id])
  end

  def read_notif(nid)
    query = "UPDATE notif SET read=1 WHERE nid=?"
    @notif_db.execute(query, [nid])
  end

  def prepare_notif(entry_id, term, role, comment, user_from, users)
    clear_notif(entry_id)
    roles = role.to_s.split(',')
+7 −0
Original line number Diff line number Diff line
@@ -1579,6 +1579,13 @@ def do_GET(request, response)
            response.body = '{"ok":true, "msg":"saved working", "id": "'+id+'"}'
            response['Content-Type'] = 'application/json; charset=utf-8'
      end
    when 'precteno'
      if request.query["nid"].to_s != ""
        nid = request.query["nid"].to_s.force_encoding('UTF-8')
        @dict.read_notif(nid)
      end
      response.body = '{"ok":true, "msg":"saved", "nid": "'+nid+'"}'
      response['Content-Type'] = 'application/json; charset=utf-8'
    when 'schvaleno'
      if request.query["id"].to_s != ""
        id = request.query["id"].to_s.force_encoding('UTF-8')