liquid_feedback_frontend

changeset 990:77873f08d94f

Completed support for check delegations, removed debug code
author bsw
date Sat Apr 20 19:26:58 2013 +0200 (2013-04-20)
parents 5a712ec1a7f1
children c4de4ef33da6
files app/main/index/_action/login.lua app/main/index/_action/reset_password.lua app/main/index/_action/send_login.lua app/main/index/_notifications.lua
line diff
     1.1 --- a/app/main/index/_action/login.lua	Sat Apr 20 18:51:28 2013 +0200
     1.2 +++ b/app/main/index/_action/login.lua	Sat Apr 20 19:26:58 2013 +0200
     1.3 @@ -49,18 +49,30 @@
     1.4      name = "sessionID",
     1.5      value = etherpad_sesion_id
     1.6    }
     1.7 -
     1.8  end
     1.9  
    1.10 -
    1.11  if member then
    1.12    member.last_login = "now"
    1.13 -  if config.check_delegations_interval_hard and member.needs_delegation_check_hard then
    1.14 +  
    1.15 +  local delegations = Delegation:delegations_to_check_for_member_id(member.id)
    1.16 +  
    1.17 +  if config.check_delegations_interval_hard 
    1.18 +      and member.needs_delegation_check_hard
    1.19 +      and #delegations > 0 then
    1.20 +        
    1.21      app.session.needs_delegation_check = true
    1.22 +    
    1.23    else
    1.24 +    
    1.25 +    if #delegations == 0 then
    1.26 +      member.last_delegation_check = "now"
    1.27 +    end
    1.28 +    
    1.29      member.last_activity = "now"
    1.30      member.active = true
    1.31 +    
    1.32    end
    1.33 +  
    1.34    if member.lang == nil then
    1.35      member.lang = app.session.lang
    1.36    else
     2.1 --- a/app/main/index/_action/reset_password.lua	Sat Apr 20 18:51:28 2013 +0200
     2.2 +++ b/app/main/index/_action/reset_password.lua	Sat Apr 20 19:26:58 2013 +0200
     2.3 @@ -39,7 +39,7 @@
     2.4      }
     2.5    end
     2.6  
     2.7 -  slot.put_into("notice", _"Reset link has been send for this member")
     2.8 +  slot.put_into("notice", _"Your request has been processed.")
     2.9  
    2.10  else
    2.11    local member = Member:new_selector()
     3.1 --- a/app/main/index/_action/send_login.lua	Sat Apr 20 18:51:28 2013 +0200
     3.2 +++ b/app/main/index/_action/send_login.lua	Sat Apr 20 19:26:58 2013 +0200
     3.3 @@ -3,7 +3,8 @@
     3.4  local email = param.get("email")
     3.5  
     3.6  local members = Member:new_selector()
     3.7 -  :add_where{ "notify_email = ? OR notify_email_unconfirmed = ?", email, email }
     3.8 +  :add_where{ "split_part(notify_email, '@', 1) = split_part(?, '@', 1)", email }
     3.9 +  :add_where{ "lower(split_part(notify_email, '@', 2)) = lower(split_part(?, '@', 2))", email }
    3.10    :add_where("login_recovery_expiry ISNULL OR login_recovery_expiry < now()")
    3.11    :exec()
    3.12  
    3.13 @@ -28,9 +29,6 @@
    3.14    end
    3.15  end)
    3.16  
    3.17 -trace.debug(content)
    3.18 -if true then return end
    3.19 -
    3.20  local success = net.send_mail{
    3.21    envelope_from = config.mail_envelope_from,
    3.22    from          = config.mail_from,
    3.23 @@ -40,3 +38,5 @@
    3.24    content_type  = "text/plain; charset=UTF-8",
    3.25    content       = content
    3.26  }
    3.27 +
    3.28 +slot.put_into("notice", _"Your request has been processed.")
     4.1 --- a/app/main/index/_notifications.lua	Sat Apr 20 18:51:28 2013 +0200
     4.2 +++ b/app/main/index/_notifications.lua	Sat Apr 20 19:26:58 2013 +0200
     4.3 @@ -21,11 +21,18 @@
     4.4      :single_object_mode()
     4.5      :exec()
     4.6      
     4.7 +
     4.8    if member.needs_delegation_check_soft then
     4.9 -    notification_links[#notification_links+1] = {
    4.10 -      module = "index", view = "check_delegations", 
    4.11 -      text = _"Check your delegations!"
    4.12 -    }
    4.13 +
    4.14 +    local delegations = Delegation:delegations_to_check_for_member_id(member.id)
    4.15 +    
    4.16 +    if #delegations > 0 then
    4.17 +      notification_links[#notification_links+1] = {
    4.18 +        module = "index", view = "check_delegations", 
    4.19 +        text = _"Check your delegations!"
    4.20 +      }
    4.21 +    end
    4.22 +    
    4.23    end
    4.24  end
    4.25  

Impressum / About Us