From 3a1a21ad5725bed7f82b516b4174272c1e931223 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Sat, 23 May 2020 12:46:29 +0900 Subject: Fix local streaming of hashtag timelines (#13827) --- app/javascript/mastodon/actions/streaming.js | 2 +- app/javascript/mastodon/actions/timelines.js | 2 +- .../mastodon/features/hashtag_timeline/index.js | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/mastodon/actions/streaming.js index 080d665f4..d998fcac4 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/mastodon/actions/streaming.js @@ -74,6 +74,6 @@ const refreshHomeTimelineAndNotification = (dispatch, done) => { export const connectUserStream = () => connectTimelineStream('home', 'user', refreshHomeTimelineAndNotification); export const connectCommunityStream = ({ onlyMedia } = {}) => connectTimelineStream(`community${onlyMedia ? ':media' : ''}`, `public:local${onlyMedia ? ':media' : ''}`); export const connectPublicStream = ({ onlyMedia, onlyRemote } = {}) => connectTimelineStream(`public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`, `public${onlyRemote ? ':remote' : ''}${onlyMedia ? ':media' : ''}`); -export const connectHashtagStream = (id, tag, accept) => connectTimelineStream(`hashtag:${id}`, `hashtag&tag=${tag}`, null, accept); +export const connectHashtagStream = (id, tag, local, accept) => connectTimelineStream(`hashtag:${id}${local ? ':local' : ''}`, `hashtag${local ? ':local' : ''}&tag=${tag}`, null, accept); export const connectDirectStream = () => connectTimelineStream('direct', 'direct'); export const connectListStream = id => connectTimelineStream(`list:${id}`, `list&list=${id}`); diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 01f0fb015..00a7a6789 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -114,7 +114,7 @@ export const expandAccountFeaturedTimeline = accountId => expandTimeline(`accoun export const expandAccountMediaTimeline = (accountId, { maxId } = {}) => expandTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { max_id: maxId, only_media: true, limit: 40 }); export const expandListTimeline = (id, { maxId } = {}, done = noOp) => expandTimeline(`list:${id}`, `/api/v1/timelines/list/${id}`, { max_id: maxId }, done); export const expandHashtagTimeline = (hashtag, { maxId, tags, local } = {}, done = noOp) => { - return expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`, { + return expandTimeline(`hashtag:${hashtag}${local ? ':local' : ''}`, `/api/v1/timelines/tag/${hashtag}`, { max_id: maxId, any: parseTags(tags, 'any'), all: parseTags(tags, 'all'), diff --git a/app/javascript/mastodon/features/hashtag_timeline/index.js b/app/javascript/mastodon/features/hashtag_timeline/index.js index 3e06e3652..5ccd9f8ea 100644 --- a/app/javascript/mastodon/features/hashtag_timeline/index.js +++ b/app/javascript/mastodon/features/hashtag_timeline/index.js @@ -12,7 +12,7 @@ import { connectHashtagStream } from '../../actions/streaming'; import { isEqual } from 'lodash'; const mapStateToProps = (state, props) => ({ - hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0, + hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}${props.params.local ? ':local' : ''}`, 'unread']) > 0, }); export default @connect(mapStateToProps) @@ -76,13 +76,13 @@ class HashtagTimeline extends React.PureComponent { this.column.scrollTop(); } - _subscribe (dispatch, id, tags = {}) { + _subscribe (dispatch, id, tags = {}, local) { let any = (tags.any || []).map(tag => tag.value); let all = (tags.all || []).map(tag => tag.value); let none = (tags.none || []).map(tag => tag.value); [id, ...any].map(tag => { - this.disconnects.push(dispatch(connectHashtagStream(id, tag, status => { + this.disconnects.push(dispatch(connectHashtagStream(id, tag, local, status => { let tags = status.tags.map(tag => tag.name); return all.filter(tag => tags.includes(tag)).length === all.length && @@ -100,7 +100,7 @@ class HashtagTimeline extends React.PureComponent { const { dispatch } = this.props; const { id, tags, local } = this.props.params; - this._subscribe(dispatch, id, tags); + this._subscribe(dispatch, id, tags, local); dispatch(expandHashtagTimeline(id, { tags, local })); } @@ -110,8 +110,8 @@ class HashtagTimeline extends React.PureComponent { if (id !== params.id || !isEqual(tags, params.tags) || !isEqual(local, params.local)) { this._unsubscribe(); - this._subscribe(dispatch, id, tags); - dispatch(clearTimeline(`hashtag:${id}`)); + this._subscribe(dispatch, id, tags, local); + dispatch(clearTimeline(`hashtag:${id}${local ? ':local' : ''}`)); dispatch(expandHashtagTimeline(id, { tags, local })); } } @@ -131,7 +131,7 @@ class HashtagTimeline extends React.PureComponent { render () { const { shouldUpdateScroll, hasUnread, columnId, multiColumn } = this.props; - const { id } = this.props.params; + const { id, local } = this.props.params; const pinned = !!columnId; return ( @@ -153,7 +153,7 @@ class HashtagTimeline extends React.PureComponent { } shouldUpdateScroll={shouldUpdateScroll} -- cgit From e6706d171a3406a40b597dc47fd2dca5b334f2e2 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Sat, 23 May 2020 12:47:25 +0900 Subject: Fix searchable status without explicitly mentioning it (#13829) --- app/chewy/statuses_index.rb | 2 +- app/models/status.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/chewy/statuses_index.rb b/app/chewy/statuses_index.rb index bec9ed88b..d4b05fca9 100644 --- a/app/chewy/statuses_index.rb +++ b/app/chewy/statuses_index.rb @@ -33,7 +33,7 @@ class StatusesIndex < Chewy::Index define_type ::Status.unscoped.kept.without_reblogs.includes(:media_attachments), delete_if: ->(status) { status.searchable_by.empty? } do crutch :mentions do |collection| - data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id) + data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local, silent: false).pluck(:status_id, :account_id) data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) } end diff --git a/app/models/status.rb b/app/models/status.rb index a1babf85e..71596ec2f 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -139,7 +139,7 @@ class Status < ApplicationRecord ids << account_id if local? if preloaded.nil? - ids += mentions.where(account: Account.local).pluck(:account_id) + ids += mentions.where(account: Account.local, silent: false).pluck(:account_id) ids += favourites.where(account: Account.local).pluck(:account_id) ids += reblogs.where(account: Account.local).pluck(:account_id) ids += bookmarks.where(account: Account.local).pluck(:account_id) -- cgit From 8e056bd82e6d838aa525ece7a2d3a1cbcee2bcfe Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Sun, 24 May 2020 16:15:23 +0900 Subject: Fix csv upload (#13835) --- app/models/import.rb | 2 +- config/initializers/paperclip.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/import.rb b/app/models/import.rb index a7a0d8065..c78a04d07 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -17,7 +17,7 @@ # class Import < ApplicationRecord - FILE_TYPES = %w(text/plain text/csv).freeze + FILE_TYPES = %w(text/plain text/csv application/csv).freeze MODES = %i(merge overwrite).freeze self.inheritance_column = false diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 0dd7f8cf8..ebb009065 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -111,3 +111,5 @@ else url: ENV.fetch('PAPERCLIP_ROOT_URL', '/system') + '/:prefix_url:class/:attachment/:id_partition/:style/:filename', ) end + +Paperclip.options[:content_type_mappings] = { csv: Import::FILE_TYPES } -- cgit From 40d81620b00f6c4ed30b78f95b443a08e62ae8fa Mon Sep 17 00:00:00 2001 From: Mélanie Chauvel Date: Mon, 25 May 2020 12:30:34 +0200 Subject: Change wording from “Hide media” to “Hide image/images” in Web UI (#13834) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/components/media_gallery.js | 5 +++-- app/javascript/mastodon/locales/bg.json | 2 +- app/javascript/mastodon/locales/br.json | 2 +- app/javascript/mastodon/locales/defaultMessages.json | 4 ++-- app/javascript/mastodon/locales/en.json | 2 +- app/javascript/mastodon/locales/ga.json | 2 +- app/javascript/mastodon/locales/hi.json | 2 +- app/javascript/mastodon/locales/kn.json | 2 +- app/javascript/mastodon/locales/lt.json | 2 +- app/javascript/mastodon/locales/lv.json | 2 +- app/javascript/mastodon/locales/mk.json | 2 +- app/javascript/mastodon/locales/ml.json | 2 +- app/javascript/mastodon/locales/mr.json | 2 +- app/javascript/mastodon/locales/ms.json | 2 +- app/javascript/mastodon/locales/ur.json | 2 +- 15 files changed, 18 insertions(+), 17 deletions(-) (limited to 'app') diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js index 283d7e0a5..a31de206b 100644 --- a/app/javascript/mastodon/components/media_gallery.js +++ b/app/javascript/mastodon/components/media_gallery.js @@ -10,7 +10,8 @@ import { autoPlayGif, cropImages, displayMedia, useBlurhash } from '../initial_s import { decode } from 'blurhash'; const messages = defineMessages({ - toggle_visible: { id: 'media_gallery.toggle_visible', defaultMessage: 'Hide media' }, + toggle_visible: { id: 'media_gallery.toggle_visible', + defaultMessage: 'Hide {number, plural, one {image} other {images}}' }, }); class Item extends React.PureComponent { @@ -338,7 +339,7 @@ class MediaGallery extends React.PureComponent { ); } else if (visible) { - spoilerButton = ; + spoilerButton = ; } else { spoilerButton = ( ); } else if (visible) { - spoilerButton = ; + spoilerButton = ; } else { spoilerButton = (