Added better id in feed item.
In node recent changes, return only the published entries.
This commit is contained in:
@@ -312,6 +312,7 @@ feature -- Hooks
|
|||||||
if l_node_api.has_permission_for_action_on_node ("view", n, a_current_user) then
|
if l_node_api.has_permission_for_action_on_node ("view", n, a_current_user) then
|
||||||
n := l_node_api.full_node (n)
|
n := l_node_api.full_node (n)
|
||||||
create ch.make (n.content_type, create {CMS_LOCAL_LINK}.make (n.title, "node/" + n.id.out), n.modification_date)
|
create ch.make (n.content_type, create {CMS_LOCAL_LINK}.make (n.title, "node/" + n.id.out), n.modification_date)
|
||||||
|
ch.set_id (n.content_type + ":id" + n.id.out + "-rev" + n.revision.out)
|
||||||
if n.creation_date ~ n.modification_date then
|
if n.creation_date ~ n.modification_date then
|
||||||
l_info := "new"
|
l_info := "new"
|
||||||
if not n.is_published then
|
if not n.is_published then
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ feature -- Access
|
|||||||
end
|
end
|
||||||
|
|
||||||
recent_node_changes_before (a_lower: INTEGER; a_count: INTEGER; a_date: DATE_TIME): LIST [CMS_NODE]
|
recent_node_changes_before (a_lower: INTEGER; a_count: INTEGER; a_date: DATE_TIME): LIST [CMS_NODE]
|
||||||
-- List of recent changes, before `a_date', according to `params' settings.
|
-- List of recent changes on published nodes, before `a_date', according to `params' settings.
|
||||||
local
|
local
|
||||||
l_parameters: STRING_TABLE [detachable ANY]
|
l_parameters: STRING_TABLE [detachable ANY]
|
||||||
do
|
do
|
||||||
@@ -224,10 +224,11 @@ feature -- Access
|
|||||||
write_information_log (generator + ".recent_node_changes_before")
|
write_information_log (generator + ".recent_node_changes_before")
|
||||||
|
|
||||||
from
|
from
|
||||||
create l_parameters.make (3)
|
create l_parameters.make (4)
|
||||||
l_parameters.put (a_count, "size")
|
l_parameters.put (a_count, "size")
|
||||||
l_parameters.put (a_lower, "offset")
|
l_parameters.put (a_lower, "offset")
|
||||||
l_parameters.put (a_date, "date")
|
l_parameters.put (a_date, "date")
|
||||||
|
l_parameters.put ({CMS_NODE_API}.published, "status")
|
||||||
|
|
||||||
sql_query (sql_select_recent_node_changes_before, l_parameters)
|
sql_query (sql_select_recent_node_changes_before, l_parameters)
|
||||||
sql_start
|
sql_start
|
||||||
@@ -613,9 +614,9 @@ feature {NONE} -- Queries nodes
|
|||||||
end
|
end
|
||||||
|
|
||||||
sql_select_recent_node_changes_before: STRING
|
sql_select_recent_node_changes_before: STRING
|
||||||
--
|
--published nodes before ':date'.
|
||||||
once
|
once
|
||||||
Result := sql_select_all_from_nodes + " WHERE changed <= :date ORDER BY changed DESC, nid DESC LIMIT :size OFFSET :offset ;"
|
Result := sql_select_all_from_nodes + " WHERE changed <= :date AND status=:status ORDER BY changed DESC, nid DESC LIMIT :size OFFSET :offset ;"
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Queries node revisions
|
feature {NONE} -- Queries node revisions
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
|
id: detachable READABLE_STRING_32
|
||||||
|
-- Optional id, expected to be unique.
|
||||||
|
|
||||||
link: CMS_LOCAL_LINK
|
link: CMS_LOCAL_LINK
|
||||||
-- Local link associated with the resource.
|
-- Local link associated with the resource.
|
||||||
|
|
||||||
@@ -51,6 +54,16 @@ feature -- Access
|
|||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
|
set_id (a_id: detachable READABLE_STRING_GENERAL)
|
||||||
|
-- Set `id` to `a_id`.
|
||||||
|
do
|
||||||
|
if a_id = Void then
|
||||||
|
id := Void
|
||||||
|
else
|
||||||
|
id := a_id.as_string_32
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
set_author_name (n: like author_name)
|
set_author_name (n: like author_name)
|
||||||
-- Set `author_name' to `n'.
|
-- Set `author_name' to `n'.
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ feature -- Hook
|
|||||||
create l_feed_name.make_from_string (a_response.api.setup.site_name)
|
create l_feed_name.make_from_string (a_response.api.setup.site_name)
|
||||||
l_feed_name.append_string ({STRING_32} " : recent changes")
|
l_feed_name.append_string ({STRING_32} " : recent changes")
|
||||||
create l_feed.make (l_feed_name)
|
create l_feed.make (l_feed_name)
|
||||||
|
l_feed.set_id (a_response.api.absolute_url (a_response.request.path_info, Void))
|
||||||
l_feed.set_date (create {DATE_TIME}.make_now_utc)
|
l_feed.set_date (create {DATE_TIME}.make_now_utc)
|
||||||
nb := a_size
|
nb := a_size
|
||||||
across
|
across
|
||||||
@@ -143,6 +144,10 @@ feature -- Hook
|
|||||||
create l_feed_item.make (ch.link.title)
|
create l_feed_item.make (ch.link.title)
|
||||||
l_feed_item.set_date (ch.date)
|
l_feed_item.set_date (ch.date)
|
||||||
|
|
||||||
|
if attached ch.id as l_ch_id then
|
||||||
|
l_feed_item.set_id (l_ch_id)
|
||||||
|
end
|
||||||
|
|
||||||
create s.make_empty
|
create s.make_empty
|
||||||
if attached ch.information as l_information then
|
if attached ch.information as l_information then
|
||||||
s.append_string_general (l_information)
|
s.append_string_general (l_information)
|
||||||
|
|||||||
Reference in New Issue
Block a user