bsw@558: local notification_links = {} bsw@558: bsw@558: if app.session.member.notify_email_unconfirmed then bsw@558: notification_links[#notification_links+1] = { bsw@558: module = "index", view = "email_unconfirmed", bsw@558: text = _"Please confirm your email address" bsw@558: } bsw@558: end bsw@558: bsw@558: if app.session.member.notify_level == nil then bsw@558: notification_links[#notification_links+1] = { bsw@558: module = "member", view = "settings_notification", bsw@558: text = _"Please select your preferred notification level" bsw@558: } bsw@558: end bsw@558: bsw@558: local broken_delegations_count = Delegation:selector_for_broken(app.session.member_id):count() bsw@558: bsw@558: if broken_delegations_count > 0 then bsw@558: notification_links[#notification_links+1] = { bsw@558: module = "index", view = "broken_delegations", bsw@558: text = _("#{count} of your outgoing delegation(s) are broken", { count = broken_delegations_count }) bsw@558: } bsw@558: bsw@558: end bsw@558: bsw@558: local selector = Issue:new_selector() bsw@558: :join("area", nil, "area.id = issue.area_id") bsw@558: :join("privilege", nil, { "privilege.unit_id = area.unit_id AND privilege.member_id = ? AND privilege.voting_right", app.session.member_id }) bsw@558: :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) bsw@558: :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id }) bsw@558: :add_where{ "direct_voter.member_id ISNULL" } bsw@558: :add_where{ "interest.member_id NOTNULL" } bsw@558: :add_where{ "issue.fully_frozen NOTNULL" } bsw@558: :add_where{ "issue.closed ISNULL" } bsw@558: :add_order_by{ "issue.fully_frozen + issue.voting_time ASC" } bsw@558: bsw@558: local issues_to_vote_count = selector:count() bsw@558: if issues_to_vote_count > 0 then bsw@558: notification_links[#notification_links+1] = { bsw@558: module = "index", view = "index", bsw@558: params = { bsw@559: tab = "open", filter = "frozen", filter_interest = "issue", filter_delegation = "direct", filter_voting = "not_voted" bsw@558: }, bsw@559: text = _("You have not voted #{count} issue(s) you were interested in", { count = issues_to_vote_count }) bsw@558: } bsw@558: end bsw@558: bsw@558: local initiator_invites_count = Initiator:selector_for_invites(app.session.member_id):count() bsw@558: bsw@558: if initiator_invites_count > 0 then bsw@558: notification_links[#notification_links+1] = { bsw@558: module = "index", view = "initiator_invites", bsw@558: text = _("You are invited to #{count} initiative(s)", { count = initiator_invites_count }) bsw@558: } bsw@558: end bsw@558: bsw@558: updated_drafts_count = Initiative:selector_for_updated_drafts(app.session.member_id):count() bsw@558: bsw@558: if updated_drafts_count > 0 then bsw@558: notification_links[#notification_links+1] = { bsw@558: module = "index", view = "updated_drafts", bsw@558: text = _("New drafts for #{count} initiative(s) you are supporting", { count = updated_drafts_count }) bsw@558: } bsw@558: end bsw@558: bsw@558: if #notification_links > 0 then bsw@558: ui.container{ attr = { class = "notifications" }, content = function() bsw@558: ui.tag{ tag = "ul", attr = { class = "notifications" }, content = function() bsw@558: for i, notification_link in ipairs(notification_links) do bsw@558: ui.tag{ tag = "li", content = function() bsw@558: ui.link(notification_link) bsw@558: end } bsw@558: end bsw@558: end } bsw@558: end } bsw@558: end bsw@558: bsw@558: