nicolium: allow filtering self-reposts
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -312,6 +312,23 @@ const Preferences = () => {
|
||||
/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem
|
||||
label={
|
||||
<FormattedMessage
|
||||
id='home.column_settings.show_self_reblogs'
|
||||
defaultMessage='Show self-reposts in home timeline'
|
||||
/>
|
||||
}
|
||||
>
|
||||
<SettingToggle
|
||||
settings={settings}
|
||||
settingPath={['timelines', 'home', 'showSelfReblogs']}
|
||||
defaultValue
|
||||
onChange={onToggleChange}
|
||||
disabled={settings.timelines?.home?.showReblogs === false}
|
||||
/>
|
||||
</ListItem>
|
||||
|
||||
<ListItem
|
||||
label={
|
||||
<FormattedMessage
|
||||
|
||||
@ -1214,6 +1214,7 @@
|
||||
"home.column_settings.show_quotes": "Show quotes in home timeline",
|
||||
"home.column_settings.show_reblogs": "Show reposts in home timeline",
|
||||
"home.column_settings.show_replies": "Show replies in home timeline",
|
||||
"home.column_settings.show_self_reblogs": "Show self-reposts in home timeline",
|
||||
"icon_button.icons": "Icons",
|
||||
"icon_button.label": "Select icon",
|
||||
"import_data.actions.import": "Import",
|
||||
|
||||
@ -83,6 +83,7 @@ const settingsSchema = v.object({
|
||||
v.string(),
|
||||
coerceObject({
|
||||
showReblogs: v.optional(v.boolean(), true),
|
||||
showSelfReblogs: v.optional(v.boolean(), true),
|
||||
showReplies: v.optional(v.boolean(), true),
|
||||
showQuotes: v.optional(v.boolean(), true),
|
||||
showDirect: v.optional(v.boolean(), true),
|
||||
|
||||
@ -12,6 +12,7 @@ type TimelineEntry =
|
||||
id: string;
|
||||
// id of the topmost status where the target status was found, either the status itself or its reblog
|
||||
originalId: string;
|
||||
accountId: string;
|
||||
rebloggedBy: Array<string>;
|
||||
reblogIds: Array<string>;
|
||||
isConnectedTop?: boolean;
|
||||
@ -126,6 +127,7 @@ const processPage = (statuses: Array<Status>): Array<TimelineEntry> => {
|
||||
type: 'status',
|
||||
id: status.reblog.id,
|
||||
originalId: status.id,
|
||||
accountId: status.reblog.account.id,
|
||||
rebloggedBy: [status.account.id],
|
||||
reblogIds: [status.id],
|
||||
isConnectedTop,
|
||||
@ -143,6 +145,7 @@ const processPage = (statuses: Array<Status>): Array<TimelineEntry> => {
|
||||
type: 'status',
|
||||
id: status.id,
|
||||
originalId: status.id,
|
||||
accountId: status.account.id,
|
||||
rebloggedBy: [],
|
||||
reblogIds: [],
|
||||
isConnectedTop,
|
||||
@ -347,6 +350,7 @@ const useTimelinesStore = create<State>()(
|
||||
type: 'status',
|
||||
id: status.id,
|
||||
originalId: status.id,
|
||||
accountId: status.account.id,
|
||||
rebloggedBy: [],
|
||||
reblogIds: [],
|
||||
isReply: status.in_reply_to_id !== null,
|
||||
|
||||
@ -8,6 +8,10 @@ type StatusEntry = Extract<TimelineEntry, { type: 'status' }>;
|
||||
const isEntryFiltered = (entry: StatusEntry, filters: TimelineFilters): boolean =>
|
||||
(filters?.showDirect === false && entry.isDirect) ||
|
||||
(filters?.showReblogs === false && entry.isReblog) ||
|
||||
(filters?.showSelfReblogs === false &&
|
||||
entry.isReblog &&
|
||||
entry.rebloggedBy.length === 1 &&
|
||||
entry.rebloggedBy[0] === entry.accountId) ||
|
||||
(filters?.showReplies === false && entry.isReply) ||
|
||||
(filters?.showQuotes === false && entry.isQuote) ||
|
||||
(filters?.showNonMedia === false && !entry.hasMedia);
|
||||
|
||||
Reference in New Issue
Block a user