[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:
Claire
2025-06-05 17:36:51 +02:00
parent 9a649a2072
commit af314a833d
3 changed files with 28 additions and 11 deletions

View File

@@ -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}

View File

@@ -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 (showStatus && regex) {
const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index');
showStatus = !regex.test(searchIndex);
if (columnSettings.getIn(['shows', 'direct']) === false && statusForId.get('visibility') === 'direct') {
return false;
}
return showStatus;
const searchIndex = statusForId.get('reblog') ? statuses.getIn([statusForId.get('reblog'), 'search_index']) : statusForId.get('search_index');
if (regex && !regex.test(searchIndex)) {
return false;
}
return true;
});
});

View File

@@ -20,6 +20,7 @@ const initialState = ImmutableMap({
home: ImmutableMap({
shows: ImmutableMap({
quote: true,
reblog: true,
reply: true,
direct: true,