From b27ec058cae582e8b9ad9e56be0e9be57f865886 Mon Sep 17 00:00:00 2001
From: William Pitcock
Date: Sun, 27 Jan 2019 12:56:07 +0000
Subject: [PATCH 01/20] entity normalizer: add support for opengraph cards
---
src/services/entity_normalizer/entity_normalizer.service.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index e69547b6..deffa537 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -215,6 +215,7 @@ export const parseStatus = (data) => {
output.id = String(data.id)
output.visibility = data.visibility
+ output.card = data.card
output.created_at = new Date(data.created_at)
// Converting to string, the right way.
From 0924907c64376249433e2fd16278662181c9e856 Mon Sep 17 00:00:00 2001
From: William Pitcock
Date: Sun, 27 Jan 2019 13:47:30 +0000
Subject: [PATCH 02/20] add link-preview component
---
src/components/link-preview/link-preview.js | 8 +++
src/components/link-preview/link-preview.vue | 59 ++++++++++++++++++++
src/components/status/status.js | 4 +-
src/components/status/status.vue | 4 ++
4 files changed, 74 insertions(+), 1 deletion(-)
create mode 100644 src/components/link-preview/link-preview.js
create mode 100644 src/components/link-preview/link-preview.vue
diff --git a/src/components/link-preview/link-preview.js b/src/components/link-preview/link-preview.js
new file mode 100644
index 00000000..13264afb
--- /dev/null
+++ b/src/components/link-preview/link-preview.js
@@ -0,0 +1,8 @@
+const LinkPreview = {
+ name: 'LinkPreview',
+ props: [
+ 'card'
+ ]
+}
+
+export default LinkPreview
diff --git a/src/components/link-preview/link-preview.vue b/src/components/link-preview/link-preview.vue
new file mode 100644
index 00000000..49de654f
--- /dev/null
+++ b/src/components/link-preview/link-preview.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
diff --git a/src/components/status/status.js b/src/components/status/status.js
index b14a74ec..681d0373 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -5,6 +5,7 @@ import DeleteButton from '../delete_button/delete_button.vue'
import PostStatusForm from '../post_status_form/post_status_form.vue'
import UserCardContent from '../user_card_content/user_card_content.vue'
import StillImage from '../still-image/still-image.vue'
+import LinkPreview from '../link-preview/link-preview.vue'
import { filter, find } from 'lodash'
import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
@@ -220,7 +221,8 @@ const Status = {
DeleteButton,
PostStatusForm,
UserCardContent,
- StillImage
+ StillImage,
+ LinkPreview
},
methods: {
visibilityIcon (visibility) {
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 5c956467..e959544b 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -98,6 +98,10 @@
+
+
+
+
-
+
From 96c36af73168913768818f5293358f460e30c24f Mon Sep 17 00:00:00 2001
From: shpuld
Date: Sun, 27 Jan 2019 22:33:36 +0200
Subject: [PATCH 04/20] refactor the FE parts
---
src/components/link-preview/link-preview.js | 17 ++++-
src/components/link-preview/link-preview.vue | 76 ++++++++++++--------
src/components/status/status.vue | 18 +++--
3 files changed, 74 insertions(+), 37 deletions(-)
diff --git a/src/components/link-preview/link-preview.js b/src/components/link-preview/link-preview.js
index 13264afb..2f6da55e 100644
--- a/src/components/link-preview/link-preview.js
+++ b/src/components/link-preview/link-preview.js
@@ -1,8 +1,21 @@
const LinkPreview = {
name: 'LinkPreview',
props: [
- 'card'
- ]
+ 'card',
+ 'size',
+ 'nsfw'
+ ],
+ computed: {
+ useImage () {
+ // Currently BE shoudn't give cards if tagged NSFW, this is a bit paranoid
+ // as it makes sure to hide the image if somehow NSFW tagged preview can
+ // exist.
+ return this.card.image && !this.nsfw && this.size !== 'hide'
+ },
+ useDescription () {
+ return this.card.description && /\S/.test(this.card.description)
+ }
+ }
}
export default LinkPreview
diff --git a/src/components/link-preview/link-preview.vue b/src/components/link-preview/link-preview.vue
index 49de654f..9b3f2550 100644
--- a/src/components/link-preview/link-preview.vue
+++ b/src/components/link-preview/link-preview.vue
@@ -1,13 +1,13 @@
-
-
+
+
-
-
{{ card.title }}
-
{{ card.description }}
-
{{ card.provider_name }}
+
+
{{ card.provider_name }}
+
{{ card.title }}
+
{{ card.description }}
@@ -19,36 +19,56 @@
@import '../../_variables.scss';
.link-preview-card {
- display: flex !important;
+ display: flex;
flex-direction: row;
cursor: pointer;
- margin: 0.5em 0.7em 0.6em 0.0em;
+ overflow: hidden;
- .image {
- flex: 0 0 100px;
- position: relative;
- }
+ // TODO: clean up the random margins in attachments, this makes preview line
+ // up with attachments...
+ margin-right: 0.7em;
- .image > div {
- display: block;
- margin: 0;
- width: 100%;
- height: 100%;
- object-fit: cover;
- background-size: cover;
- background-position: center center;
- }
-
- .content {
- padding: 1em;
- flex: 1;
-
- .host {
- font-size: 90%;
+ .card-image {
+ flex-shrink: 0;
+ width: 120px;
+ max-width: 25%;
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ border-radius: $fallback--attachmentRadius;
+ border-radius: var(--attachmentRadius, $fallback--attachmentRadius);
}
}
+ .small-image {
+ width: 80px;
+ }
+
+ .card-content {
+ max-height: 100%;
+ margin: 0.5em;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .card-host {
+ font-size: 12px;
+ }
+
+ .card-description {
+ margin: 0.5em 0 0 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-word;
+ line-height: 1.2em;
+ // cap description at 3 lines, the 1px is to clean up some stray pixels
+ // TODO: fancier fade-out at the bottom to show off that it's too long?
+ max-height: calc(1.2em * 3 - 1px);
+ }
+
color: $fallback--text;
+ color: var(--text, $fallback--text);
border-style: solid;
border-width: 1px;
border-radius: $fallback--attachmentRadius;
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index aa37ad51..d88428c7 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -98,8 +98,8 @@
-
-
+
+
@@ -225,6 +225,11 @@
vertical-align: bottom;
flex-basis: 100%;
+ a {
+ display: inline-block;
+ word-break: break-all;
+ }
+
small {
font-weight: lighter;
}
@@ -300,11 +305,6 @@
}
}
- a {
- display: inline-block;
- word-break: break-all;
- }
-
.tall-status {
position: relative;
height: 220px;
@@ -313,6 +313,8 @@
}
.tall-status-hider {
+ display: inline-block;
+ word-break: break-all;
position: absolute;
height: 70px;
margin-top: 150px;
@@ -330,6 +332,8 @@
.status-unhider, .cw-status-hider {
width: 100%;
text-align: center;
+ display: inline-block;
+ word-break: break-all;
}
.status-content {
From 2ce6fba2ba968a99f395e4bddaf1f43492cce576 Mon Sep 17 00:00:00 2001
From: lain
Date: Mon, 28 Jan 2019 17:52:01 +0100
Subject: [PATCH 05/20] Rename service worker to not clash with mastodon sw.
---
build/webpack.base.conf.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index ea46ce6f..e07bb7a2 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -95,7 +95,8 @@ module.exports = {
},
plugins: [
new ServiceWorkerWebpackPlugin({
- entry: path.join(__dirname, '..', 'src/sw.js')
+ entry: path.join(__dirname, '..', 'src/sw.js'),
+ filename: 'sw-pleroma.js'
})
]
}
From ca78623b348a3ef83c02e451b0b553b431a06551 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Mon, 28 Jan 2019 20:15:00 +0200
Subject: [PATCH 06/20] fix user tl clearing and give it a test
---
src/modules/statuses.js | 6 +++---
test/unit/specs/modules/statuses.spec.js | 9 +++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 3d6ea2f7..04ec4dbc 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -2,7 +2,7 @@ import { remove, slice, each, find, maxBy, minBy, merge, last, isArray } from 'l
import apiService from '../services/api/api.service.js'
// import parse from '../services/status_parser/status_parser.js'
-const emptyTl = () => ({
+const emptyTl = (userId = 0) => ({
statuses: [],
statusesObject: {},
faves: [],
@@ -14,7 +14,7 @@ const emptyTl = () => ({
loading: false,
followers: [],
friends: [],
- userId: 0,
+ userId,
flushMarker: 0
})
@@ -319,7 +319,7 @@ export const mutations = {
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
},
clearTimeline (state, { timeline }) {
- state.timelines[timeline] = emptyTl()
+ state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
},
setFavorited (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id]
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js
index 33628b9b..01d2ce06 100644
--- a/test/unit/specs/modules/statuses.spec.js
+++ b/test/unit/specs/modules/statuses.spec.js
@@ -240,6 +240,15 @@ describe('The Statuses module', () => {
expect(state.timelines.public.visibleStatuses[0].favorited).to.eql(true)
})
+ it('keeps userId when clearing user timeline', () => {
+ const state = cloneDeep(defaultState)
+ state.timelines.user.userId = 123
+
+ mutations.clearTimeline(state, { timeline: 'user' })
+
+ expect(state.timelines.user.userId).to.eql(123)
+ })
+
describe('notifications', () => {
it('removes a notification when the notice gets removed', () => {
const user = { id: '1' }
From a593c2cb8cf77ea1d894a941c29858630e703a36 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Mon, 28 Jan 2019 21:21:11 +0200
Subject: [PATCH 07/20] Make userByName case-insensitive
---
src/modules/users.js | 2 +-
test/unit/specs/modules/users.spec.js | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/modules/users.js b/src/modules/users.js
index d83f0dd8..181946b4 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -91,7 +91,7 @@ export const getters = {
userById: state => id =>
state.users.find(user => user.id === id),
userByName: state => name =>
- state.users.find(user => user.screen_name === name)
+ state.users.find(user => user.screen_name.toLowerCase() === name.toLowerCase())
}
export const defaultState = {
diff --git a/test/unit/specs/modules/users.spec.js b/test/unit/specs/modules/users.spec.js
index b0f3c51e..4d49ee24 100644
--- a/test/unit/specs/modules/users.spec.js
+++ b/test/unit/specs/modules/users.spec.js
@@ -45,6 +45,17 @@ describe('The users module', () => {
const expected = { screen_name: 'Guy', id: '1' }
expect(getters.userByName(state)(name)).to.eql(expected)
})
+
+ it('returns user with matching screen_name with different case', () => {
+ const state = {
+ users: [
+ { screen_name: 'guy', id: '1' }
+ ]
+ }
+ const name = 'Guy'
+ const expected = { screen_name: 'guy', id: '1' }
+ expect(getters.userByName(state)(name)).to.eql(expected)
+ })
})
describe('getUserById', () => {
From 0460728a8c571b9a4468c2f93a2f8465fe37fa86 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Mon, 28 Jan 2019 21:59:17 +0200
Subject: [PATCH 08/20] Fix tall status expanding needing extra clicks, make
tall status expand automatically in conversation when focused
---
src/components/status/status.js | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 13e79dd0..c93580c0 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -31,7 +31,7 @@ const Status = {
userExpanded: false,
preview: null,
showPreview: false,
- showingTall: false,
+ showingTall: this.inConversation && this.focused,
expandingSubject: typeof this.$store.state.config.collapseMessageWithSubject === 'undefined'
? !this.$store.state.instance.collapseMessageWithSubject
: !this.$store.state.config.collapseMessageWithSubject,
@@ -262,13 +262,14 @@ const Status = {
this.userExpanded = !this.userExpanded
},
toggleShowMore () {
+ console.log('toggleShowMore', this.showingTall)
if (this.showingTall) {
this.showingTall = false
- } else if (this.expandingSubject) {
+ } else if (this.expandingSubject && this.status.summary) {
this.expandingSubject = false
} else if (this.hideTallStatus) {
this.showingTall = true
- } else if (this.hideSubjectStatus) {
+ } else if (this.hideSubjectStatus && this.status.summary) {
this.expandingSubject = true
}
},
@@ -301,8 +302,10 @@ const Status = {
'highlight': function (id) {
if (this.status.id === id) {
let rect = this.$el.getBoundingClientRect()
- if (rect.top < 100) {
+ if (rect.top < 140) {
window.scrollBy(0, rect.top - 200)
+ } else if (rect.top < window.innerHeight && rect.height >= (window.innerHeight - 50)) {
+ window.scrollBy(0, rect.top - 50)
} else if (rect.bottom > window.innerHeight - 50) {
window.scrollBy(0, rect.bottom - window.innerHeight + 50)
}
From c3a931610a16a23659edc1140573a003e14c8dbc Mon Sep 17 00:00:00 2001
From: shpuld
Date: Mon, 28 Jan 2019 22:03:25 +0200
Subject: [PATCH 09/20] remove log
---
src/components/status/status.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/components/status/status.js b/src/components/status/status.js
index c93580c0..443e6b42 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -262,7 +262,6 @@ const Status = {
this.userExpanded = !this.userExpanded
},
toggleShowMore () {
- console.log('toggleShowMore', this.showingTall)
if (this.showingTall) {
this.showingTall = false
} else if (this.expandingSubject && this.status.summary) {
From 1f3cf6d1fc21df8b27210ec2b6a4700b1a493d61 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 16:32:34 +0200
Subject: [PATCH 10/20] add missing shadow to nav panel
---
src/components/nav_panel/nav_panel.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue
index ad7c53f9..3aa0a793 100644
--- a/src/components/nav_panel/nav_panel.vue
+++ b/src/components/nav_panel/nav_panel.vue
@@ -44,6 +44,7 @@
.nav-panel .panel {
overflow: hidden;
+ box-shadow: var(--panelShadow);
}
.nav-panel ul {
list-style: none;
From 41c4d59341468ad8e061bd0fd5fb3cf92ff23dfa Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 17:16:25 +0200
Subject: [PATCH 11/20] Connect only after-store instead of when user gets
token
---
src/boot/after_store.js | 2 ++
src/modules/api.js | 11 +++++++++--
src/modules/users.js | 4 ++--
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index 50500582..5693dcc6 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -89,6 +89,8 @@ const afterStoreSetup = ({ store, i18n }) => {
if ((config.chatDisabled)) {
store.dispatch('disableChat')
+ } else {
+ store.dispatch('initializeSocket')
}
const router = new VueRouter({
diff --git a/src/modules/api.js b/src/modules/api.js
index a61340c2..7bda13e7 100644
--- a/src/modules/api.js
+++ b/src/modules/api.js
@@ -20,6 +20,9 @@ const api = {
removeFetcher (state, {timeline}) {
delete state.fetchers[timeline]
},
+ setWsToken (state, token) {
+ state.wsToken = token
+ },
setSocket (state, socket) {
state.socket = socket
},
@@ -51,10 +54,14 @@ const api = {
window.clearInterval(fetcher)
store.commit('removeFetcher', {timeline})
},
- initializeSocket (store, token) {
+ setWsToken (store, token) {
+ store.commit('setWsToken', token)
+ },
+ initializeSocket (store) {
// Set up websocket connection
if (!store.state.chatDisabled) {
- let socket = new Socket('/socket', {params: {token: token}})
+ const token = store.state.wsToken
+ const socket = new Socket('/socket', {params: {token}})
socket.connect()
store.dispatch('initializeChat', socket)
}
diff --git a/src/modules/users.js b/src/modules/users.js
index 181946b4..2533912c 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -222,10 +222,10 @@ const users = {
commit('setBackendInteractor', backendInteractorService(accessToken))
if (user.token) {
- store.dispatch('initializeSocket', user.token)
+ store.dispatch('setWsToken', user.token)
}
- // Start getting fresh tweets.
+ // Start getting fresh posts.
store.dispatch('startFetching', 'friends')
// Get user mutes and follower info
From b042c48fa72b16ae4a4f75a353627bbb5f5ddc72 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 17:38:55 +0200
Subject: [PATCH 12/20] Fix TypeError crash when using url of an invalid user
---
src/modules/users.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/modules/users.js b/src/modules/users.js
index 181946b4..dd555f6c 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -91,7 +91,9 @@ export const getters = {
userById: state => id =>
state.users.find(user => user.id === id),
userByName: state => name =>
- state.users.find(user => user.screen_name.toLowerCase() === name.toLowerCase())
+ state.users.find(user => user.screen_name &&
+ (user.screen_name.toLowerCase() === name.toLowerCase())
+ )
}
export const defaultState = {
From 89bfc41174e1da8275e01c0280eec5ed7197b4d1 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 18:40:49 +0200
Subject: [PATCH 13/20] Add a better check for fresh TL flushing
---
src/services/timeline_fetcher/timeline_fetcher.service.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 727f6c60..9c4a4820 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -29,9 +29,11 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
args['userId'] = userId
args['tag'] = tag
+ const numStatusesBeforeFetch = timelineData.statuses.length
+
return apiService.fetchTimeline(args)
.then((statuses) => {
- if (!older && statuses.length >= 20 && !timelineData.loading && timelineData.statuses.length) {
+ if (!older && statuses.length >= 20 && !timelineData.loading && numStatusesBeforeFetch > 0) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
update({store, statuses, timeline, showImmediately, userId})
From 0a0dffa793f2cea050507f811d1315348056348a Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 19:12:47 +0200
Subject: [PATCH 14/20] Fix favs timeline fetching when opening profile via
direct url
---
src/components/user_profile/user_profile.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 991062cd..27e138b0 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -36,7 +36,8 @@ const UserProfile = {
return this.$route.params.name || this.user.screen_name
},
isUs () {
- return this.userId === this.$store.state.users.currentUser.id
+ return this.userId && this.$store.state.users.currentUser.id &&
+ this.userId === this.$store.state.users.currentUser.id
},
friends () {
return this.user.friends
From 62e9525724cfff0c3e26b8325b019e926baed1ca Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 21:04:52 +0200
Subject: [PATCH 15/20] Add loading indicator for notifications, make timelines
indicate bottoming out when no more statuses
---
src/components/notifications/notifications.js | 14 ++++++++++++++
src/components/notifications/notifications.vue | 9 +++++++--
src/components/timeline/timeline.js | 10 ++++++++--
src/components/timeline/timeline.vue | 9 +++++++--
src/i18n/en.json | 6 ++++--
src/i18n/fi.json | 6 ++++--
src/modules/statuses.js | 7 +++++++
.../notifications_fetcher.service.js | 1 +
.../timeline_fetcher/timeline_fetcher.service.js | 1 +
9 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js
index ea32bbd0..5e95631a 100644
--- a/src/components/notifications/notifications.js
+++ b/src/components/notifications/notifications.js
@@ -13,6 +13,11 @@ const Notifications = {
notificationsFetcher.startFetching({ store, credentials })
},
+ data () {
+ return {
+ bottomedOut: false
+ }
+ },
computed: {
notifications () {
return notificationsFromStore(this.$store)
@@ -28,6 +33,9 @@ const Notifications = {
},
unseenCount () {
return this.unseenNotifications.length
+ },
+ loading () {
+ return this.$store.state.statuses.notifications.loading
}
},
components: {
@@ -49,10 +57,16 @@ const Notifications = {
fetchOlderNotifications () {
const store = this.$store
const credentials = store.state.users.currentUser.credentials
+ store.commit('setNotificationsLoading', { value: true })
notificationsFetcher.fetchAndUpdate({
store,
credentials,
older: true
+ }).then(notifs => {
+ store.commit('setNotificationsLoading', { value: false })
+ if (notifs.length === 0) {
+ this.bottomedOut = true
+ }
})
}
}
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
index 64f18720..6f162b62 100644
--- a/src/components/notifications/notifications.vue
+++ b/src/components/notifications/notifications.vue
@@ -18,10 +18,15 @@
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index 98da8660..85e0a055 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -16,7 +16,8 @@ const Timeline = {
data () {
return {
paused: false,
- unfocused: false
+ unfocused: false,
+ bottomedOut: false
}
},
computed: {
@@ -95,7 +96,12 @@ const Timeline = {
showImmediately: true,
userId: this.userId,
tag: this.tag
- }).then(() => store.commit('setLoading', { timeline: this.timelineName, value: false }))
+ }).then(statuses => {
+ store.commit('setLoading', { timeline: this.timelineName, value: false })
+ if (statuses.length === 0) {
+ this.bottomedOut = true
+ }
+ })
}, 1000, this),
scrollLoad (e) {
const bodyBRect = document.body.getBoundingClientRect()
diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index 6ba598c5..e3eea3bd 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -20,10 +20,15 @@
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 3ff98ab0..c2f48450 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -49,7 +49,8 @@
"load_older": "Load older notifications",
"notifications": "Notifications",
"read": "Read!",
- "repeated_you": "repeated your status"
+ "repeated_you": "repeated your status",
+ "no_more_notifications": "No more notifications"
},
"post_status": {
"new_status": "Post new status",
@@ -317,7 +318,8 @@
"no_retweet_hint": "Post is marked as followers-only or direct and cannot be repeated",
"repeated": "repeated",
"show_new": "Show new",
- "up_to_date": "Up-to-date"
+ "up_to_date": "Up-to-date",
+ "no_more_statuses": "No more statuses"
},
"user_card": {
"approve": "Approve",
diff --git a/src/i18n/fi.json b/src/i18n/fi.json
index 08cfb617..ee7cd4d2 100644
--- a/src/i18n/fi.json
+++ b/src/i18n/fi.json
@@ -26,7 +26,8 @@
"followed_you": "seuraa sinua",
"notifications": "Ilmoitukset",
"read": "Lue!",
- "repeated_you": "toisti viestisi"
+ "repeated_you": "toisti viestisi",
+ "no_more_notifications": "Ei enempää ilmoituksia"
},
"post_status": {
"default": "Tulin juuri saunasta.",
@@ -77,7 +78,8 @@
"load_older": "Lataa vanhempia viestejä",
"repeated": "toisti",
"show_new": "Näytä uudet",
- "up_to_date": "Ajantasalla"
+ "up_to_date": "Ajantasalla",
+ "no_more_statuses": "Ei enempää viestejä"
},
"user_card": {
"follow": "Seuraa",
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
index 04ec4dbc..56619455 100644
--- a/src/modules/statuses.js
+++ b/src/modules/statuses.js
@@ -28,6 +28,7 @@ export const defaultState = {
minId: Number.POSITIVE_INFINITY,
data: [],
idStore: {},
+ loading: false,
error: false
},
favorites: new Set(),
@@ -348,6 +349,9 @@ export const mutations = {
setError (state, { value }) {
state.error = value
},
+ setNotificationsLoading (state, { value }) {
+ state.notifications.loading = value
+ },
setNotificationsError (state, { value }) {
state.notifications.error = value
},
@@ -376,6 +380,9 @@ const statuses = {
setError ({ rootState, commit }, { value }) {
commit('setError', { value })
},
+ setNotificationsLoading ({ rootState, commit }, { value }) {
+ commit('setNotificationsLoading', { value })
+ },
setNotificationsError ({ rootState, commit }, { value }) {
commit('setNotificationsError', { value })
},
diff --git a/src/services/notifications_fetcher/notifications_fetcher.service.js b/src/services/notifications_fetcher/notifications_fetcher.service.js
index 1480cded..b69ec643 100644
--- a/src/services/notifications_fetcher/notifications_fetcher.service.js
+++ b/src/services/notifications_fetcher/notifications_fetcher.service.js
@@ -24,6 +24,7 @@ const fetchAndUpdate = ({store, credentials, older = false}) => {
return apiService.fetchTimeline(args)
.then((notifications) => {
update({store, notifications, older})
+ return notifications
}, () => store.dispatch('setNotificationsError', { value: true }))
.catch(() => store.dispatch('setNotificationsError', { value: true }))
}
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
index 727f6c60..08d91b5a 100644
--- a/src/services/timeline_fetcher/timeline_fetcher.service.js
+++ b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -35,6 +35,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
}
update({store, statuses, timeline, showImmediately, userId})
+ return statuses
}, () => store.dispatch('setError', { value: true }))
}
From 7666d50d8a9eb2ef8b5a61a1689b7358ae7d93ea Mon Sep 17 00:00:00 2001
From: shpuld
Date: Tue, 29 Jan 2019 21:11:00 +0200
Subject: [PATCH 16/20] Change panel-footing style to be more fitting
---
src/App.scss | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/App.scss b/src/App.scss
index ba8770e2..f3e9e557 100644
--- a/src/App.scss
+++ b/src/App.scss
@@ -425,6 +425,12 @@ main-router {
border-radius: 0 0 $fallback--panelRadius $fallback--panelRadius;
border-radius: 0 0 var(--panelRadius, $fallback--panelRadius) var(--panelRadius, $fallback--panelRadius);
+
+ .faint {
+ color: $fallback--faint;
+ color: var(--panelFaint, $fallback--faint);
+ }
+
a {
color: $fallback--link;
color: var(--panelLink, $fallback--link)
From 298cea8f6d4b906ae38d761a086a53832300ea9e Mon Sep 17 00:00:00 2001
From: Maxim Filippov
Date: Wed, 30 Jan 2019 01:11:40 +0300
Subject: [PATCH 17/20] Split hide_network into hide_followers &
hide_followings
---
src/components/user_settings/user_settings.js | 9 ++++++---
src/components/user_settings/user_settings.vue | 8 ++++++--
src/i18n/de.json | 3 ++-
src/i18n/en.json | 3 ++-
src/i18n/ja.json | 3 ++-
src/i18n/ko.json | 3 ++-
src/i18n/ru.json | 3 ++-
src/services/api/api.service.js | 2 +-
.../entity_normalizer/entity_normalizer.service.js | 3 ++-
9 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index dcce275a..be799f5d 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -10,7 +10,8 @@ const UserSettings = {
newLocked: this.$store.state.users.currentUser.locked,
newNoRichText: this.$store.state.users.currentUser.no_rich_text,
newDefaultScope: this.$store.state.users.currentUser.default_scope,
- newHideNetwork: this.$store.state.users.currentUser.hide_network,
+ hideFollowings: this.$store.state.users.currentUser.hide_followings,
+ hideFollowers: this.$store.state.users.currentUser.hide_followers,
followList: null,
followImportError: false,
followsImported: false,
@@ -66,7 +67,8 @@ const UserSettings = {
/* eslint-disable camelcase */
const default_scope = this.newDefaultScope
const no_rich_text = this.newNoRichText
- const hide_network = this.newHideNetwork
+ const hide_followings = this.hideFollowings
+ const hide_followers = this.hideFollowers
/* eslint-enable camelcase */
this.$store.state.api.backendInteractor
.updateProfile({
@@ -78,7 +80,8 @@ const UserSettings = {
/* eslint-disable camelcase */
default_scope,
no_rich_text,
- hide_network
+ hide_followings,
+ hide_followers
/* eslint-enable camelcase */
}}).then((user) => {
if (!user.error) {
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 4bc2eeec..253bbd34 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -30,8 +30,12 @@
-
-
+
+
+
+
+
+
diff --git a/src/i18n/de.json b/src/i18n/de.json
index c87371e6..82860e9e 100644
--- a/src/i18n/de.json
+++ b/src/i18n/de.json
@@ -155,7 +155,8 @@
"notification_visibility_mentions": "Erwähnungen",
"notification_visibility_repeats": "Wiederholungen",
"no_rich_text_description": "Rich-Text Formatierungen von allen Beiträgen entfernen",
- "hide_network_description": "Zeige nicht, wem ich folge und wer mir folgt",
+ "hide_followings_description": "Zeige nicht, wem ich folge",
+ "hide_followers_description": "Zeige nicht, wer mir folgt",
"nsfw_clickthrough": "Aktiviere ausblendbares Overlay für Anhänge, die als NSFW markiert sind",
"panelRadius": "Panel",
"pause_on_unfocused": "Streaming pausieren, wenn das Tab nicht fokussiert ist",
diff --git a/src/i18n/en.json b/src/i18n/en.json
index 3ff98ab0..a2106f1a 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -157,7 +157,8 @@
"notification_visibility_mentions": "Mentions",
"notification_visibility_repeats": "Repeats",
"no_rich_text_description": "Strip rich text formatting from all posts",
- "hide_network_description": "Don't show who I'm following and who's following me",
+ "hide_followings_description": "Don't show who I'm following",
+ "hide_followers_description": "Don't show who's following me",
"nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding",
"panelRadius": "Panels",
"pause_on_unfocused": "Pause streaming when tab is not focused",
diff --git a/src/i18n/ja.json b/src/i18n/ja.json
index 161856f0..37e96f6c 100644
--- a/src/i18n/ja.json
+++ b/src/i18n/ja.json
@@ -157,7 +157,8 @@
"notification_visibility_mentions": "メンション",
"notification_visibility_repeats": "リピート",
"no_rich_text_description": "リッチテキストをつかわない",
- "hide_network_description": "わたしがフォローしているひとと、わたしをフォローしているひとを、みせない",
+ "hide_followings_description": "フォローしている人を表示しない",
+ "hide_followers_description": "フォローしている人を表示しない",
"nsfw_clickthrough": "NSFWなファイルをかくす",
"panelRadius": "パネル",
"pause_on_unfocused": "タブにフォーカスがないときストリーミングをとめる",
diff --git a/src/i18n/ko.json b/src/i18n/ko.json
index 4b69df07..9f40be51 100644
--- a/src/i18n/ko.json
+++ b/src/i18n/ko.json
@@ -156,7 +156,8 @@
"notification_visibility_mentions": "멘션",
"notification_visibility_repeats": "반복",
"no_rich_text_description": "모든 게시물의 서식을 지우기",
- "hide_network_description": "내 팔로우와 팔로워를 숨기기",
+ "hide_followings_description": "내가 팔로우하는 사람을 표시하지 않음",
+ "hide_followers_description": "나를 따르는 사람을 보여주지 마라.",
"nsfw_clickthrough": "NSFW 이미지 \"클릭해서 보이기\"를 활성화",
"panelRadius": "패널",
"pause_on_unfocused": "탭이 활성 상태가 아닐 때 스트리밍 멈추기",
diff --git a/src/i18n/ru.json b/src/i18n/ru.json
index 0887bb59..bf1e319f 100644
--- a/src/i18n/ru.json
+++ b/src/i18n/ru.json
@@ -127,7 +127,8 @@
"notification_visibility_mentions": "Упоминания",
"notification_visibility_repeats": "Повторы",
"no_rich_text_description": "Убрать форматирование из всех постов",
- "hide_network_description": "Не показывать кого я читаю и кто меня читает",
+ "hide_followings_description": "Не показывать кого я читаю",
+ "hide_followers_description": "Не показывать кто читает меня",
"nsfw_clickthrough": "Включить скрытие NSFW вложений",
"panelRadius": "Панели",
"pause_on_unfocused": "Приостановить загрузку когда вкладка не в фокусе",
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
index 5b0d8650..31b48cb6 100644
--- a/src/services/api/api.service.js
+++ b/src/services/api/api.service.js
@@ -130,7 +130,7 @@ const updateBanner = ({credentials, params}) => {
// description
const updateProfile = ({credentials, params}) => {
// Always include these fields, because they might be empty or false
- const fields = ['description', 'locked', 'no_rich_text', 'hide_network']
+ const fields = ['description', 'locked', 'no_rich_text', 'hide_followings', 'hide_followers']
let url = PROFILE_UPDATE_URL
const form = new FormData()
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index deffa537..fa955ad6 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -100,7 +100,8 @@ export const parseUser = (data) => {
output.rights = data.rights
output.no_rich_text = data.no_rich_text
output.default_scope = data.default_scope
- output.hide_network = data.hide_network
+ output.hide_followings = data.hide_followings
+ output.hide_followers = data.hide_followers
output.background_image = data.background_image
// on mastoapi this info is contained in a "relationship"
output.following = data.following
From 0a39159fdf99143ddf05580f066508e6d5a90773 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Wed, 30 Jan 2019 16:38:28 +0200
Subject: [PATCH 18/20] Adjust scrolling logic and document it, make sure to
never show 'show less' if it's not a tall status
---
src/components/status/status.js | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 558125df..6ef13010 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -179,7 +179,7 @@ const Status = {
return this.tallStatus
},
showingMore () {
- return this.showingTall || (this.status.summary && this.expandingSubject)
+ return (this.tallStatus && this.showingTall) || (this.status.summary && this.expandingSubject)
},
nsfwClickthrough () {
if (!this.status.nsfw) {
@@ -303,11 +303,14 @@ const Status = {
'highlight': function (id) {
if (this.status.id === id) {
let rect = this.$el.getBoundingClientRect()
- if (rect.top < 140) {
- window.scrollBy(0, rect.top - 200)
- } else if (rect.top < window.innerHeight && rect.height >= (window.innerHeight - 50)) {
- window.scrollBy(0, rect.top - 50)
+ if (rect.top < 100) {
+ // Post is above screen, match its top to screen top
+ window.scrollBy(0, rect.top - 100)
+ } else if (rect.height >= (window.innerHeight - 50)) {
+ // Post we want to see is taller than screen so match its top to screen top
+ window.scrollBy(0, rect.top - 100)
} else if (rect.bottom > window.innerHeight - 50) {
+ // Post is below screen, match its bottom to screen bottom
window.scrollBy(0, rect.bottom - window.innerHeight + 50)
}
}
From 16a5272726ec555d49276e291caa1d0ba71200e4 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Wed, 30 Jan 2019 16:57:19 +0200
Subject: [PATCH 19/20] Fix a simple typo
---
src/components/status/status.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 558125df..f85b7847 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -79,7 +79,7 @@ const Status = {
},
replyProfileLink () {
if (this.isReply) {
- return this.generateUserProfileLink(this.status.in_reply_to_status_id, this.replyToName)
+ return this.generateUserProfileLink(this.status.in_reply_to_user_id, this.replyToName)
}
},
retweet () { return !!this.statusoid.retweeted_status },
From 15603981f8309d979465c40175f9b3cd4f6617b4 Mon Sep 17 00:00:00 2001
From: shpuld
Date: Wed, 30 Jan 2019 19:15:35 +0200
Subject: [PATCH 20/20] Capture clicks on statuses to hijack mention clicks,
match mention href to user somehow
---
src/components/status/status.js | 15 ++++-
src/components/status/status.vue | 4 +-
.../mention_matcher/mention_matcher.js | 9 +++
.../mention_matcher/mention_matcher.spec.js | 63 +++++++++++++++++++
4 files changed, 88 insertions(+), 3 deletions(-)
create mode 100644 src/services/mention_matcher/mention_matcher.js
create mode 100644 test/unit/specs/services/mention_matcher/mention_matcher.spec.js
diff --git a/src/components/status/status.js b/src/components/status/status.js
index 558125df..e268ddaa 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -9,6 +9,7 @@ import LinkPreview from '../link-preview/link-preview.vue'
import { filter, find } from 'lodash'
import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js'
import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator'
+import { mentionMatchesUrl } from 'src/services/mention_matcher/mention_matcher.js'
const Status = {
name: 'Status',
@@ -237,11 +238,23 @@ const Status = {
return 'icon-globe'
}
},
- linkClicked ({target}) {
+ linkClicked (event) {
+ let { target } = event
if (target.tagName === 'SPAN') {
target = target.parentNode
}
if (target.tagName === 'A') {
+ if (target.className.match(/mention/)) {
+ const href = target.getAttribute('href')
+ const attn = this.status.attentions.find(attn => mentionMatchesUrl(attn, href))
+ if (attn) {
+ event.stopPropagation()
+ event.preventDefault()
+ const link = this.generateUserProfileLink(attn.id, attn.screen_name)
+ this.$router.push(link)
+ return
+ }
+ }
window.open(target.href, '_blank')
}
},
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index d88428c7..45100a46 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -24,9 +24,9 @@