Skip to content

Commit 3aa3882

Browse files
authored
only skip active sticky entries when rendering RecentPage (#3470)
1 parent 02f12d4 commit 3aa3882

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cgi-bin/LJ/S2/RecentPage.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ sub RecentPage {
223223

224224
$opts->{cut_disable} = ( $remote && $remote->prop('opt_cut_disable_journal') );
225225

226-
my $sticky_entries = $u->sticky_entries_lookup;
226+
my $sticky_entries = { map { $_ => 1 } $u->sticky_entry_active_ids };
227227

228228
ENTRY:
229229
foreach my $item (@items) {

cgi-bin/LJ/User/Permissions.pm

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1411,13 +1411,23 @@ sub sticky_entries {
14111411
return @entries;
14121412
}
14131413

1414-
# returns a list of sticky entry ids
1414+
# returns a list of all sticky entry ids
14151415
sub sticky_entry_ids {
14161416
my $prop = $_[0]->prop('sticky_entry');
14171417
return unless defined $prop;
14181418
return split /,/, $prop;
14191419
}
14201420

1421+
# returns a list of active sticky entry ids
1422+
sub sticky_entry_active_ids {
1423+
my ($u) = @_;
1424+
my $max = $u->count_max_stickies || 0;
1425+
my @ids = $u->sticky_entry_ids;
1426+
return unless @ids;
1427+
@ids = @ids[ 0 .. $max - 1 ] if scalar @ids > $max;
1428+
return @ids;
1429+
}
1430+
14211431
# returns a map of ditemid => 1 of the sticky entries
14221432
sub sticky_entries_lookup {
14231433
return { map { $_ => 1 } $_[0]->sticky_entry_ids };

0 commit comments

Comments
 (0)