mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 00:08:46 +00:00
[Glitch] Add ability to filter quote posts in home timeline
Port 520974e052 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -51,6 +51,19 @@ export const ColumnSettings: React.FC = () => {
|
||||
}
|
||||
/>
|
||||
|
||||
<SettingToggle
|
||||
prefix='home_timeline'
|
||||
settings={settings}
|
||||
settingPath={['shows', 'quote']}
|
||||
onChange={onChange}
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='home.column_settings.show_quotes'
|
||||
defaultMessage='Show quotes'
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<SettingToggle
|
||||
prefix='home_timeline'
|
||||
settings={settings}
|
||||
|
||||
@@ -31,28 +31,31 @@ const makeGetStatusIds = (pending = false) => createSelector([
|
||||
if (id === null || id === 'inline-follow-suggestions') return true;
|
||||
|
||||
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;
|
||||
if (columnSettings.getIn(['shows', 'reblog']) === false && statusForId.get('reblog') !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (columnSettings.getIn(['shows', 'reply']) === false) {
|
||||
showStatus = showStatus && (statusForId.get('in_reply_to_id') === null || statusForId.get('in_reply_to_account_id') === me);
|
||||
if (columnSettings.getIn(['shows', 'reply']) === false && statusForId.get('in_reply_to_id') !== null && statusForId.get('in_reply_to_account_id') !== me) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (columnSettings.getIn(['shows', 'direct']) === false) {
|
||||
showStatus = showStatus && statusForId.get('visibility') !== 'direct';
|
||||
if (columnSettings.getIn(['shows', 'quote']) === false && statusForId.get('quote') !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (columnSettings.getIn(['shows', 'direct']) === false && statusForId.get('visibility') === 'direct') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (showStatus && regex) {
|
||||
const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index');
|
||||
showStatus = !regex.test(searchIndex);
|
||||
if (regex && !regex.test(searchIndex)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return showStatus;
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ const initialState = ImmutableMap({
|
||||
|
||||
home: ImmutableMap({
|
||||
shows: ImmutableMap({
|
||||
quote: true,
|
||||
reblog: true,
|
||||
reply: true,
|
||||
direct: true,
|
||||
|
||||
Reference in New Issue
Block a user