this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Preliminary support for exclusive list

Only for Mastodon v4.2+

+32 -2
+24
src/components/list-add-edit.jsx
··· 1 1 import { useEffect, useRef, useState } from 'preact/hooks'; 2 2 3 3 import { api } from '../utils/api'; 4 + import supports from '../utils/supports'; 4 5 5 6 import Icon from './icon'; 6 7 import MenuConfirm from './menu-confirm'; ··· 11 12 const editMode = !!list; 12 13 const nameFieldRef = useRef(); 13 14 const repliesPolicyFieldRef = useRef(); 15 + const exclusiveFieldRef = useRef(); 14 16 useEffect(() => { 15 17 if (editMode) { 16 18 nameFieldRef.current.value = list.title; 17 19 repliesPolicyFieldRef.current.value = list.repliesPolicy; 20 + if (exclusiveFieldRef.current) { 21 + exclusiveFieldRef.current.checked = list.exclusive; 22 + } 18 23 } 19 24 }, [editMode]); 25 + const supportsExclusive = supports('@mastodon/list-exclusive'); 26 + 20 27 return ( 21 28 <div class="sheet"> 22 29 {!!onClose && ( ··· 36 43 const formData = new FormData(e.target); 37 44 const title = formData.get('title'); 38 45 const repliesPolicy = formData.get('replies_policy'); 46 + const exclusive = formData.get('exclusive') === 'on'; 39 47 console.log({ 40 48 title, 41 49 repliesPolicy, 50 + exclusive, 42 51 }); 43 52 setUiState('loading'); 44 53 ··· 50 59 listResult = await masto.v1.lists.update(list.id, { 51 60 title, 52 61 replies_policy: repliesPolicy, 62 + exclusive, 53 63 }); 54 64 } else { 55 65 listResult = await masto.v1.lists.create({ 56 66 title, 57 67 replies_policy: repliesPolicy, 68 + exclusive, 58 69 }); 59 70 } 60 71 ··· 99 110 <option value="none">Don't show replies</option> 100 111 </select> 101 112 </div> 113 + {supportsExclusive && ( 114 + <div class="list-form-row"> 115 + <label class="label-block"> 116 + <input 117 + ref={exclusiveFieldRef} 118 + type="checkbox" 119 + name="exclusive" 120 + disabled={uiState === 'loading'} 121 + />{' '} 122 + Hide posts on this list from Home/Following 123 + </label> 124 + </div> 125 + )} 102 126 <div class="list-form-footer"> 103 127 <button type="submit" disabled={uiState === 'loading'}> 104 128 {editMode ? 'Save' : 'Create'}
+2 -1
src/data/features.json
··· 1 1 { 2 - "@mastodon/edit-media-attributes": ">=4.1" 2 + "@mastodon/edit-media-attributes": ">=4.1", 3 + "@mastodon/list-exclusive": ">=4.2" 3 4 }
+6 -1
src/pages/lists.css
··· 5 5 flex-direction: column; 6 6 } 7 7 8 - .list-form-row :is(input, select) { 8 + .list-form-row :is(input[type='text'], select) { 9 9 width: 100%; 10 + } 11 + 12 + .list-form-row .label-block { 13 + display: block; 14 + padding: 8px 0; 10 15 } 11 16 12 17 .list-form-footer {