Skip to content

Commit

Permalink
use limit and actualLimit, to avoid saving the default value
Browse files Browse the repository at this point in the history
  • Loading branch information
NAR8789 committed Oct 15, 2020
1 parent 340049a commit f612814
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@ module.exports = {
// Select the top posts for every possible sort method, to give us a limited
// index of the posts that each filter method would select.
//
follow.limit = follow.limit || POSTS_IN_MAIN_INDEX
follow.actualLimit = follow.limit || POSTS_IN_MAIN_INDEX
follow.posts = frago.master(meta,
meta.sortBy ? [meta.sortBy] : ['publishedAt', 'updatedAt'],
follow.limit)
follow.actualLimit)
follow.sortedBy = meta.sortedBy

//
Expand Down
4 changes: 2 additions & 2 deletions src/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const FollowForm = (match, setup, isNew) => ({follows}, actions) => {
<label for="title" class="optional">Limit</label>
<input type="number" id="limit" value={follow.limit} min='0' step='1'
oninput={e => follow.limit = e.target.value} />
<p class="note">(Number of recent feed entries to show)</p>
<p class="note">Number of recent feed entries to show. (If left blank, defaults to <em>10</em>)</p>
</div>

<button onclick={e => {u('#working').attr('style', 'display: block'); return actions.follows.save(follow)}}>Save</button>
Expand Down Expand Up @@ -423,7 +423,7 @@ const ListFollow = ({ location, match }) => ({follows}, actions) => {
{follow.posts instanceof Array && follow.posts.length > 0 &&
<div class="post">
<ol class="title">{(showReposts ? follow.posts : follow.posts.filter(x => !x.author || x.author === follow.author)).
slice(0, follow.limit || 10).map(f => {
slice(0, follow.actualLimit || 10).map(f => {
let postAge = timeAgo(f[sortPosts], now)
return <li class={timeDarkness(f[sortPosts], now)}>
{f.author && f.author !== follow.author && <span class="author">{f.author}</span>}
Expand Down

0 comments on commit f612814

Please sign in to comment.