git ssb

10+

Matt McKegg / patchwork



Commit ceb8fe08c9c9159165f0bf3cc567482b4c6f865c

Show warning when the user is not following anyone, therefore may not be able to see new context. Fixes #707.

Gordon Martin committed on 12/27/2017, 8:11:05 PM
Parent: d03c7f58d6304a8be28e2f1640185c01a4f231d1

Files changed

modules/page/html/render/public.jschanged
modules/profile/obs/contact.jschanged
modules/page/html/render/public.jsView
@@ -23,8 +23,9 @@
2323 'progress.html.peer': 'first',
2424
2525 'feed.html.rollup': 'first',
2626 'profile.obs.recentlyUpdated': 'first',
27+ 'profile.obs.contact': 'first',
2728 'contact.obs.following': 'first',
2829 'contact.obs.blocking': 'first',
2930 'channel.obs': {
3031 subscribed: 'first',
@@ -56,8 +57,9 @@
5657 var channels = computed(recentChannels, items => items.slice(0, 8), {comparer: arrayEq})
5758 var connectedPeers = api.sbot.obs.connectedPeers()
5859 var localPeers = api.sbot.obs.localPeers()
5960 var connectedPubs = computed([connectedPeers, localPeers], (c, l) => c.filter(x => !l.includes(x)))
61+ var contact = api.profile.obs.contact(id)
6062
6163 var prepend = [
6264 api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') })
6365 ]
@@ -129,9 +131,14 @@
129131 var result = h('div.SplitView', [
130132 h('div.side', [
131133 getSidebar()
132134 ]),
133- h('div.main', feedView)
135+ h('div.main', [
136+ when(
137+ computed([contact.isNotFollowingAnybody, loading], (a,b) => a && !b),
138+ renderNoVisiblePostsWarning()
139+ ),
140+ feedView])
134141 ])
135142
136143 result.pendingUpdates = feedView.pendingUpdates
137144 result.reload = function () {
@@ -282,8 +289,17 @@
282289 }
283290 }
284291 }
285292
293+function renderNoVisiblePostsWarning() {
294+ return h('div', {classList: 'PublicFeed main'}, h('section -notFollowingAnyoneWarning', [
295+ h('h1', '⚠️ You are not following anybody.'),
296+ h('h3', `You may not be able to see new posts and replies.`),
297+ h('h3', 'You can only see new posts from people you follow, and people that they follow.'),
298+ h('h3', 'Follow one or more users to see some new posts.')
299+ ]))
300+}
301+
286302 function getType (msg) {
287303 return msg && msg.value && msg.value.content && msg.value.content.type
288304 }
289305
modules/profile/obs/contact.jsView
@@ -44,8 +44,12 @@
4444 })
4545
4646 var isYou = computed([yourId, id], (a, b) => a === b)
4747
48+ var isNotFollowingAnybody = computed(following,
49+ followingList => (!followingList || followingList.length == 0)
50+ );
51+
4852 return {
4953 followers,
5054 following,
5155 blockers,
@@ -57,8 +61,9 @@
5761 outgoingViaCount: count(outgoingVia),
5862 incomingVia,
5963 incomingViaCount: count(incomingVia),
6064 hasOutgoing,
65+ isNotFollowingAnybody,
6166 noOutgoing: not(hasOutgoing, isYou),
6267 hasIncoming,
6368 noIncoming: not(hasIncoming, isYou),
6469 yourId,

Built with git-ssb-web