Use item creation date in rsm order (#1516)
This commit is contained in:
parent
44484fa4ae
commit
70050b52ad
|
@ -673,20 +673,20 @@ get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex,
|
||||||
case I of
|
case I of
|
||||||
undefined when IncIndex =/= undefined ->
|
undefined when IncIndex =/= undefined ->
|
||||||
case ejabberd_sql:sql_query_t(
|
case ejabberd_sql:sql_query_t(
|
||||||
[<<"select modification from pubsub_item pi "
|
[<<"select creation from pubsub_item pi "
|
||||||
"where exists ( select count(*) as count1 "
|
"where exists ( select count(*) as count1 "
|
||||||
"from pubsub_item where nodeid='">>, SNidx,
|
"from pubsub_item where nodeid='">>, SNidx,
|
||||||
<<"' and modification > pi.modification having count1 = ">>,
|
<<"' and creation > pi.creation having count1 = ">>,
|
||||||
integer_to_binary(IncIndex), <<" );">>]) of
|
integer_to_binary(IncIndex), <<" );">>]) of
|
||||||
{selected, [_], [[O]]} ->
|
{selected, [_], [[O]]} ->
|
||||||
[<<"modification">>, <<"'", O/binary, "'">>];
|
[<<"creation">>, <<"'", O/binary, "'">>];
|
||||||
_ ->
|
_ ->
|
||||||
[<<"modification">>, <<"null">>]
|
[<<"creation">>, <<"null">>]
|
||||||
end;
|
end;
|
||||||
undefined ->
|
undefined ->
|
||||||
[<<"modification">>, <<"null">>];
|
[<<"creation">>, <<"null">>];
|
||||||
<<>> ->
|
<<>> ->
|
||||||
[<<"modification">>, <<"null">>];
|
[<<"creation">>, <<"null">>];
|
||||||
I ->
|
I ->
|
||||||
[A, B] = str:tokens(ejabberd_sql:escape(I), <<"@">>),
|
[A, B] = str:tokens(ejabberd_sql:escape(I), <<"@">>),
|
||||||
[A, <<"'", B/binary, "'">>]
|
[A, <<"'", B/binary, "'">>]
|
||||||
|
@ -729,8 +729,8 @@ get_items(Nidx, _From, #rsm_set{max = Max, index = IncIndex,
|
||||||
index = Index,
|
index = Index,
|
||||||
first = #rsm_first{
|
first = #rsm_first{
|
||||||
index = Index,
|
index = Index,
|
||||||
data = <<"modification@", F/binary>>},
|
data = <<"creation@", F/binary>>},
|
||||||
last = <<"modification@", L/binary>>},
|
last = <<"creation@", L/binary>>},
|
||||||
{result, {[raw_to_item(Nidx, RItem) || RItem <- RItems], RsmOut}};
|
{result, {[raw_to_item(Nidx, RItem) || RItem <- RItems], RsmOut}};
|
||||||
[] ->
|
[] ->
|
||||||
{result, {[], #rsm_set{count = Count}}}
|
{result, {[], #rsm_set{count = Count}}}
|
||||||
|
|
Loading…
Reference in New Issue