commit: b5c6d00afae53dca1b6abd405556d58557ea7e1a
parent: 13ee88926d914bfa1edb6c9c8109e121f5cf9582
Author: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 17 Oct 2016 01:23:41 +0200
Fix #99 - public timeline not just reblogs, fix #98 infinite scrolling issues
Diffstat:
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/app/assets/javascripts/components/actions/accounts.jsx b/app/assets/javascripts/components/actions/accounts.jsx
@@ -1,5 +1,6 @@
-import api from '../api'
-import axios from 'axios';
+import api from '../api'
+import axios from 'axios';
+import Immutable from 'immutable';
export const ACCOUNT_SET_SELF = 'ACCOUNT_SET_SELF';
@@ -66,7 +67,7 @@ export function fetchAccountTimeline(id) {
export function expandAccountTimeline(id) {
return (dispatch, getState) => {
- const lastId = getState().getIn(['timelines', 'accounts_timelines', id]).last();
+ const lastId = getState().getIn(['timelines', 'accounts_timelines', id], Immutable.List()).last();
dispatch(expandAccountTimelineRequest(id));
diff --git a/app/assets/javascripts/components/features/account_timeline/index.jsx b/app/assets/javascripts/components/features/account_timeline/index.jsx
@@ -66,7 +66,7 @@ const AccountTimeline = React.createClass({
},
handleScrollToBottom () {
- this.props.dispatch(expandAccountTimeline(this.props.account.get('id')));
+ this.props.dispatch(expandAccountTimeline(Number(this.props.params.accountId)));
},
render () {
diff --git a/app/models/concerns/paginable.rb b/app/models/concerns/paginable.rb
@@ -4,8 +4,8 @@ module Paginable
included do
def self.paginate_by_max_id(limit, max_id = nil, since_id = nil)
query = order('id desc').limit(limit)
- query = query.where('id < ?', max_id) unless max_id.blank?
- query = query.where('id > ?', since_id) unless since_id.blank?
+ query = query.where(arel_table[:id].lt(max_id)) unless max_id.blank?
+ query = query.where(arel_table[:id].gt(since_id)) unless since_id.blank?
query
end
end
diff --git a/app/models/status.rb b/app/models/status.rb
@@ -86,7 +86,7 @@ class Status < ApplicationRecord
end
def self.as_public_timeline(account)
- joins('LEFT JOIN statuses AS reblogs ON reblogs.id = statuses.reblog_of_id').where('reblogs.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?) AND statuses.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)', account.id, account.id).with_includes.with_counters
+ joins('LEFT OUTER JOIN statuses AS reblogs ON reblogs.id = statuses.reblog_of_id').where('reblogs.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?) AND statuses.account_id NOT IN (SELECT target_account_id FROM blocks WHERE account_id = ?)', account.id, account.id).with_includes.with_counters
end
def self.favourites_map(status_ids, account_id)