Skip to content

Commit

Permalink
ホームタイムラインでPublic, Unlisted, Private, Sensitive投稿のフィルタもできるように
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Mar 13, 2023
1 parent b1905a4 commit 686091e
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,26 @@ class ColumnSettings extends React.PureComponent {
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'reply']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_replies' defaultMessage='Show replies' />} />
</div>

<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'public']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_public' defaultMessage='Show Public' />} />
</div>

<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'unlisted']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_unlisted' defaultMessage='Show Unlisted' />} />
</div>

<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'private']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_private' defaultMessage='Show Private' />} />
</div>

<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'direct']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_direct' defaultMessage='Show DMs' />} />
</div>

<div className='column-settings__row'>
<SettingToggle prefix='home_timeline' settings={settings} settingPath={['shows', 'sensitive']} onChange={onChange} label={<FormattedMessage id='home.column_settings.show_sensitive' defaultMessage='Show Sensitive' />} />
</div>

<span className='column-settings__section'><FormattedMessage id='home.column_settings.advanced' defaultMessage='Advanced' /></span>

<div className='column-settings__row'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const makeGetStatusIds = (pending = false) => createSelector([
const statusForId = statuses.get(id);
let showStatus = true;

if (statusForId.get('account') === me) return true;

if (columnSettings.getIn(['shows', 'reblog']) === false) {
showStatus = showStatus && statusForId.get('reblog') === null;
}
Expand All @@ -47,6 +45,22 @@ const makeGetStatusIds = (pending = false) => createSelector([
showStatus = showStatus && statusForId.get('visibility') !== 'direct';
}

if (columnSettings.getIn(['shows', 'public']) === false) {
showStatus = showStatus && statusForId.get('visibility') !== 'public';
}

if (columnSettings.getIn(['shows', 'unlisted']) === false) {
showStatus = showStatus && statusForId.get('visibility') !== 'unlisted';
}

if (columnSettings.getIn(['shows', 'private']) === false) {
showStatus = showStatus && statusForId.get('visibility') !== 'private';
}

if (columnSettings.getIn(['shows', 'sensitive']) === false) {
showStatus = showStatus && statusForId.get('sensitive') !== true;
}

if (showStatus && regex) {
const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index');
showStatus = !regex.test(searchIndex);
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const messages = {
'favourite_modal.combo': 'You can press {combo} to skip this next time',

'home.column_settings.show_direct': 'Show DMs',
'home.column_settings.show_public': 'Show Public',
'home.column_settings.show_unlisted': 'Show Unlisted',
'home.column_settings.show_private': 'Show Private',
'home.column_settings.show_sensitive': 'Show Sensitive',

'notification.markForDeletion': 'Mark for deletion',
'notifications.clear': 'Clear all my notifications',
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/locales/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const messages = {
'favourite_modal.combo': '次からは {combo} を押せば、これをスキップできます。',

'home.column_settings.show_direct': 'DMを表示',
'home.column_settings.show_public': '公開を表示',
'home.column_settings.show_unlisted': '未収載を表示',
'home.column_settings.show_private': 'フォロワー限定を表示',
'home.column_settings.show_sensitive': 'センシティブな投稿を表示',
'home.column_settings.advanced': '高度',
'home.column_settings.filter_regex': '正規表現でフィルター',

Expand Down
4 changes: 4 additions & 0 deletions app/javascript/flavours/glitch/reducers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ const initialState = ImmutableMap({
shows: ImmutableMap({
reblog: true,
reply: true,
public: true,
unlisted: true,
private: true,
direct: true,
sensitive: true,
}),

regex: ImmutableMap({
Expand Down

0 comments on commit 686091e

Please sign in to comment.