From 8721fb57fc3ee169ba401ce498280b8d7257297d Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Sat, 21 Sep 2019 16:24:47 +0300 Subject: added support hide\show reblogs from a specific user --- src/components/user_card/user_card.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 0b83cf16..029406e7 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -186,6 +186,22 @@ > + +
-- cgit v1.2.3-70-g09d2 From f0b9f5d29ca7bbac21cabad3d5f14328dfbf56dd Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Sun, 22 Sep 2019 14:39:28 +0300 Subject: use `repeats` intead `boosts` --- src/components/user_card/user_card.js | 4 ++-- src/components/user_card/user_card.vue | 8 ++++---- src/i18n/en.json | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 03f15d8e..8b8ae132 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -110,10 +110,10 @@ export default { ProgressButton }, methods: { - showReblogs () { + showRepeats () { this.$store.dispatch('showReblogs', this.user.id) }, - hideReblogs () { + hideRepeats () { this.$store.dispatch('hideReblogs', this.user.id) }, followUser () { diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 029406e7..acef1d72 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -189,16 +189,16 @@ diff --git a/src/i18n/en.json b/src/i18n/en.json index c20f880a..426a2f6a 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -543,8 +543,8 @@ "unmute": "Unmute", "unmute_progress": "Unmuting...", "mute_progress": "Muting...", - "hide_boosts": "Hide boosts from {user}", - "show_boosts": "Show boosts from {user}", + "hide_repeats": "Hide repeats", + "show_repeats": "Show repeats", "admin_menu": { "moderation": "Moderation", "grant_admin": "Grant Admin", -- cgit v1.2.3-70-g09d2 From 979e170bd6880d0ee85bf0dd8898cf53d91055b5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 29 Sep 2019 22:33:15 +0300 Subject: created mergedConfig getter to avoid obnoxious checks for undefined everywhere --- src/components/favorite_button/favorite_button.js | 8 ++-- src/components/favorite_button/favorite_button.vue | 4 +- .../post_status_form/post_status_form.js | 25 ++++-------- src/components/retweet_button/retweet_button.js | 8 ++-- src/components/retweet_button/retweet_button.vue | 4 +- src/components/status/status.js | 46 +++++++++------------- src/components/user_card/user_card.js | 10 ++--- src/components/user_card/user_card.vue | 4 +- src/modules/config.js | 19 +++++++++ 9 files changed, 64 insertions(+), 64 deletions(-) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js index a24eacbf..5014d84f 100644 --- a/src/components/favorite_button/favorite_button.js +++ b/src/components/favorite_button/favorite_button.js @@ -1,10 +1,9 @@ +import { mapGetters } from 'vuex' + const FavoriteButton = { props: ['status', 'loggedIn'], data () { return { - hidePostStatsLocal: typeof this.$store.state.config.hidePostStats === 'undefined' - ? this.$store.state.instance.hidePostStats - : this.$store.state.config.hidePostStats, animated: false } }, @@ -28,7 +27,8 @@ const FavoriteButton = { 'icon-star': this.status.favorited, 'animate-spin': this.animated } - } + }, + ...mapGetters(['mergedConfig']) } } diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue index 06ce9983..fbc90f84 100644 --- a/src/components/favorite_button/favorite_button.vue +++ b/src/components/favorite_button/favorite_button.vue @@ -6,7 +6,7 @@ :title="$t('tool_tip.favorite')" @click.prevent="favorite()" /> - {{ status.fave_num }} + {{ status.fave_num }}
- {{ status.fave_num }} + {{ status.fave_num }}
diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 9b2a9c90..46afc79c 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -7,6 +7,7 @@ import fileTypeService from '../../services/file_type/file_type.service.js' import { findOffset } from '../../services/offset_finder/offset_finder.service.js' import { reject, map, uniqBy } from 'lodash' import suggestor from '../emoji_input/suggestor.js' +import { mapGetters } from 'vuex' const buildMentionsString = ({ user, attentions = [] }, currentUser) => { let allAttentions = [...attentions] @@ -50,9 +51,7 @@ const PostStatusForm = { const preset = this.$route.query.message let statusText = preset || '' - const scopeCopy = typeof this.$store.state.config.scopeCopy === 'undefined' - ? this.$store.state.instance.scopeCopy - : this.$store.state.config.scopeCopy + const { scopeCopy } = this.$store.getters.mergedConfig if (this.replyTo) { const currentUser = this.$store.state.users.currentUser @@ -63,9 +62,7 @@ const PostStatusForm = { ? this.copyMessageScope : this.$store.state.users.currentUser.default_scope - const contentType = typeof this.$store.state.config.postContentType === 'undefined' - ? this.$store.state.instance.postContentType - : this.$store.state.config.postContentType + const { postContentType: contentType } = this.$store.getters.mergedConfig return { dropFiles: [], @@ -94,10 +91,7 @@ const PostStatusForm = { return this.$store.state.users.currentUser.default_scope }, showAllScopes () { - const minimalScopesMode = typeof this.$store.state.config.minimalScopesMode === 'undefined' - ? this.$store.state.instance.minimalScopesMode - : this.$store.state.config.minimalScopesMode - return !minimalScopesMode + return this.mergedConfig.minimalScopesMode }, emojiUserSuggestor () { return suggestor({ @@ -145,13 +139,7 @@ const PostStatusForm = { return this.$store.state.instance.minimalScopesMode }, alwaysShowSubject () { - if (typeof this.$store.state.config.alwaysShowSubjectInput !== 'undefined') { - return this.$store.state.config.alwaysShowSubjectInput - } else if (typeof this.$store.state.instance.alwaysShowSubjectInput !== 'undefined') { - return this.$store.state.instance.alwaysShowSubjectInput - } else { - return true - } + return this.mergedConfig.alwaysShowSubjectInput }, postFormats () { return this.$store.state.instance.postFormats || [] @@ -170,7 +158,8 @@ const PostStatusForm = { return this.pollFormVisible && this.newStatus.poll && this.newStatus.poll.error - } + }, + ...mapGetters(['mergedConfig']) }, methods: { postStatus (newStatus) { diff --git a/src/components/retweet_button/retweet_button.js b/src/components/retweet_button/retweet_button.js index fb543a9c..d9a0f92e 100644 --- a/src/components/retweet_button/retweet_button.js +++ b/src/components/retweet_button/retweet_button.js @@ -1,10 +1,9 @@ +import { mapGetters } from 'vuex' + const RetweetButton = { props: ['status', 'loggedIn', 'visibility'], data () { return { - hidePostStatsLocal: typeof this.$store.state.config.hidePostStats === 'undefined' - ? this.$store.state.instance.hidePostStats - : this.$store.state.config.hidePostStats, animated: false } }, @@ -28,7 +27,8 @@ const RetweetButton = { 'retweeted-empty': !this.status.repeated, 'animate-spin': this.animated } - } + }, + ...mapGetters(['mergedConfig']) } } diff --git a/src/components/retweet_button/retweet_button.vue b/src/components/retweet_button/retweet_button.vue index d58a7f8c..074f7747 100644 --- a/src/components/retweet_button/retweet_button.vue +++ b/src/components/retweet_button/retweet_button.vue @@ -7,7 +7,7 @@ :title="$t('tool_tip.repeat')" @click.prevent="retweet()" /> - {{ status.repeat_num }} + {{ status.repeat_num }} diff --git a/src/components/status/status.js b/src/components/status/status.js index d17ba318..976fd320 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -15,6 +15,7 @@ import fileType from 'src/services/file_type/file_type.service' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' import { mentionMatchesUrl, extractTagFromUrl } from 'src/services/matcher/matcher.service.js' import { filter, find, unescape, uniqBy } from 'lodash' +import { mapGetters } from 'vuex' const Status = { name: 'Status', @@ -42,20 +43,16 @@ const Status = { showingTall: this.inConversation && this.focused, showingLongSubject: false, error: null, - expandingSubject: typeof this.$store.state.config.collapseMessageWithSubject === 'undefined' - ? !this.$store.state.instance.collapseMessageWithSubject - : !this.$store.state.config.collapseMessageWithSubject, + expandingSubject: this.$store.getters.mergedConfig.collapseMessageWithSubject, betterShadow: this.$store.state.interface.browserSupport.cssFilter } }, computed: { localCollapseSubjectDefault () { - return typeof this.$store.state.config.collapseMessageWithSubject === 'undefined' - ? this.$store.state.instance.collapseMessageWithSubject - : this.$store.state.config.collapseMessageWithSubject + return this.mergedConfig.collapseMessageWithSubject }, muteWords () { - return this.$store.state.config.muteWords + return this.mergedConfig.muteWords }, repeaterClass () { const user = this.statusoid.user @@ -70,18 +67,18 @@ const Status = { }, repeaterStyle () { const user = this.statusoid.user - const highlight = this.$store.state.config.highlight + const highlight = this.mergedConfig.highlight return highlightStyle(highlight[user.screen_name]) }, userStyle () { if (this.noHeading) return const user = this.retweet ? (this.statusoid.retweeted_status.user) : this.statusoid.user - const highlight = this.$store.state.config.highlight + const highlight = this.mergedConfig.highlight return highlightStyle(highlight[user.screen_name]) }, hideAttachments () { - return (this.$store.state.config.hideAttachments && !this.inConversation) || - (this.$store.state.config.hideAttachmentsInConv && this.inConversation) + return (this.mergedConfig.hideAttachments && !this.inConversation) || + (this.mergedConfig.hideAttachmentsInConv && this.inConversation) }, userProfileLink () { return this.generateUserProfileLink(this.status.user.id, this.status.user.screen_name) @@ -120,9 +117,7 @@ const Status = { }, muted () { return !this.unmuted && ((!this.inProfile && this.status.user.muted) || (!this.inConversation && this.status.thread_muted) || this.muteWordHits.length > 0) }, hideFilteredStatuses () { - return typeof this.$store.state.config.hideFilteredStatuses === 'undefined' - ? this.$store.state.instance.hideFilteredStatuses - : this.$store.state.config.hideFilteredStatuses + return this.mergedConfig.hideFilteredStatuses }, hideStatus () { return (this.hideReply || this.deleted) || (this.muted && this.hideFilteredStatuses) @@ -163,7 +158,7 @@ const Status = { } }, hideReply () { - if (this.$store.state.config.replyVisibility === 'all') { + if (this.mergedConfig.replyVisibility === 'all') { return false } if (this.inConversation || !this.isReply) { @@ -175,7 +170,7 @@ const Status = { if (this.status.type === 'retweet') { return false } - const checkFollowing = this.$store.state.config.replyVisibility === 'following' + const checkFollowing = this.mergedConfig.replyVisibility === 'following' for (var i = 0; i < this.status.attentions.length; ++i) { if (this.status.user.id === this.status.attentions[i].id) { continue @@ -220,9 +215,7 @@ const Status = { replySubject () { if (!this.status.summary) return '' const decodedSummary = unescape(this.status.summary) - const behavior = typeof this.$store.state.config.subjectLineBehavior === 'undefined' - ? this.$store.state.instance.subjectLineBehavior - : this.$store.state.config.subjectLineBehavior + const behavior = this.mergedConfig.subjectLineBehavior const startsWithRe = decodedSummary.match(/^re[: ]/i) if ((behavior !== 'noop' && startsWithRe) || behavior === 'masto') { return decodedSummary @@ -233,8 +226,8 @@ const Status = { } }, attachmentSize () { - if ((this.$store.state.config.hideAttachments && !this.inConversation) || - (this.$store.state.config.hideAttachmentsInConv && this.inConversation) || + if ((this.mergedConfig.hideAttachments && !this.inConversation) || + (this.mergedConfig.hideAttachmentsInConv && this.inConversation) || (this.status.attachments.length > this.maxThumbnails)) { return 'hide' } else if (this.compact) { @@ -246,7 +239,7 @@ const Status = { if (this.attachmentSize === 'hide') { return [] } - return this.$store.state.config.playVideosInModal + return this.mergedConfig.playVideosInModal ? ['image', 'video'] : ['image'] }, @@ -261,7 +254,7 @@ const Status = { ) }, maxThumbnails () { - return this.$store.state.config.maxThumbnails + return this.mergedConfig.maxThumbnails }, contentHtml () { if (!this.status.summary_html) { @@ -284,10 +277,9 @@ const Status = { return this.status.tags.filter(tagObj => tagObj.hasOwnProperty('name')).map(tagObj => tagObj.name).join(' ') }, hidePostStats () { - return typeof this.$store.state.config.hidePostStats === 'undefined' - ? this.$store.state.instance.hidePostStats - : this.$store.state.config.hidePostStats - } + return this.mergedConfig.hidePostStats + }, + ...mapGetters(['mergedConfig']) }, components: { Attachment, diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 9c931c01..12f9f9e8 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -5,15 +5,13 @@ import ModerationTools from '../moderation_tools/moderation_tools.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' +import { mapGetters } from 'vuex' export default { props: [ 'user', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar' ], data () { return { followRequestInProgress: false, - hideUserStatsLocal: typeof this.$store.state.config.hideUserStats === 'undefined' - ? this.$store.state.instance.hideUserStats - : this.$store.state.config.hideUserStats, betterShadow: this.$store.state.interface.browserSupport.cssFilter } }, @@ -73,7 +71,8 @@ export default { } else { this.$store.dispatch('setHighlight', { user: this.user.screen_name, color: undefined }) } - } + }, + ...mapGetters(['mergedConfig']) }, userHighlightColor: { get () { @@ -90,7 +89,8 @@ export default { const validRole = rights.admin || rights.moderator const roleTitle = rights.admin ? 'admin' : 'moderator' return validRole && roleTitle - } + }, + ...mapGetters(['mergedConfig']) }, components: { UserAvatar, diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 5b6f66e7..6bcc3aac 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -81,7 +81,7 @@ >{{ visibleRole }} {{ dailyAvg }} {{ $t('user_card.per_day') }} @@ -262,7 +262,7 @@ class="panel-body" >
value === undefined) + .map(([key, value]) => key) + const config = { state: defaultState, + getters: { + mergedConfig (state, getters, rootState, rootGetters) { + const { instance } = rootState + return { + ...state, + ...instanceDefaultProperties + .map(key => [key, state[key] === undefined + ? instance[key] + : state[key] + ]) + .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}) + } + } + }, mutations: { setOption (state, { name, value }) { set(state, name, value) -- cgit v1.2.3-70-g09d2 From 188b6f56ed2f983d8f0fba4dc8f7327ebbee321d Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Mon, 30 Sep 2019 20:34:51 +0300 Subject: added acccount_actions component --- src/components/account_actions/account_actions.js | 59 +++++++++ src/components/account_actions/account_actions.vue | 133 ++++++++++++++++++++ src/components/follow_button/follow_button.js | 58 +++++++++ src/components/follow_button/follow_button.vue | 13 ++ src/components/user_card/user_card.js | 48 +------- src/components/user_card/user_card.vue | 135 +-------------------- 6 files changed, 268 insertions(+), 178 deletions(-) create mode 100644 src/components/account_actions/account_actions.js create mode 100644 src/components/account_actions/account_actions.vue create mode 100644 src/components/follow_button/follow_button.js create mode 100644 src/components/follow_button/follow_button.vue (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js new file mode 100644 index 00000000..1092a96a --- /dev/null +++ b/src/components/account_actions/account_actions.js @@ -0,0 +1,59 @@ +import FollowButton from '../follow_button/follow_button.vue' +import ProgressButton from '../progress_button/progress_button.vue' + +const AccountActions = { + props: [ + 'user' + ], + data () { + return { + showDropDown: false + } + }, + components: { + FollowButton, + ProgressButton + }, + computed: { + tagsSet () { + return new Set(this.user.tags) + }, + hasTagPolicy () { + return this.$store.state.instance.tagPolicyAvailable + } + }, + methods: { + subscribeUser () { + return this.$store.dispatch('subscribeUser', this.user.id) + }, + unsubscribeUser () { + return this.$store.dispatch('unsubscribeUser', this.user.id) + }, + showRepeats () { + this.$store.dispatch('showReblogs', this.user.id) + }, + hideRepeats () { + this.$store.dispatch('hideReblogs', this.user.id) + }, + muteUser () { + this.$store.dispatch('muteUser', this.user.id) + }, + unmuteUser () { + this.$store.dispatch('unmuteUser', this.user.id) + }, + blockUser () { + this.$store.dispatch('blockUser', this.user.id) + }, + unblockUser () { + this.$store.dispatch('unblockUser', this.user.id) + }, + reportUser () { + this.$store.dispatch('openUserReportingModal', this.user.id) + }, + mentionUser () { + this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) + } + } +} + +export default AccountActions diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue new file mode 100644 index 00000000..ce508b0a --- /dev/null +++ b/src/components/account_actions/account_actions.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js new file mode 100644 index 00000000..9d2834ab --- /dev/null +++ b/src/components/follow_button/follow_button.js @@ -0,0 +1,58 @@ +import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' +export default { + props: ['user'], + data () { + return { + inProgress: false + } + }, + computed: { + isPressed () { + return this.inProgress || this.user.following + }, + title () { + if (this.inProgress || this.user.following) { + return 'user_card.follow_unfollow' + } else if (this.user.requested) { + return 'user_card.follow_again' + } else { + return '' + } + }, + label () { + if (this.inProgress) { + return 'user_card.follow_progress' + } else if (this.user.following) { + return 'user_card.following' + } else if (this.user.requested) { + return 'user_card.follow_sent' + } else { + return 'user_card.follow' + } + } + }, + methods: { + doClick () { + if (this.user.following) { + this.unfollowUser() + } else { + this.followUser() + } + }, + followUser () { + const store = this.$store + this.inProgress = true + requestFollow(this.user, store).then(() => { + this.inProgress = false + }) + }, + unfollowUser () { + const store = this.$store + this.inProgress = true + requestUnfollow(this.user, store).then(() => { + this.inProgress = false + store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) + }) + } + } +} diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue new file mode 100644 index 00000000..61aa75a0 --- /dev/null +++ b/src/components/follow_button/follow_button.vue @@ -0,0 +1,13 @@ + + + diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 015a5762..c09e5654 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -2,8 +2,8 @@ import UserAvatar from '../user_avatar/user_avatar.vue' import RemoteFollow from '../remote_follow/remote_follow.vue' import ProgressButton from '../progress_button/progress_button.vue' import ModerationTools from '../moderation_tools/moderation_tools.vue' +import AccountActions from '../account_actions/account_actions.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' -import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' export default { @@ -98,48 +98,10 @@ export default { UserAvatar, RemoteFollow, ModerationTools, + AccountActions, ProgressButton }, methods: { - showRepeats () { - this.$store.dispatch('showReblogs', this.user.id) - }, - hideRepeats () { - this.$store.dispatch('hideReblogs', this.user.id) - }, - followUser () { - const store = this.$store - this.followRequestInProgress = true - requestFollow(this.user, store).then(() => { - this.followRequestInProgress = false - }) - }, - unfollowUser () { - const store = this.$store - this.followRequestInProgress = true - requestUnfollow(this.user, store).then(() => { - this.followRequestInProgress = false - store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) - }) - }, - blockUser () { - this.$store.dispatch('blockUser', this.user.id) - }, - unblockUser () { - this.$store.dispatch('unblockUser', this.user.id) - }, - muteUser () { - this.$store.dispatch('muteUser', this.user.id) - }, - unmuteUser () { - this.$store.dispatch('unmuteUser', this.user.id) - }, - subscribeUser () { - return this.$store.dispatch('subscribeUser', this.user.id) - }, - unsubscribeUser () { - return this.$store.dispatch('unsubscribeUser', this.user.id) - }, setProfileView (v) { if (this.switcher) { const store = this.$store @@ -160,9 +122,6 @@ export default { this.$store.state.instance.restrictedNicknames ) }, - reportUser () { - this.$store.dispatch('openUserReportingModal', this.user.id) - }, zoomAvatar () { const attachment = { url: this.user.profile_image_url_original, @@ -170,9 +129,6 @@ export default { } this.$store.dispatch('setMedia', [attachment]) this.$store.dispatch('setCurrent', attachment) - }, - mentionUser () { - this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index f465467c..abaef85f 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -131,135 +131,12 @@
+
-
- -
-
- -
-
- - - - - - - - - -
- -
- -
- -
- - -
- -
- - -
- -
- -
- + * { - flex: 1 0 0; - margin: 0 .75em .6em 0; - white-space: nowrap; - } - button { margin: 0; -- cgit v1.2.3-70-g09d2 From 9c305c5f93b2ffee0a98ff8cc6770df052d4b71e Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Tue, 8 Oct 2019 10:21:40 +0300 Subject: Revert "added acccount_actions component" This reverts commit 188b6f56ed2f983d8f0fba4dc8f7327ebbee321d. --- src/components/account_actions/account_actions.js | 59 --------- src/components/account_actions/account_actions.vue | 133 -------------------- src/components/follow_button/follow_button.js | 58 --------- src/components/follow_button/follow_button.vue | 13 -- src/components/user_card/user_card.js | 48 +++++++- src/components/user_card/user_card.vue | 135 ++++++++++++++++++++- 6 files changed, 178 insertions(+), 268 deletions(-) delete mode 100644 src/components/account_actions/account_actions.js delete mode 100644 src/components/account_actions/account_actions.vue delete mode 100644 src/components/follow_button/follow_button.js delete mode 100644 src/components/follow_button/follow_button.vue (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js deleted file mode 100644 index 1092a96a..00000000 --- a/src/components/account_actions/account_actions.js +++ /dev/null @@ -1,59 +0,0 @@ -import FollowButton from '../follow_button/follow_button.vue' -import ProgressButton from '../progress_button/progress_button.vue' - -const AccountActions = { - props: [ - 'user' - ], - data () { - return { - showDropDown: false - } - }, - components: { - FollowButton, - ProgressButton - }, - computed: { - tagsSet () { - return new Set(this.user.tags) - }, - hasTagPolicy () { - return this.$store.state.instance.tagPolicyAvailable - } - }, - methods: { - subscribeUser () { - return this.$store.dispatch('subscribeUser', this.user.id) - }, - unsubscribeUser () { - return this.$store.dispatch('unsubscribeUser', this.user.id) - }, - showRepeats () { - this.$store.dispatch('showReblogs', this.user.id) - }, - hideRepeats () { - this.$store.dispatch('hideReblogs', this.user.id) - }, - muteUser () { - this.$store.dispatch('muteUser', this.user.id) - }, - unmuteUser () { - this.$store.dispatch('unmuteUser', this.user.id) - }, - blockUser () { - this.$store.dispatch('blockUser', this.user.id) - }, - unblockUser () { - this.$store.dispatch('unblockUser', this.user.id) - }, - reportUser () { - this.$store.dispatch('openUserReportingModal', this.user.id) - }, - mentionUser () { - this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) - } - } -} - -export default AccountActions diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue deleted file mode 100644 index ce508b0a..00000000 --- a/src/components/account_actions/account_actions.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - - - diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js deleted file mode 100644 index 9d2834ab..00000000 --- a/src/components/follow_button/follow_button.js +++ /dev/null @@ -1,58 +0,0 @@ -import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' -export default { - props: ['user'], - data () { - return { - inProgress: false - } - }, - computed: { - isPressed () { - return this.inProgress || this.user.following - }, - title () { - if (this.inProgress || this.user.following) { - return 'user_card.follow_unfollow' - } else if (this.user.requested) { - return 'user_card.follow_again' - } else { - return '' - } - }, - label () { - if (this.inProgress) { - return 'user_card.follow_progress' - } else if (this.user.following) { - return 'user_card.following' - } else if (this.user.requested) { - return 'user_card.follow_sent' - } else { - return 'user_card.follow' - } - } - }, - methods: { - doClick () { - if (this.user.following) { - this.unfollowUser() - } else { - this.followUser() - } - }, - followUser () { - const store = this.$store - this.inProgress = true - requestFollow(this.user, store).then(() => { - this.inProgress = false - }) - }, - unfollowUser () { - const store = this.$store - this.inProgress = true - requestUnfollow(this.user, store).then(() => { - this.inProgress = false - store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) - }) - } - } -} diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue deleted file mode 100644 index 61aa75a0..00000000 --- a/src/components/follow_button/follow_button.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index c09e5654..015a5762 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -2,8 +2,8 @@ import UserAvatar from '../user_avatar/user_avatar.vue' import RemoteFollow from '../remote_follow/remote_follow.vue' import ProgressButton from '../progress_button/progress_button.vue' import ModerationTools from '../moderation_tools/moderation_tools.vue' -import AccountActions from '../account_actions/account_actions.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' +import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' export default { @@ -98,10 +98,48 @@ export default { UserAvatar, RemoteFollow, ModerationTools, - AccountActions, ProgressButton }, methods: { + showRepeats () { + this.$store.dispatch('showReblogs', this.user.id) + }, + hideRepeats () { + this.$store.dispatch('hideReblogs', this.user.id) + }, + followUser () { + const store = this.$store + this.followRequestInProgress = true + requestFollow(this.user, store).then(() => { + this.followRequestInProgress = false + }) + }, + unfollowUser () { + const store = this.$store + this.followRequestInProgress = true + requestUnfollow(this.user, store).then(() => { + this.followRequestInProgress = false + store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) + }) + }, + blockUser () { + this.$store.dispatch('blockUser', this.user.id) + }, + unblockUser () { + this.$store.dispatch('unblockUser', this.user.id) + }, + muteUser () { + this.$store.dispatch('muteUser', this.user.id) + }, + unmuteUser () { + this.$store.dispatch('unmuteUser', this.user.id) + }, + subscribeUser () { + return this.$store.dispatch('subscribeUser', this.user.id) + }, + unsubscribeUser () { + return this.$store.dispatch('unsubscribeUser', this.user.id) + }, setProfileView (v) { if (this.switcher) { const store = this.$store @@ -122,6 +160,9 @@ export default { this.$store.state.instance.restrictedNicknames ) }, + reportUser () { + this.$store.dispatch('openUserReportingModal', this.user.id) + }, zoomAvatar () { const attachment = { url: this.user.profile_image_url_original, @@ -129,6 +170,9 @@ export default { } this.$store.dispatch('setMedia', [attachment]) this.$store.dispatch('setCurrent', attachment) + }, + mentionUser () { + this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index abaef85f..f465467c 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -131,12 +131,135 @@
-
- +
+ +
+
+ +
+
+ + + + + + + + + +
+ +
+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ * { + flex: 1 0 0; + margin: 0 .75em .6em 0; + white-space: nowrap; + } + button { margin: 0; -- cgit v1.2.3-70-g09d2 From a26d55013779d7b41e4a4aa0dc2477a6926116ae Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Tue, 8 Oct 2019 10:21:48 +0300 Subject: updated user_card --- src/components/account_actions/account_actions.js | 45 +++++++ src/components/account_actions/account_actions.vue | 88 ++++++++++++++ src/components/follow_button/follow_button.js | 57 +++++++++ src/components/follow_button/follow_button.vue | 13 ++ src/components/user_card/user_card.js | 40 +----- src/components/user_card/user_card.vue | 134 ++++----------------- src/services/api/api.service.js | 13 +- 7 files changed, 240 insertions(+), 150 deletions(-) create mode 100644 src/components/account_actions/account_actions.js create mode 100644 src/components/account_actions/account_actions.vue create mode 100644 src/components/follow_button/follow_button.js create mode 100644 src/components/follow_button/follow_button.vue (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/account_actions/account_actions.js b/src/components/account_actions/account_actions.js new file mode 100644 index 00000000..453e1f46 --- /dev/null +++ b/src/components/account_actions/account_actions.js @@ -0,0 +1,45 @@ +import ProgressButton from '../progress_button/progress_button.vue' + +const AccountActions = { + props: [ + 'user' + ], + data () { + return { + showDropDown: false + } + }, + components: { + ProgressButton + }, + computed: { + tagsSet () { + return new Set(this.user.tags) + }, + hasTagPolicy () { + return this.$store.state.instance.tagPolicyAvailable + } + }, + methods: { + showRepeats () { + this.$store.dispatch('showReblogs', this.user.id) + }, + hideRepeats () { + this.$store.dispatch('hideReblogs', this.user.id) + }, + blockUser () { + this.$store.dispatch('blockUser', this.user.id) + }, + unblockUser () { + this.$store.dispatch('unblockUser', this.user.id) + }, + reportUser () { + this.$store.dispatch('openUserReportingModal', this.user.id) + }, + mentionUser () { + this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) + } + } +} + +export default AccountActions diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue new file mode 100644 index 00000000..5786a502 --- /dev/null +++ b/src/components/account_actions/account_actions.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/components/follow_button/follow_button.js b/src/components/follow_button/follow_button.js new file mode 100644 index 00000000..708d15a2 --- /dev/null +++ b/src/components/follow_button/follow_button.js @@ -0,0 +1,57 @@ +import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' +export default { + props: ['user'], + data () { + return { + inProgress: false + } + }, + computed: { + isPressed () { + return this.inProgress || this.user.following + }, + title () { + if (this.inProgress || this.user.following) { + return this.$t('user_card.follow_unfollow') + } else if (this.user.requested) { + return this.$t('user_card.follow_again') + } else { + return this.$t('user_card.follow') + } + }, + label () { + if (this.inProgress) { + return this.$t('user_card.follow_progress') + } else if (this.user.following) { + return this.$t('user_card.following') + } else if (this.user.requested) { + return this.$t('user_card.follow_sent') + } else { + return this.$t('user_card.follow') + } + } + }, + methods: { + onClick () { + if (this.user.following) { + this.unfollow() + } else { + this.follow() + } + }, + follow () { + this.inProgress = true + requestFollow(this.user, this.$store).then(() => { + this.inProgress = false + }) + }, + unfollow () { + const store = this.$store + this.inProgress = true + requestUnfollow(this.user, store).then(() => { + this.inProgress = false + store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) + }) + } + } +} diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue new file mode 100644 index 00000000..f0cbb94b --- /dev/null +++ b/src/components/follow_button/follow_button.vue @@ -0,0 +1,13 @@ + + + diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 015a5762..0107cfa6 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -1,9 +1,10 @@ import UserAvatar from '../user_avatar/user_avatar.vue' import RemoteFollow from '../remote_follow/remote_follow.vue' import ProgressButton from '../progress_button/progress_button.vue' +import FollowButton from '../follow_button/follow_button.vue' import ModerationTools from '../moderation_tools/moderation_tools.vue' +import AccountActions from '../account_actions/account_actions.vue' import { hex2rgb } from '../../services/color_convert/color_convert.js' -import { requestFollow, requestUnfollow } from '../../services/follow_manipulate/follow_manipulate' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' export default { @@ -98,36 +99,11 @@ export default { UserAvatar, RemoteFollow, ModerationTools, - ProgressButton + AccountActions, + ProgressButton, + FollowButton }, methods: { - showRepeats () { - this.$store.dispatch('showReblogs', this.user.id) - }, - hideRepeats () { - this.$store.dispatch('hideReblogs', this.user.id) - }, - followUser () { - const store = this.$store - this.followRequestInProgress = true - requestFollow(this.user, store).then(() => { - this.followRequestInProgress = false - }) - }, - unfollowUser () { - const store = this.$store - this.followRequestInProgress = true - requestUnfollow(this.user, store).then(() => { - this.followRequestInProgress = false - store.commit('removeStatus', { timeline: 'friends', userId: this.user.id }) - }) - }, - blockUser () { - this.$store.dispatch('blockUser', this.user.id) - }, - unblockUser () { - this.$store.dispatch('unblockUser', this.user.id) - }, muteUser () { this.$store.dispatch('muteUser', this.user.id) }, @@ -160,9 +136,6 @@ export default { this.$store.state.instance.restrictedNicknames ) }, - reportUser () { - this.$store.dispatch('openUserReportingModal', this.user.id) - }, zoomAvatar () { const attachment = { url: this.user.profile_image_url_original, @@ -170,9 +143,6 @@ export default { } this.$store.dispatch('setMedia', [attachment]) this.$store.dispatch('setCurrent', attachment) - }, - mentionUser () { - this.$store.dispatch('openPostStatusModal', { replyTo: true, repliedUser: this.user }) } } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index f465467c..119079b2 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -59,6 +59,10 @@ :title="$t('tool_tip.user_settings')" /> + -
- -
-
- -
-
- - - - - - - - - -
- -
- +
+ +
-
- -
- - -
- -
- -
- * { - flex: 1 0 0; margin: 0 .75em .6em 0; white-space: nowrap; } diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 80e94a50..61cd4f16 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -219,13 +219,16 @@ const authHeaders = (accessToken) => { } } -const followUser = ({ id, reblogs, credentials }) => { +const followUser = ({ id, credentials, ...options }) => { let url = MASTODON_FOLLOW_URL(id) - const form = new FormData() - if (reblogs !== undefined) { form.append('reblogs', reblogs) } + const form = {} + if (options.reblogs !== undefined) { form['reblogs'] = options.reblogs } return fetch(url, { - body: form, - headers: authHeaders(credentials), + body: JSON.stringify(form), + headers: { + ...authHeaders(credentials), + 'Content-Type': 'application/json' + }, method: 'POST' }).then((data) => data.json()) } -- cgit v1.2.3-70-g09d2 From e3f6001b3ee197caa4723e0b877b73eddf823bda Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Wed, 9 Oct 2019 09:04:18 +0300 Subject: update css --- src/components/account_actions/account_actions.vue | 10 +++++++++- src/components/user_card/user_card.vue | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index c7641b8a..f99707cc 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -46,7 +46,7 @@ class="btn btn-default btn-block dropdown-item" @click="unblockUser" > - {{ $t('user_card.blocked') }} + {{ $t('user_card.unblock') }}
@@ -273,7 +278,7 @@ mask: linear-gradient(to top, white, transparent) bottom no-repeat, linear-gradient(to top, white, white); // Autoprefixed seem to ignore this one, and also syntax is different - -webkit-mask-composite: xor; + -webkit-mask-composite: xor; mask-composite: exclude; background-size: cover; mask-size: 100% 60%; @@ -410,6 +415,19 @@ .top-line { display: flex; + .card-actions { + position: relative; + display: flex; + width: 60px; + .account-actions { + position: absolute; + left: 0; + } + a { + position: absolute; + right: 0; + } + } } } -- cgit v1.2.3-70-g09d2 From b8d8d02384e03ce8d5d38220527f798a9c0f3b30 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Fri, 11 Oct 2019 16:41:59 +0300 Subject: revert lint autofix --- src/components/user_card/user_card.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 199404fd..743fd667 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -278,7 +278,7 @@ mask: linear-gradient(to top, white, transparent) bottom no-repeat, linear-gradient(to top, white, white); // Autoprefixed seem to ignore this one, and also syntax is different - -webkit-mask-composite: xor; + -webkit-mask-composite: xor; mask-composite: exclude; background-size: cover; mask-size: 100% 60%; -- cgit v1.2.3-70-g09d2 From d53e7e3125572075fc3f512fa0343a6ed98e5c12 Mon Sep 17 00:00:00 2001 From: Maksim Pechnikov Date: Fri, 11 Oct 2019 16:52:26 +0300 Subject: fix orders of a buttons --- src/components/account_actions/account_actions.vue | 4 --- src/components/user_card/user_card.vue | 39 ++++++---------------- 2 files changed, 10 insertions(+), 33 deletions(-) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue index 818e75bc..046cba93 100644 --- a/src/components/account_actions/account_actions.vue +++ b/src/components/account_actions/account_actions.vue @@ -90,8 +90,4 @@ color: var(--text, $fallback--text); } } - -.account-actions .open { - min-width: 130px; -} diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 743fd667..f5cba09a 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -59,24 +59,18 @@ :title="$t('tool_tip.user_settings')" /> -
- - - - -
+ + +
-
Date: Wed, 30 Oct 2019 03:15:57 +0000 Subject: profile-banner rounding css, fixes #690 --- src/components/user_card/user_card.vue | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/user_card/user_card.vue') diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 2755d89b..6f3c958e 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -276,6 +276,8 @@ mask-composite: exclude; background-size: cover; mask-size: 100% 60%; + border-top-left-radius: calc(var(--panelRadius) - 1px); + border-top-right-radius: calc(var(--panelRadius) - 1px); &.hide-bio { mask-size: 100% 40px; -- cgit v1.2.3-70-g09d2