From 1e2977256cead2a12189687c568daf7b55830561 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 28 Apr 2019 03:03:29 -0500 Subject: Allow own roars to be included in lists. --- app/javascript/flavours/glitch/actions/lists.js | 4 ++-- .../flavours/glitch/features/list_timeline/index.js | 20 ++++++++++++++++++++ app/javascript/mastodon/locales/en.json | 1 + 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/flavours/glitch/actions/lists.js b/app/javascript/flavours/glitch/actions/lists.js index c2309b8c2..30ec6442d 100644 --- a/app/javascript/flavours/glitch/actions/lists.js +++ b/app/javascript/flavours/glitch/actions/lists.js @@ -150,10 +150,10 @@ export const createListFail = error => ({ error, }); -export const updateList = (id, title, shouldReset, replies_policy) => (dispatch, getState) => { +export const updateList = (id, title, shouldReset, replies_policy, show_self) => (dispatch, getState) => { dispatch(updateListRequest(id)); - api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy }).then(({ data }) => { + api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy, show_self }).then(({ data }) => { dispatch(updateListSuccess(data)); if (shouldReset) { diff --git a/app/javascript/flavours/glitch/features/list_timeline/index.js b/app/javascript/flavours/glitch/features/list_timeline/index.js index ef829b937..c634417ce 100644 --- a/app/javascript/flavours/glitch/features/list_timeline/index.js +++ b/app/javascript/flavours/glitch/features/list_timeline/index.js @@ -13,10 +13,12 @@ import { fetchList, deleteList, updateList } from 'flavours/glitch/actions/lists import { openModal } from 'flavours/glitch/actions/modal'; import MissingIndicator from 'flavours/glitch/components/missing_indicator'; import LoadingIndicator from 'flavours/glitch/components/loading_indicator'; +import Toggle from 'react-toggle'; const messages = defineMessages({ deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' }, deleteConfirm: { id: 'confirmations.delete_list.confirm', defaultMessage: 'Delete' }, + show_self: { id: 'lists.show_self', defaultMessage: 'Include your own toots' }, all_replies: { id: 'lists.replies_policy.all_replies', defaultMessage: 'any followed user' }, no_replies: { id: 'lists.replies_policy.no_replies', defaultMessage: 'no one' }, list_replies: { id: 'lists.replies_policy.list_replies', defaultMessage: 'members of the list' }, @@ -114,6 +116,14 @@ export default class ListTimeline extends React.PureComponent { })); } + handleShowSelfChange = ({ target }) => { + const { dispatch, list } = this.props; + const { id } = this.props.params; + const replies_policy = list ? list.get('replies_policy') : undefined; + const show_self = list ? list.get('show_self') : false; + this.props.dispatch(updateList(id, undefined, false, replies_policy, !show_self)); + } + handleRepliesPolicyChange = ({ target }) => { const { dispatch, list } = this.props; const { id } = this.props.params; @@ -126,6 +136,7 @@ export default class ListTimeline extends React.PureComponent { const pinned = !!columnId; const title = list ? list.get('title') : id; const replies_policy = list ? list.get('replies_policy') : undefined; + const show_self = list ? list.get('show_self') : false; if (typeof list === 'undefined') { return ( @@ -167,6 +178,15 @@ export default class ListTimeline extends React.PureComponent { +
+
+ + +
+
+ { replies_policy !== undefined && (
diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 9417a745d..3c628c869 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -226,6 +226,7 @@ "lists.new.title_placeholder": "New list title", "lists.search": "Search among monsters in your pack", "lists.subheading": "Your lists", + "lists.show_self": "Include your own roars", "loading_indicator.label": "Loading...", "media_gallery.toggle_visible": "Toggle visibility", "missing_indicator.label": "Not found", -- cgit