Removed public/community timeline for non-admins
• Removed: - public/community timeline for non-admins - links to the page - web sockets for the page
This commit is contained in:
parent
b9bf84994f
commit
7ad7fe06bd
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class Api::V1::Timelines::PublicController < Api::BaseController
|
class Api::V1::Timelines::PublicController < Api::BaseController
|
||||||
before_action :require_user!, only: [:show]
|
before_action :require_user!, only: [:show]
|
||||||
|
before_action :require_admin!
|
||||||
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
||||||
|
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
@ -51,7 +51,6 @@ export function connectTimelineStream (timelineId, path, pollingRefresh = null,
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const connectUserStream = () => connectTimelineStream('home', 'user');
|
export const connectUserStream = () => connectTimelineStream('home', 'user');
|
||||||
export const connectCommunityStream = ({ onlyMedia } = {}) => connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`);
|
|
||||||
export const connectHashtagStream = (id, tag, accept) => connectTimelineStream(`hashtag:${id}`, `hashtag&tag=${tag}`, null, accept);
|
export const connectHashtagStream = (id, tag, accept) => connectTimelineStream(`hashtag:${id}`, `hashtag&tag=${tag}`, null, accept);
|
||||||
export const connectListStream = id => connectTimelineStream(`list:${id}`, `list&list=${id}`);
|
export const connectListStream = id => connectTimelineStream(`list:${id}`, `list&list=${id}`);
|
||||||
export const connectGroupStream = id => connectTimelineStream(`group:${id}`, `group&group=${id}`);
|
export const connectGroupStream = id => connectTimelineStream(`group:${id}`, `group&group=${id}`);
|
||||||
|
@ -164,11 +164,6 @@ class Sidebar extends ImmutablePureComponent {
|
|||||||
]
|
]
|
||||||
|
|
||||||
const exploreItems = [
|
const exploreItems = [
|
||||||
{
|
|
||||||
title: 'All',
|
|
||||||
icon: 'community',
|
|
||||||
to: '/timeline/all',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Chat',
|
title: 'Chat',
|
||||||
icon: 'chat',
|
icon: 'chat',
|
||||||
|
@ -130,12 +130,6 @@ class SidebarXS extends ImmutablePureComponent {
|
|||||||
onClick: this.handleSidebarClose,
|
onClick: this.handleSidebarClose,
|
||||||
title: intl.formatMessage(messages.preferences),
|
title: intl.formatMessage(messages.preferences),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
icon: 'community',
|
|
||||||
to: '/timeline/all',
|
|
||||||
onClick: this.handleSidebarClose,
|
|
||||||
title: 'All'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
icon: 'list',
|
icon: 'list',
|
||||||
to: '/lists',
|
to: '/lists',
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { defineMessages, injectIntl } from 'react-intl'
|
import { defineMessages, injectIntl } from 'react-intl'
|
||||||
import { expandCommunityTimeline } from '../actions/timelines'
|
import { expandCommunityTimeline } from '../actions/timelines'
|
||||||
import { connectCommunityStream } from '../actions/streaming'
|
|
||||||
import StatusList from '../components/status_list'
|
import StatusList from '../components/status_list'
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
@ -30,24 +29,13 @@ class CommunityTimeline extends PureComponent {
|
|||||||
const { dispatch, onlyMedia } = this.props
|
const { dispatch, onlyMedia } = this.props
|
||||||
|
|
||||||
dispatch(expandCommunityTimeline({ onlyMedia }))
|
dispatch(expandCommunityTimeline({ onlyMedia }))
|
||||||
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps) {
|
componentDidUpdate (prevProps) {
|
||||||
if (prevProps.onlyMedia !== this.props.onlyMedia) {
|
if (prevProps.onlyMedia !== this.props.onlyMedia) {
|
||||||
const { dispatch, onlyMedia } = this.props
|
const { dispatch, onlyMedia } = this.props
|
||||||
|
|
||||||
this.disconnect()
|
|
||||||
|
|
||||||
dispatch(expandCommunityTimeline({ onlyMedia }))
|
dispatch(expandCommunityTimeline({ onlyMedia }))
|
||||||
this.disconnect = dispatch(connectCommunityStream({ onlyMedia }))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount () {
|
|
||||||
if (this.disconnect) {
|
|
||||||
this.disconnect()
|
|
||||||
this.disconnect = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,6 @@ import WhoToFollowPanel from '../components/panel/who_to_follow_panel'
|
|||||||
import ProgressPanel from '../components/panel/progress_panel'
|
import ProgressPanel from '../components/panel/progress_panel'
|
||||||
import TrendsPanel from '../components/panel/trends_panel'
|
import TrendsPanel from '../components/panel/trends_panel'
|
||||||
import DefaultLayout from '../layouts/default_layout'
|
import DefaultLayout from '../layouts/default_layout'
|
||||||
import TimelineComposeBlock from '../components/timeline_compose_block'
|
|
||||||
import Divider from '../components/divider'
|
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
community: { 'id': 'column.community', 'defaultMessage': 'Community feed' },
|
community: { 'id': 'column.community', 'defaultMessage': 'Community feed' },
|
||||||
@ -57,8 +55,6 @@ class CommunityPage extends PureComponent {
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<PageTitle path={title} />
|
<PageTitle path={title} />
|
||||||
<TimelineComposeBlock autoFocus={false} />
|
|
||||||
<Divider />
|
|
||||||
{children}
|
{children}
|
||||||
</DefaultLayout>
|
</DefaultLayout>
|
||||||
)
|
)
|
||||||
|
@ -342,7 +342,7 @@ class Status < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def as_public_timeline(account = nil)
|
def as_public_timeline(account = nil)
|
||||||
query = timeline_scope.without_replies.where('statuses.updated_at > ?', 30.minutes.ago)
|
query = timeline_scope.without_replies
|
||||||
apply_timeline_filters(query, account)
|
apply_timeline_filters(query, account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,14 +87,6 @@ class BatchedRemoveStatusService < BaseService
|
|||||||
payload = @json_payloads[status.id]
|
payload = @json_payloads[status.id]
|
||||||
|
|
||||||
redis.pipelined do
|
redis.pipelined do
|
||||||
redis.publish('timeline:public', payload)
|
|
||||||
redis.publish('timeline:public:local', payload) if status.local?
|
|
||||||
|
|
||||||
if status.media_attachments.any?
|
|
||||||
redis.publish('timeline:public:media', payload)
|
|
||||||
redis.publish('timeline:public:local:media', payload) if status.local?
|
|
||||||
end
|
|
||||||
|
|
||||||
@tags[status.id].each do |hashtag|
|
@tags[status.id].each do |hashtag|
|
||||||
redis.publish("timeline:hashtag:#{hashtag}", payload)
|
redis.publish("timeline:hashtag:#{hashtag}", payload)
|
||||||
redis.publish("timeline:hashtag:#{hashtag}:local", payload) if status.local?
|
redis.publish("timeline:hashtag:#{hashtag}:local", payload) if status.local?
|
||||||
|
@ -24,9 +24,6 @@ class FanOutOnWriteService < BaseService
|
|||||||
deliver_to_hashtags(status)
|
deliver_to_hashtags(status)
|
||||||
|
|
||||||
return if status.reply? && status.in_reply_to_account_id != status.account_id
|
return if status.reply? && status.in_reply_to_account_id != status.account_id
|
||||||
|
|
||||||
deliver_to_public(status)
|
|
||||||
deliver_to_media(status) if status.media_attachments.any?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -98,20 +95,6 @@ class FanOutOnWriteService < BaseService
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def deliver_to_public(status)
|
|
||||||
Rails.logger.debug "Delivering status #{status.id} to public timeline"
|
|
||||||
|
|
||||||
Redis.current.publish('timeline:public', @payload)
|
|
||||||
Redis.current.publish('timeline:public:local', @payload) if status.local?
|
|
||||||
end
|
|
||||||
|
|
||||||
def deliver_to_media(status)
|
|
||||||
Rails.logger.debug "Delivering status #{status.id} to media timeline"
|
|
||||||
|
|
||||||
Redis.current.publish('timeline:public:media', @payload)
|
|
||||||
Redis.current.publish('timeline:public:local:media', @payload) if status.local?
|
|
||||||
end
|
|
||||||
|
|
||||||
def deliver_to_own_conversation(status)
|
def deliver_to_own_conversation(status)
|
||||||
AccountConversation.add_status(status.account, status)
|
AccountConversation.add_status(status.account, status)
|
||||||
end
|
end
|
||||||
|
@ -22,8 +22,6 @@ class RemoveStatusService < BaseService
|
|||||||
remove_from_affected
|
remove_from_affected
|
||||||
remove_reblogs
|
remove_reblogs
|
||||||
remove_from_hashtags
|
remove_from_hashtags
|
||||||
remove_from_public
|
|
||||||
remove_from_media if status.media_attachments.any?
|
|
||||||
|
|
||||||
@status.destroy!
|
@status.destroy!
|
||||||
else
|
else
|
||||||
@ -145,20 +143,6 @@ class RemoveStatusService < BaseService
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_from_public
|
|
||||||
return unless @status.public_visibility?
|
|
||||||
|
|
||||||
redis.publish('timeline:public', @payload)
|
|
||||||
redis.publish('timeline:public:local', @payload) if @status.local?
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove_from_media
|
|
||||||
return unless @status.public_visibility?
|
|
||||||
|
|
||||||
redis.publish('timeline:public:media', @payload)
|
|
||||||
redis.publish('timeline:public:local:media', @payload) if @status.local?
|
|
||||||
end
|
|
||||||
|
|
||||||
def lock_options
|
def lock_options
|
||||||
{ redis: Redis.current, key: "distribute:#{@status.id}" }
|
{ redis: Redis.current, key: "distribute:#{@status.id}" }
|
||||||
end
|
end
|
||||||
|
@ -267,10 +267,6 @@ const startWorker = (workerId) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const PUBLIC_STREAMS = [
|
const PUBLIC_STREAMS = [
|
||||||
'public',
|
|
||||||
'public:media',
|
|
||||||
'public:local',
|
|
||||||
'public:local:media',
|
|
||||||
'hashtag',
|
'hashtag',
|
||||||
'hashtag:local',
|
'hashtag:local',
|
||||||
];
|
];
|
||||||
@ -548,20 +544,6 @@ const startWorker = (workerId) => {
|
|||||||
streamFrom(`timeline:${req.accountId}`, req, streamToHttp(req, res), streamHttpEnd(req), false, true);
|
streamFrom(`timeline:${req.accountId}`, req, streamToHttp(req, res), streamHttpEnd(req), false, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/api/v1/streaming/public', (req, res) => {
|
|
||||||
const onlyMedia = req.query.only_media === '1' || req.query.only_media === 'true';
|
|
||||||
const channel = onlyMedia ? 'timeline:public:media' : 'timeline:public';
|
|
||||||
|
|
||||||
streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/api/v1/streaming/public/local', (req, res) => {
|
|
||||||
const onlyMedia = req.query.only_media === '1' || req.query.only_media === 'true';
|
|
||||||
const channel = onlyMedia ? 'timeline:public:local:media' : 'timeline:public:local';
|
|
||||||
|
|
||||||
streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req), true);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/api/v1/streaming/direct', (req, res) => {
|
app.get('/api/v1/streaming/direct', (req, res) => {
|
||||||
const channel = `timeline:direct:${req.accountId}`;
|
const channel = `timeline:direct:${req.accountId}`;
|
||||||
streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req, subscriptionHeartbeat(channel)), true);
|
streamFrom(channel, req, streamToHttp(req, res), streamHttpEnd(req, subscriptionHeartbeat(channel)), true);
|
||||||
@ -624,18 +606,6 @@ const startWorker = (workerId) => {
|
|||||||
case 'user:notification':
|
case 'user:notification':
|
||||||
streamFrom(`timeline:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(req, ws), false, true);
|
streamFrom(`timeline:${req.accountId}`, req, streamToWs(req, ws), streamWsEnd(req, ws), false, true);
|
||||||
break;
|
break;
|
||||||
case 'public':
|
|
||||||
streamFrom('timeline:public', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
|
|
||||||
break;
|
|
||||||
case 'public:local':
|
|
||||||
streamFrom('timeline:public:local', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
|
|
||||||
break;
|
|
||||||
case 'public:media':
|
|
||||||
streamFrom('timeline:public:media', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
|
|
||||||
break;
|
|
||||||
case 'public:local:media':
|
|
||||||
streamFrom('timeline:public:local:media', req, streamToWs(req, ws), streamWsEnd(req, ws), true);
|
|
||||||
break;
|
|
||||||
case 'direct':
|
case 'direct':
|
||||||
channel = `timeline:direct:${req.accountId}`;
|
channel = `timeline:direct:${req.accountId}`;
|
||||||
streamFrom(channel, req, streamToWs(req, ws), streamWsEnd(req, ws, subscriptionHeartbeat(channel)), true);
|
streamFrom(channel, req, streamToWs(req, ws), streamWsEnd(req, ws, subscriptionHeartbeat(channel)), true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user