From dbe0205a9cc63cd3ecb5e1f754ebf55c27bbca3c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Jan 2019 10:47:49 +0000 Subject: [PATCH 01/14] api service: add the ability to fetch a media-only timeline --- src/services/api/api.service.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 776d8daef1..5b0d865025 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -325,6 +325,7 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use notifications: QVITTER_USER_NOTIFICATIONS_URL, 'publicAndExternal': PUBLIC_AND_EXTERNAL_TIMELINE_URL, user: QVITTER_USER_TIMELINE_URL, + media: QVITTER_USER_TIMELINE_URL, favorites: MASTODON_USER_FAVORITES_TIMELINE_URL, tag: TAG_TIMELINE_URL } @@ -345,6 +346,9 @@ const fetchTimeline = ({timeline, credentials, since = false, until = false, use if (tag) { url += `/${tag}.json` } + if (timeline === 'media') { + params.push(['only_media', 1]) + } params.push(['count', 20]) From 7b296696a3cf83b93b1f8246b114e05dcee4e040 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Jan 2019 10:48:40 +0000 Subject: [PATCH 02/14] user profile: add media timeline --- src/components/user_profile/user_profile.js | 12 ++++++++++++ src/components/user_profile/user_profile.vue | 1 + src/i18n/en.json | 1 + src/modules/statuses.js | 1 + 4 files changed, 15 insertions(+) diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index c9197a1cf5..7414e57368 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -6,8 +6,10 @@ const UserProfile = { created () { this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'favorites' }) + this.$store.commit('clearTimeline', { timeline: 'media' }) this.$store.dispatch('startFetching', ['user', this.fetchBy]) this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) + this.$store.dispatch('startFetching', ['media', this.fetchBy]) if (!this.user.id) { this.$store.dispatch('fetchUser', this.fetchBy) } @@ -15,6 +17,7 @@ const UserProfile = { destroyed () { this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'favorites') + this.$store.dispatch('stopFetching', 'media') }, computed: { timeline () { @@ -23,6 +26,9 @@ const UserProfile = { favorites () { return this.$store.state.statuses.timelines.favorites }, + media () { + return this.$store.state.statuses.timelines.media + }, userId () { return this.$route.params.id || this.user.id }, @@ -78,10 +84,13 @@ const UserProfile = { } this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'favorites') + this.$store.dispatch('stopFetching', 'media') this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'favorites' }) + this.$store.commit('clearTimeline', { timeline: 'media' }) this.$store.dispatch('startFetching', ['user', this.fetchBy]) this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) + this.$store.dispatch('startFetching', ['media', this.fetchBy]) }, userId () { if (!this.isExternal) { @@ -89,10 +98,13 @@ const UserProfile = { } this.$store.dispatch('stopFetching', 'user') this.$store.dispatch('stopFetching', 'favorites') + this.$store.dispatch('stopFetching', 'media') this.$store.commit('clearTimeline', { timeline: 'user' }) this.$store.commit('clearTimeline', { timeline: 'favorites' }) + this.$store.commit('clearTimeline', { timeline: 'media' }) this.$store.dispatch('startFetching', ['user', this.fetchBy]) this.$store.dispatch('startFetching', ['favorites', this.fetchBy]) + this.$store.dispatch('startFetching', ['media', this.fetchBy]) }, user () { if (this.user.id && !this.user.followers) { diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index d64ce27703..74cd9c538d 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -20,6 +20,7 @@ + diff --git a/src/i18n/en.json b/src/i18n/en.json index 3c29a17e0f..3ff98ab0c3 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -335,6 +335,7 @@ "following": "Following!", "follows_you": "Follows you!", "its_you": "It's you!", + "media": "Media", "mute": "Mute", "muted": "Muted", "per_day": "per day", diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 20a8d2eb43..3d6ea2f7d4 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -37,6 +37,7 @@ export const defaultState = { public: emptyTl(), user: emptyTl(), favorites: emptyTl(), + media: emptyTl(), publicAndExternal: emptyTl(), friends: emptyTl(), tag: emptyTl(), From efad3ad0a51273e192590761b905d4db7d76bf71 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 26 Jan 2019 13:51:07 +0000 Subject: [PATCH 03/14] attempt to fix tests --- .../specs/components/user_profile.spec.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js index cde39245cf..41fd9cd01e 100644 --- a/test/unit/specs/components/user_profile.spec.js +++ b/test/unit/specs/components/user_profile.spec.js @@ -66,6 +66,22 @@ const externalProfileStore = new Vuex.Store({ viewing: 'statuses', userId: 100, flushMarker: 0 + }, + media: { + statuses: [], + statusesObject: {}, + faves: [], + visibleStatuses: [], + visibleStatusesObject: {}, + newStatusCount: 0, + maxId: 0, + minVisibleId: 0, + loading: false, + followers: [], + friends: [], + viewing: 'statuses', + userId: 100, + flushMarker: 0 } } }, @@ -116,6 +132,22 @@ const localProfileStore = new Vuex.Store({ viewing: 'statuses', userId: 100, flushMarker: 0 + }, + media: { + statuses: [], + statusesObject: {}, + faves: [], + visibleStatuses: [], + visibleStatusesObject: {}, + newStatusCount: 0, + maxId: 0, + minVisibleId: 0, + loading: false, + followers: [], + friends: [], + viewing: 'statuses', + userId: 100, + flushMarker: 0 } } }, From 474fbf6bf4af3dc1b2370f522997edef4f4ab66a Mon Sep 17 00:00:00 2001 From: shpuld Date: Sun, 27 Jan 2019 08:27:41 +0200 Subject: [PATCH 04/14] use translate over margin animation (stupid me) --- src/components/side_drawer/side_drawer.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index 386fff6a7c..fc90977bbb 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -128,7 +128,7 @@ .side-drawer { overflow-x: hidden; - transition: 0.5s; + transition: 0.35s; transition-timing-function: cubic-bezier(0, 1, 0.5, 1); margin: 0 0 0 -100px; padding: 0 0 1em 100px; @@ -146,7 +146,7 @@ } .side-drawer-closed { - margin: 0 0 0 calc(-100% - 100px); + transform: translate(-100%); } .side-drawer-heading { From 4c9f3b946db181b6069df9290516c33a1f71233d Mon Sep 17 00:00:00 2001 From: shpuld Date: Sun, 27 Jan 2019 08:42:34 +0200 Subject: [PATCH 05/14] Add forgotten prop to entity normalizer --- src/services/entity_normalizer/entity_normalizer.service.js | 1 + .../specs/services/entity_normalizer/entity_normalizer.spec.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index becbab154d..4e24d39e00 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -104,6 +104,7 @@ export const parseUser = (data) => { output.background_image = data.background_image } + output.following = data.following output.created_at = new Date(data.created_at) output.locked = data.locked output.followers_count = data.followers_count diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js index 703fecf1c8..c1d5ac12c5 100644 --- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js +++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js @@ -80,6 +80,7 @@ const makeMockUserMasto = (overrides = {}) => { fields: [], followers_count: 705, following_count: 326, + following: true, header: 'https://shigusegubu.club/media/7ab024d9-2a8a-4fbc-9ce8-da06756ae2db/6aadefe4e264133bc377ab450e6b045b6f5458542a5c59e6c741f86107f0388b.png', header_static: From 2d94a49798783d404ecb038f06fa877fd7885d2e Mon Sep 17 00:00:00 2001 From: shpuld Date: Sun, 27 Jan 2019 11:13:32 +0200 Subject: [PATCH 06/14] Fix registration path warning and translation warnings --- src/boot/routes.js | 2 +- src/components/user_profile/user_profile.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/boot/routes.js b/src/boot/routes.js index 9dba532a52..cfbcb1feac 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -39,7 +39,7 @@ export default (store) => { { name: 'dms', path: '/users/:username/dms', component: DMs }, { name: 'settings', path: '/settings', component: Settings }, { name: 'registration', path: '/registration', component: Registration }, - { name: 'registration', path: '/registration/:token', component: Registration }, + { name: 'registration-token', path: '/registration/:token', component: Registration }, { name: 'friend-requests', path: '/friend-requests', component: FollowRequests }, { name: 'user-settings', path: '/user-settings', component: UserSettings }, { name: 'notifications', path: '/:username/notifications', component: Notifications }, diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 74cd9c538d..f9b964ce43 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -20,8 +20,8 @@ - - + + +
+
+ {{authError}} + +
+
@@ -48,10 +54,6 @@ width: 10em; } - .error { - text-align: center; - } - .register { flex: 1 1; } @@ -64,4 +66,14 @@ justify-content: space-between; } } + +.login { + .error { + text-align: center; + + animation-name: shakeError; + animation-duration: 0.4s; + animation-timing-function: ease-in-out; + } +} diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue index 25c1a9d0ac..cf9bf5d908 100644 --- a/src/components/registration/registration.vue +++ b/src/components/registration/registration.vue @@ -147,24 +147,6 @@ $validations-cRed: #f04124; margin-bottom: 1em; } - @keyframes shakeError { - 0% { - transform: translateX(0); } - 15% { - transform: translateX(0.375rem); } - 30% { - transform: translateX(-0.375rem); } - 45% { - transform: translateX(0.375rem); } - 60% { - transform: translateX(-0.375rem); } - 75% { - transform: translateX(0.375rem); } - 90% { - transform: translateX(-0.375rem); } - 100% { - transform: translateX(0); } } - .form-group--error { animation-name: shakeError; animation-duration: .6s; From 4d3907b86a714c63d4a09c7d03d7f0e7b97b1b85 Mon Sep 17 00:00:00 2001 From: shpuld Date: Mon, 28 Jan 2019 17:48:00 +0200 Subject: [PATCH 14/14] Formatting --- src/components/login_form/login_form.js | 23 ++++++++++++----------- src/components/login_form/login_form.vue | 1 + 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/login_form/login_form.js b/src/components/login_form/login_form.js index ae9322d5c7..fb6dc651ec 100644 --- a/src/components/login_form/login_form.js +++ b/src/components/login_form/login_form.js @@ -29,17 +29,18 @@ const LoginForm = { app, instance: data.instance, username: this.user.username, - password: this.user.password}) - .then((result) => { - if (result.error) { - this.authError = result.error - this.user.password = '' - return - } - this.$store.commit('setToken', result.access_token) - this.$store.dispatch('loginUser', result.access_token) - this.$router.push({name: 'friends'}) - }) + password: this.user.password + } + ).then((result) => { + if (result.error) { + this.authError = result.error + this.user.password = '' + return + } + this.$store.commit('setToken', result.access_token) + this.$store.dispatch('loginUser', result.access_token) + this.$router.push({name: 'friends'}) + }) }) }, clearError () { diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue index b6a1577671..27a8e48aab 100644 --- a/src/components/login_form/login_form.vue +++ b/src/components/login_form/login_form.vue @@ -33,6 +33,7 @@ +
{{authError}}