git ssb

10+

Matt McKegg / patchwork



Commit 593dfd760dee299082f615e02f2747f1c6f660ec

Merge branch 'not_following' of https://github.com/Happy0/patchwork

Conflicts:
	locales/en.json
	modules/page/html/render/channel.js
Matt McKegg committed on 1/29/2018, 10:43:14 PM
Parent: b1c890d592e7fb5f231385508a3bc61f145d4a5b
Parent: be34adb18ee4724cd9d1a6a8fdaf95891e4c516d

Files changed

locales/en.jsonchanged
modules/feed/html/follow-warning.jsadded
modules/page/html/render/channel.jschanged
modules/page/html/render/public.jschanged
modules/profile/obs/contact.jschanged
styles/dark/profile-header.mcsschanged
styles/dark/$distance-warning.mcssadded
styles/dark/not-following-anyone.mcssadded
styles/light/profile-header.mcsschanged
styles/light/$distance-warning.mcssadded
styles/light/not-following-anyone.mcssadded
locales/en.jsonView
@@ -1,203 +1,161 @@
11 {
2- "$name": "English",
3- "es": "Spanish",
4- "ki": "Kashmiri",
5- "Patchwork": "Patchwork",
6- "Public": "Public",
7- "Private": "Private",
8- "Write a public message": "Write a public message",
9- "Active Channels": "Active Channels",
10- "Loading": "Loading",
11- "Local": "Local",
12- "Connected Pubs": "Connected Pubs",
13- "Who to follow": "Who to follow",
14- "Unsubscribe": "Unsubscribe",
15- "Subscribe": "Subscribe",
162 "Publishing...": "Publishing...",
3+ "Publish Privately": "Publish Privately",
174 "Publish": "Publish",
18- "Show ": "Show ",
5+ "Welcome to Patchwork": "Welcome to Patchwork",
6+ "You may not be able to see new content until you follow some users or pubs.": "You may not be able to see new content until you follow some users or pubs.",
7+ "For help, see the 'Getting Started' guide at ": "For help, see the 'Getting Started' guide at ",
198 "update": "update",
209 "updates": "updates",
2110 "+ Join Pub": "+ Join Pub",
22- "word, @key, #channel": "word, @key, #channel",
23- "Profile": "Profile",
24- "Mentions": "Mentions",
25- " liked this message": " liked this message",
26- "View full thread": "View full thread",
27- " replied": " replied",
28- " replied to ": " replied to ",
29- "like": "like",
30- " and ": " and ",
31- " followed ": " followed ",
32- " subscribed to ": " subscribed to ",
33- "likes": "likes",
34- " others": " others",
35- "Write a private reply": "Write a private reply",
36- "Write a public reply": "Write a public reply",
11+ "Active Channels": "Active Channels",
3712 "More Channels...": "More Channels...",
38- "Cannot display message.": "Cannot display message.",
39- "All Posts from Your ": "All Posts from Your ",
40- "Click to unsubscribe": "Click to unsubscribe",
41- "Subscribed": "Subscribed",
42- "Write a message in this channel": "Write a message in this channel\n\n\n\nPeople who follow you or subscribe to this channel will also see this message in their main feed.\n\nTo create a new channel, type the channel name (preceded by a #) into the search box above. e.g #cat-pics",
43- "liked this message": "liked this message",
44- "replied to this message": "replied to this message",
45- "added changes": "added changes",
46- "mentioned you": "mentioned you",
47- "mentioned this channel": "mentioned this channel",
48- "Write a private message": "Write a private message \n\n\n\nThis can only be read by yourself and people you have @mentioned.",
13+ "Local": "Local",
14+ "Connected Pubs": "Connected Pubs",
15+ "Who to follow": "Who to follow",
16+ "Write a private message": "Write a private message",
4917 "Edit Your Profile": "Edit Your Profile",
50- "Click to unfollow": "Click to unfollow",
18+ "Public key for this profile": "Public key for this profile",
19+ "This person is blocked by %s of your friends.": {
20+ "one": "This person is blocked by %s of your friends.",
21+ "other": "This person is blocked by %s of your friends."
22+ },
23+ "You don't follow anyone who follows this person": "You don't follow anyone who follows this person",
24+ "You might not be seeing their latest messages. You could try joining a pub that they are a member of.": "You might not be seeing their latest messages. You could try joining a pub that they are a member of.",
25+ "However, since they follow someone that follows you, they should be able to see your posts.": "However, since they follow someone that follows you, they should be able to see your posts.",
26+ "They might not be able to see your posts either.": "They might not be able to see your posts either.",
27+ "This person does not follow anyone that follows you": "This person does not follow anyone that follows you",
28+ "They might not receive your private messages or replies. You could try joining a pub that they are a member of.": "They might not receive your private messages or replies. You could try joining a pub that they are a member of.",
29+ "However, since you follow someone that follows them, you should be able to see their latest posts.": "However, since you follow someone that follows them, you should be able to see their latest posts.",
30+ "Mutual Friends": "Mutual Friends",
31+ "You share %s mutual friends with this person.": {
32+ "one": "You share %s mutual friends with this person.",
33+ "other": "You share %s mutual friends with this person."
34+ },
35+ "Followed by": "Followed by",
36+ "You follow %s people that follow this person.": {
37+ "one": "You follow %s people that follow this person.",
38+ "other": "You follow %s people that follow this person."
39+ },
40+ "Send Private Message": "Send Private Message",
5141 "Friends": "Friends",
42+ "Followers": "Followers",
5243 "Following": "Following",
53- "Follow Back": "Follow Back",
54- "Follow": "Follow",
55- "Followers": "Followers",
44+ "Blocked by": "Blocked by",
45+ "Public": "Public",
46+ "Private": "Private",
5647 "More": "More",
5748 "Gatherings": "Gatherings",
5849 "Extended Network": "Extended Network",
5950 "Settings": "Settings",
51+ "Patchwork": "Patchwork",
6052 "Upgrading database": "Upgrading database",
6153 "Downloading new messages": "Downloading new messages",
6254 "Indexing database": "Indexing database",
6355 "Scuttling...": "Scuttling...",
56+ "word, @key, #channel": "word, @key, #channel",
57+ "Profile": "Profile",
58+ "Mentions": "Mentions",
6459 " has been released.": " has been released.",
6560 " Click here to download and view more info!": " Click here to download and view more info!",
6661 "Self Assigned": "Self Assigned",
6762 "Assigned By": "Assigned By",
68- "self assigned a description": "self assigned a description",
69- "in reply to ": "in reply to ",
70- "subscribed to ": "subscribed to ",
7163 "followed ": "followed ",
72- "identifies ": "identifies ",
73- " as \"": " as \"",
74- "paste invite code here": "paste invite code here",
75- "By default, Patchwork will only see other users that are on the same local area network as you.": "By default, Patchwork will only see other users that are on the same local area network as you.",
76- "In order to share with users on the internet, you need to be invited to a pub server.": "In order to share with users on the internet, you need to be invited to a pub server.",
77- "Redeem Invite": "Redeem Invite",
78- "Cancel": "Cancel",
79- "Channels": "Channels",
80- "Browse All": "Browse All",
81- " from your extended network": " from your extended network",
82- "+ Add Gathering": "+ Add Gathering",
83- " referenced this message:": " referenced this message:",
84- "Create": "Create",
85- " Gathering": " Gathering",
86- "Choose a title": "Choose a title",
87- "Choose date and time": "Choose date and time",
88- "Choose Banner Image...": "Choose Banner Image...",
89- "Describe the gathering (if you want)": "Describe the gathering (if you want)",
90- "Edit": "Edit",
91- "identified ": "identified ",
92- "self identifies as ": "self identifies as ",
9364 "from now": "from now",
9465 "ago": "ago",
9566 "years": "years",
9667 "months": "months",
9768 "weeks": "weeks",
9869 "days": "days",
9970 "hours": "hours",
100- "minutes": "mins",
101- "seconds": "secs",
71+ "minutes": "minutes",
72+ "seconds": "seconds",
10273 "year": "year",
10374 "month": "month",
10475 "week": "week",
10576 "day": "day",
10677 "hour": "hour",
107- "minute": "min",
108- "second": "sec",
109- "assigned a display image to ": "assigned a display image to ",
78+ "minute": "minute",
79+ "second": "second",
80+ "Reply": "Reply",
81+ "View full thread": "View full thread",
82+ "Unsubscribe": "Unsubscribe",
83+ "Subscribe": "Subscribe",
84+ "Force Disconnect": "Force Disconnect",
85+ "(you)": "(you)",
86+ "in reply to ": "in reply to ",
87+ "See less": "See less",
88+ "See more": "See more",
89+ "mentioned you": "mentioned you",
90+ " and ": " and ",
91+ "Liked by": "Liked by",
92+ "likes": "likes",
93+ "liked this message": "liked this message",
94+ "like": "like",
95+ "replied to this message": "replied to this message",
96+ "unfollowed ": "unfollowed ",
97+ " others": " others",
98+ "Write a public message": "Write a public message",
99+ "New Message": "New Message",
100+ "%s people from your network replied to this message on ": {
101+ "one": "%s person from your network replied to this message on ",
102+ "other": "%s people from your network replied to this message on "
103+ },
104+ "mentioned in your network": "mentioned in your network",
105+ "Channels": "Channels",
106+ "Browse All": "Browse All",
107+ "$name": "$name",
110108 "Theme": "Theme",
111109 "Language": "Language",
112- "Filters": "Filters",
110+ "Default": "Default",
111+ "de": "de",
112+ "en": "en",
113+ "es": "es",
114+ "ki": "ki",
115+ "pt": "pt",
116+ "pt-BR": "pt-BR",
117+ "Public Feed Options": "Public Feed Options",
113118 "Hide following messages": "Hide following messages",
114- "Cannot display message": "Cannot display message",
119+ "This is you.": "This is you.",
120+ "Click to unblock": "Click to unblock",
121+ "Blocked": "Blocked",
122+ "Click to unfollow": "Click to unfollow",
123+ "Follow Back": "Follow Back",
124+ "Follow": "Follow",
125+ "Click to block syncing with this person and hide their posts": "Click to block syncing with this person and hide their posts",
126+ "Block": "Block",
127+ "Write a private reply": "Write a private reply",
128+ "Write a public reply": "Write a public reply",
129+ "External Link": "External Link",
130+ "subscribed to ": "subscribed to ",
131+ "unsubscribed from ": "unsubscribed from ",
132+ "Click to unsubscribe": "Click to unsubscribe",
133+ "Subscribed": "Subscribed",
134+ "Write a message in this channel": "Write a message in this channel",
135+ "mentioned this channel": "mentioned this channel",
136+ "You may not be able to see new channel content until you follow some users or pubs.": "You may not be able to see new channel content until you follow some users or pubs.",
115137 "Search Results:": "Search Results:",
116138 "Search completed.": "Search completed.",
117139 "result found": "result found",
118140 "results found": "results found",
141+ "blocked ": "blocked ",
142+ "Confirm": "Confirm",
143+ "Cancel": "Cancel",
144+ "Unread Message": "Unread Message",
145+ "Font Size": "Font Size",
146+ "Only include posts from subscribed channels": "Only include posts from subscribed channels",
147+ "Information": "Information",
148+ "Hide channel (un)subcribe messages": "Hide channel (un)subcribe messages",
149+ "Channel Feed Options": "Channel Feed Options",
119150 " forked this discussion:": " forked this discussion:",
151+ "You are not following anyone": "You are not following anyone",
152+ "For help getting started, see the guide at ": "For help getting started, see the guide at ",
153+ "added changes": "added changes",
120154 "Your Profile": "Your Profile",
121155 "Choose Profile Image...": "Choose Profile Image...",
122156 "Choose a name": "Choose a name",
123157 "Describe yourself (if you want)": "Describe yourself (if you want)",
124- "What would you like to call ": "What would you like to call ",
125- "Confirm": "Confirm",
126- "self assigned a display image": "self assigned a display image",
127- "Like": "Like",
128- "Reply": "Reply",
129- "unfollowed ": "unfollowed ",
130- "Untitled Gathering": "Untitled Gathering",
131- "Error": "Error",
132- "An error occurred while attempting to publish gathering.": "An error occurred while attempting to publish gathering.",
133- "An error occurred while attempting to redeem invite.": "An error occurred while attempting to redeem invite.",
134- "OK": "OK",
135- "Close": "Close",
136- "New Message": "New Message",
137- "unsubscribed from ": "unsubscribed from ",
138- "en": "en",
139- "on ": "on ",
140- "de": "German",
141- "Private Message": "Private Message",
142- "Send Private Message": "Send Private Message",
143- "Publish Privately": "Publish Privately",
144- "Block": "Block",
145- "Click to unblock": "Click to unblock",
146- "Blocked": "Blocked",
147- "pt": "pt",
148- "blocked ": "blocked ",
149- "unblocked ": "unblocked ",
150- "Click to block syncing with this person and hide their posts": "Click to block syncing with this person and hide their posts",
151- "Public key for this profile": "Public key for this profile",
152- "Liked by": "Liked by",
153- "You don't follow anyone who follows this person": "You don't follow anyone who follows this person",
154- "You might not be seeing their latest messages. You could try joining a pub that they are a member of.": "You might not be seeing their latest messages. You could try joining a pub that they are a member of.",
155- "Mutual Friends": "Mutual Friends",
156- "You share %s mutual friends with this person.": {
157- "one": "You share %s mutual friend with this person.",
158- "other": "You share %s mutual friends with this person."
159- },
160- "This person does not follow anyone that follows you": "This person does not follow anyone that follows you",
161- "They might not receive your private messages or replies. You could try joining a pub that they are a member of.": "They might not receive your private messages or replies. You could try joining a pub that they are a member of.",
162- "External Link": "External Link",
163- "This is you.": "This is you.",
164- "This person is blocked by %s of your friends.": {
165- "one": "This person is blocked by %s of your friends.",
166- "other": "This person is blocked by %s of your friends."
167- },
168- "Blocked by": "Blocked by",
169- "However, this person should be able to see your posts.": "However, this person should be able to see your posts.",
170- "However, since they follow someone that follows you, they should be able to see your posts.": "However, since they follow someone that follows you, they should be able to see your posts.",
171- "They might not be able to see your posts either.": "They might not be able to see your posts either.",
172- "However, since you follow someone that follows them, you should be able to see their latest posts.": "However, since you follow someone that follows them, you should be able to see their latest posts.",
173- "An error occured while publishing your message.": "An error occured while publishing your message.",
174158 "Missing message": "Missing message",
175159 " via ": " via ",
176- "Cannot load thread": "Cannot load thread",
177- "The author of this message could be outside of your follow range or they may be blocked.": "The author of this message could be outside of your follow range or they may be blocked.",
178- "You follow %s people that follow this person.": {
179- "one": "You follow someone that follows this person.",
180- "other": "You follow %s people that follow this person."
181- },
182- "Followed by": "Followed by",
183- "pt-BR": "Brazillian Portuguese",
184- "See less": "See less",
185- "See more": "See more",
186- "(missing message)": "(missing message)",
187- "assigned a description to ": "assigned a description to ",
188- "Unread Message": "Unread Message",
189- "Font Size": "Font Size",
190- "Public Feed Options": "Public Feed Options",
191- "Only include posts from subscribed channels": "Only include posts from subscribed channels",
192- "Default": "Default",
193- "Force Disconnect": "Force Disconnect",
194- "mentioned in your network": "mentioned in your network",
195- "%s people from your network replied to this message on ": {
196- "one": "%s person from your network replied to this message on ",
197- "other": "%s people from your network replied to this message on "
198- },
199- "(you)": "(you)",
200- "Information": "Information",
201- "Hide channel (un)subcribe messages": "Hide channel (un)subcribe messages",
202- "Channel Feed Options": "Channel Feed Options"
160+ "The author of this message could be outside of your follow range or they may be blocked.": "The author of this message could be outside of your follow range or they may be blocked."
203161 }
modules/feed/html/follow-warning.jsView
@@ -1,0 +1,27 @@
1+var nest = require('depnest')
2+var { when } = require('mutant')
3+
4+exports.needs = nest({
5+ 'intl.sync.i18n': 'first'
6+})
7+
8+exports.gives = nest({
9+ 'feed.html.followWarning': true
10+});
11+
12+exports.create = function(api) {
13+ const i18n = api.intl.sync.i18n
14+ return nest('feed.html.followWarning', function warning (condition, explanation) {
15+ var content =
16+ h('div', {classList: 'NotFollowingAnyoneWarning'}, h('section -notFollowingAnyoneWarning', [
17+ h('h1', i18n('You are not following anyone')),
18+ h('p', explanation),
19+ h('p', [i18n('For help getting started, see the guide at '),
20+ h('a', {href: 'https://scuttlebutt.nz/getting-started.html'}, 'https://scuttlebutt.nz/getting-started.html')]
21+ ),
22+ ]))
23+
24+ return when(condition, content);
25+ });
26+
27+}
modules/page/html/render/channel.jsView
@@ -5,14 +5,16 @@
55 'channel.obs.subscribed': 'first',
66 'message.html.compose': 'first',
77 'channel.sync.normalize': 'first',
88 'feed.html.rollup': 'first',
9+ 'feed.html.followWarning': 'first',
910 'feed.pull.channel': 'first',
1011 'sbot.pull.log': 'first',
1112 'message.async.publish': 'first',
1213 'keys.sync.id': 'first',
1314 'intl.sync.i18n': 'first',
14- 'settings.obs.get': 'first'
15+ 'settings.obs.get': 'first',
16+ 'profile.obs.contact': 'first'
1517 })
1618
1719 exports.gives = nest('page.html.render')
1820
@@ -20,11 +22,15 @@
2022 const i18n = api.intl.sync.i18n
2123 return nest('page.html.render', function channel (path) {
2224 if (path[0] !== '#') return
2325
26+ var id = api.keys.sync.id()
27+
2428 var channel = api.channel.sync.normalize(path.substr(1))
25- var subscribedChannels = api.channel.obs.subscribed(api.keys.sync.id())
29+ var subscribedChannels = api.channel.obs.subscribed(id)
2630
31+ var contact = api.profile.obs.contact(id)
32+
2733 var prepend = [
2834 h('PageHeading', [
2935 h('h1', `#${channel}`),
3036 h('div.meta', [
@@ -43,9 +49,10 @@
4349 ]),
4450 api.message.html.compose({
4551 meta: {type: 'post', channel},
4652 placeholder: i18n('Write a message in this channel')
47- })
53+ }),
54+ noVisibleNewPostsWarning()
4855 ]
4956
5057 const filters = api.settings.obs.get('filters')
5158 const channelView = api.feed.html.rollup(
@@ -90,8 +97,14 @@
9097 if (typeof link === 'string' && link.startsWith('#')) {
9198 return `#${api.channel.sync.normalize(link.slice(1))}`
9299 }
93100 }
101+
102+ function noVisibleNewPostsWarning() {
103+ var warning = i18n('You may not be able to see new channel content until you follow some users or pubs.')
104+ return api.feed.html.followWarning(contact.isNotFollowingAnybody, warning);
105+ }
106+
94107 })
95108
96109 function subscribe (id) {
97110 // confirm
modules/page/html/render/public.jsView
@@ -21,10 +21,12 @@
2121 'message.async.publish': 'first',
2222 'message.sync.root': 'first',
2323 'progress.html.peer': 'first',
2424
25+ 'feed.html.followWarning': 'first',
2526 'feed.html.rollup': 'first',
2627 'profile.obs.recentlyUpdated': 'first',
28+ 'profile.obs.contact': 'first',
2729 'contact.obs.following': 'first',
2830 'contact.obs.blocking': 'first',
2931 'channel.obs': {
3032 subscribed: 'first',
@@ -56,11 +58,13 @@
5658 var channels = computed(recentChannels, items => items.slice(0, 8), {comparer: arrayEq})
5759 var connectedPeers = api.sbot.obs.connectedPeers()
5860 var localPeers = api.sbot.obs.localPeers()
5961 var connectedPubs = computed([connectedPeers, localPeers], (c, l) => c.filter(x => !l.includes(x)))
62+ var contact = api.profile.obs.contact(id)
6063
6164 var prepend = [
62- api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') })
65+ api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') }),
66+ noVisibleNewPostsWarning()
6367 ]
6468
6569 var lastMessage = null
6670
@@ -263,8 +267,18 @@
263267 ])
264268 ]
265269 }
266270
271+ function noVisibleNewPostsWarning() {
272+ var explanation = i18n('You may not be able to see new content until you follow some users or pubs.')
273+
274+ var shownWhen = computed([loading, contact.isNotFollowingAnybody],
275+ (isLoading,isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody
276+ )
277+
278+ return api.feed.html.followWarning(shownWhen, explanation);
279+ }
280+
267281 function subscribe (id) {
268282 api.message.async.publish({
269283 type: 'channel',
270284 channel: id,
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,
styles/dark/profile-header.mcssView
@@ -46,26 +46,9 @@
4646 }
4747 }
4848 }
4949 -distanceWarning {
50- padding: 8px;
51- border: 1px solid #ffba4e;
52- background: #5f410b;
53- margin: 5px 0;
54- color: #ffdda7;
55- font-size: 110%
56-
57- h1 {
58- font-size: 120%
59- font-weight: bold
60- margin: 0
61- color: white
62- }
63-
64- p {
65- margin: 0
66- margin-top: 8px
67- }
50+ $distanceWarning
6851 }
6952
7053 -blockWarning {
7154 padding: 8px;
styles/dark/$distance-warning.mcssView
@@ -1,0 +1,20 @@
1+$distanceWarning {
2+ padding: 8px;
3+ border: 1px solid #ffba4e;
4+ background: #5f410b;
5+ margin: 5px 0;
6+ color: #ffdda7;
7+ font-size: 110%
8+
9+ h1 {
10+ font-size: 120%
11+ font-weight: bold
12+ margin: 0
13+ color: white
14+ }
15+
16+ p {
17+ margin: 0
18+ margin-top: 8px
19+ }
20+}
styles/dark/not-following-anyone.mcssView
@@ -1,0 +1,8 @@
1+NotFollowingAnyoneWarning {
2+ section {
3+ padding: 20px 20px 20px 20px
4+ width: 700px
5+
6+ $distanceWarning
7+ }
8+}
styles/light/profile-header.mcssView
@@ -49,26 +49,9 @@
4949 padding: 3px;
5050 }
5151 }
5252 -distanceWarning {
53- padding: 8px;
54- border: 1px solid #ffc965;
55- background: #ffebcc;
56- margin: 5px 0;
57- color: #8a6800;
58- font-size: 110%
59-
60- h1 {
61- font-size: 120%
62- font-weight: bold
63- margin: 0
64- color: #583805
65- }
66-
67- p {
68- margin: 0
69- margin-top: 8px
70- }
53+ $distanceWarning
7154 }
7255
7356 -blockWarning {
7457 padding: 8px;
styles/light/$distance-warning.mcssView
@@ -1,0 +1,20 @@
1+$distanceWarning {
2+ padding: 8px;
3+ border: 1px solid #ffc965;
4+ background: #ffebcc;
5+ margin: 5px 0;
6+ color: #8a6800;
7+ font-size: 110%
8+
9+ h1 {
10+ font-size: 120%
11+ font-weight: bold
12+ margin: 0
13+ color: #583805
14+ }
15+
16+ p {
17+ margin: 0
18+ margin-top: 8px
19+ }
20+}
styles/light/not-following-anyone.mcssView
@@ -1,0 +1,8 @@
1+NotFollowingAnyoneWarning {
2+ section {
3+ padding: 20px 20px 20px 20px
4+ width: 700px
5+
6+ $distanceWarning
7+ }
8+}

Built with git-ssb-web