git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Commit f0235b59cf6966ab85150a690a3c660bc0dc7f15

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

Matt McKegg committed on 2/20/2018, 10:07:09 PM
Parent: 7c7feee8615ea9cfc144f577bab8d04780842935
Parent: 326fb93e823ad0d86a6ac3595ecdb6d267b01b8f

Files changed

index.jschanged
locales/en.jsonchanged
modules/feed/html/follow-warning.jschanged
modules/page/html/render/public.jschanged
modules/profile/obs/contact.jschanged
index.jsView
@@ -24,24 +24,23 @@
2424 * scuttlebot instances that conflict on the same port. Before opening patchwork,
2525 * we check if it's already running and if it is we focus the existing window
2626 * rather than opening a new instance.
2727 */
28-function quitIfAlreadyRunning() {
29- var shouldQuit = electron.app.makeSingleInstance(function(commandLine, workingDirectory) {
28+function quitIfAlreadyRunning () {
29+ var shouldQuit = electron.app.makeSingleInstance(function (commandLine, workingDirectory) {
3030 // Someone tried to run a second instance, we should focus our window.
3131 if (windows.main) {
32- if (windows.main.isMinimized()) windows.main.restore();
33- windows.main.focus();
32+ if (windows.main.isMinimized()) windows.main.restore()
33+ windows.main.focus()
3434 }
35- });
35+ })
3636
3737 if (shouldQuit) {
38- electron.app.quit();
39- return;
38+ electron.app.quit()
4039 }
4140 }
4241
43-quitIfAlreadyRunning();
42+quitIfAlreadyRunning()
4443
4544 electron.app.on('ready', () => {
4645 setupContext('ssb', {
4746 server: !(process.argv.includes('-g') || process.argv.includes('--use-global-ssb'))
locales/en.jsonView
@@ -1,25 +1,27 @@
11 {
22 "Publishing...": "Publishing...",
33 "Publish Privately": "Publish Privately",
44 "Publish": "Publish",
5- "Welcome to Patchwork": "Welcome to Patchwork",
65 "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 ",
6+ "You are not following anyone": "You are not following anyone",
7+ "For help getting started, see the guide at ": "For help getting started, see the guide at ",
8+ "Nobody will be able to see your posts until you have a follower. The easiest way to get a follower is to use a pub invite as the pub will follow you back. If you have already redeemed a pub invite and you see it has not followed you back on your profile, try another pub.": "Nobody will be able to see your posts until you have a follower. The easiest way to get a follower is to use a pub invite as the pub will follow you back. If you have already redeemed a pub invite and you see it has not followed you back on your profile, try another pub.",
9+ "You have no followers": "You have no followers",
810 "update": "update",
911 "updates": "updates",
1012 "+ Join Pub": "+ Join Pub",
1113 "Active Channels": "Active Channels",
1214 "More Channels...": "More Channels...",
1315 "Local": "Local",
1416 "Connected Pubs": "Connected Pubs",
1517 "Who to follow": "Who to follow",
16- "Write a private message": "Write a private message \n\n\n\nThis can only be read by yourself and people you have @mentioned.",
18+ "Write a private message": "Write a private message",
1719 "Edit Your Profile": "Edit Your Profile",
1820 "Public key for this profile": "Public key for this profile",
1921 "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+ "one": "This person is blocked by %s of your friends.",
23+ "other": "This person is blocked by %s of your friends."
2224 },
2325 "You don't follow anyone who follows this person": "You don't follow anyone who follows this person",
2426 "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.",
2527 "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.",
@@ -28,15 +30,15 @@
2830 "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.",
2931 "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.",
3032 "Mutual Friends": "Mutual Friends",
3133 "You share %s mutual friends with this person.": {
32- "one": "You share %s mutual friend with this person.",
33- "other": "You share %s mutual friends with this person."
34+ "one": "You share %s mutual friends with this person.",
35+ "other": "You share %s mutual friends with this person."
3436 },
3537 "Followed by": "Followed by",
3638 "You follow %s people that follow this person.": {
37- "one": "You follow someone that follows this person.",
38- "other": "You follow %s people that follow this person."
39+ "one": "You follow %s people that follow this person.",
40+ "other": "You follow %s people that follow this person."
3941 },
4042 "Send Private Message": "Send Private Message",
4143 "Friends": "Friends",
4244 "Followers": "Followers",
@@ -57,129 +59,89 @@
5759 "Profile": "Profile",
5860 "Mentions": "Mentions",
5961 " has been released.": " has been released.",
6062 " Click here to download and view more info!": " Click here to download and view more info!",
63+ "Force Disconnect": "Force Disconnect",
64+ "View %s more": {
65+ "one": "View %s more",
66+ "other": "View %s more"
67+ },
6168 "Self Assigned": "Self Assigned",
6269 "Assigned By": "Assigned By",
63- "followed ": "followed ",
6470 "from now": "from now",
6571 "ago": "ago",
6672 "years": "years",
6773 "months": "months",
6874 "weeks": "weeks",
6975 "days": "days",
7076 "hours": "hours",
71- "minutes": "mins",
72- "seconds": "secs",
77+ "minutes": "minutes",
78+ "seconds": "seconds",
7379 "year": "year",
7480 "month": "month",
7581 "week": "week",
7682 "day": "day",
7783 "hour": "hour",
78- "minute": "min",
79- "second": "sec",
84+ "minute": "minute",
85+ "second": "second",
86+ "Liked by": "Liked by",
87+ "likes": "likes",
88+ "See less": "See less",
89+ "See more": "See more",
8090 "Reply": "Reply",
91+ "mentioned you": "mentioned you",
8192 "View full thread": "View full thread",
82- "Unsubscribe": "Unsubscribe",
83- "Subscribe": "Subscribe",
84- "Force Disconnect": "Force Disconnect",
8593 "(you)": "(you)",
94+ "replied to this message": "replied to this message",
8695 "in reply to ": "in reply to ",
87- "See less": "See less",
88- "See more": "See more",
89- "mentioned you": "mentioned you",
96+ "mentioned in your network": "mentioned in your network",
97+ "followed ": "followed ",
98+ " referenced this message:": " referenced this message:",
99+ "added changes": "added changes",
90100 " and ": " and ",
91- "Liked by": "Liked by",
92- "likes": "likes",
93- "liked this message": "liked this message",
94101 "like": "like",
95- "replied to this message": "replied to this message",
102+ "%s people from your network replied to this message on ": {
103+ "one": "%s people from your network replied to this message on ",
104+ "other": "%s people from your network replied to this message on "
105+ },
96106 "unfollowed ": "unfollowed ",
97- " others": " others",
107+ "subscribed to ": "subscribed to ",
98108 "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 "
109+ "Click to unsubscribe": "Click to unsubscribe",
110+ "Subscribed": "Subscribed",
111+ "Subscribe": "Subscribe",
112+ "You follow %s people that subscribe to this channel.": {
113+ "one": "You follow %s people that subscribe to this channel.",
114+ "other": "You follow %s people that subscribe to this channel."
103115 },
104- "mentioned in your network": "mentioned in your network",
105- "Channels": "Channels",
106- "Browse All": "Browse All",
107- "$name": "English",
108- "Theme": "Theme",
109- "Language": "Language",
110- "Default": "Default",
111- "de": "German",
112- "en": "en",
113- "es": "Spanish",
114- "ki": "Kashmiri",
115- "pt": "pt",
116- "pt-BR": "Brazillian Portuguese",
117- "Public Feed Options": "Public Feed Options",
118- "Hide following messages": "Hide following messages",
119- "This is you.": "This is you.",
116+ "Write a message in this channel": "Write a message in this channel",
117+ "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.",
118+ "mentioned this channel": "mentioned this channel",
119+ " others": " others",
120120 "Click to unblock": "Click to unblock",
121121 "Blocked": "Blocked",
122122 "Click to unfollow": "Click to unfollow",
123123 "Follow Back": "Follow Back",
124124 "Follow": "Follow",
125125 "Click to block syncing with this person and hide their posts": "Click to block syncing with this person and hide their posts",
126126 "Block": "Block",
127+ "This is you.": "This is you.",
128+ "assigned a display image to ": "assigned a display image to ",
129+ "Close": "Close",
130+ "self identifies as ": "self identifies as ",
131+ "New Message": "New Message",
127132 "Write a private reply": "Write a private reply",
128133 "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\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",
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.",
134+ "self assigned a description": "self assigned a description",
135+ "liked this message": "liked this message",
136+ "Confirm": "Confirm",
137+ "Cancel": "Cancel",
138+ "self assigned a display image": "self assigned a display image",
137139 "Search Results:": "Search Results:",
138140 "Search completed.": "Search completed.",
139141 "result found": "result found",
140142 "results found": "results found",
141- "blocked ": "blocked ",
142- "Confirm": "Confirm",
143- "Cancel": "Cancel",
144143 "Unread Message": "Unread Message",
145- "Font Size": "Font Size",
146- "Hide posts in channels that are not subscribed": "Hide posts in channels that are not subscribed",
147- "Information": "Information",
148- "Hide channel (un)subcribe messages": "Hide channel (un)subcribe messages",
149- "Channel Feed Options": "Channel Feed Options",
150144 " 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",
154- "Your Profile": "Your Profile",
155- "Choose Profile Image...": "Choose Profile Image...",
156- "Choose a name": "Choose a name",
157- "Describe yourself (if you want)": "Describe yourself (if you want)",
158- "Missing message": "Missing message",
159- " via ": " via ",
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.",
161- "Close": "Close",
162- " referenced this message:": " referenced this message:",
163145 "on ": "on ",
164- "You follow %s people that subscribe to this channel.": {
165- "one": "You follow %s person that subscribes to this channel.",
166- "other": "You follow %s people that subscribe to this channel."
167- },
168- "People you follow that subscribe to this channel": "People you follow that subscribe to this channel",
169- " from your extended network": " from your extended network",
170- "+ Add Gathering": "+ Add Gathering",
171- "View %s more": {
172- "one": "View %s more",
173- "other": "View %s more"
174- },
175- "self identifies as ": "self identifies as ",
176- "self assigned a description": "self assigned a description",
177- "self assigned a display image": "self assigned a display image",
178- "assigned a display image to ": "assigned a display image to ",
179- "Browse Channels": "Browse Channels",
180- "identifies ": "identifies ",
181- " as \"": " as \"",
182- "unblocked ": "unblocked ",
183- "identified ": "identified ",
184- "All Posts from Your ": "All Posts from Your "
185- }
146+ "External Link": "External Link"
147+}
modules/feed/html/follow-warning.jsView
@@ -5,21 +5,35 @@
55 'intl.sync.i18n': 'first'
66 })
77
88 exports.gives = nest({
9- 'feed.html.followWarning': true
9+ 'feed.html.followWarning': true,
10+ 'feed.html.followerWarning': true
1011 })
1112
1213 exports.create = function (api) {
1314 const i18n = api.intl.sync.i18n
14- return nest('feed.html.followWarning', function warning (condition, explanation) {
15- var content = h('div', {classList: 'NotFollowingAnyoneWarning'}, h('section', [
16- h('h1', i18n('You are not following anyone')),
15+ return nest('feed.html', {
16+ followWarning: function followWarning (condition, explanation) {
17+ return renderWarningBox(condition, i18n('You are not following anyone'), explanation)
18+ },
19+ followerWarning: function followerWarning (condition, explanation) {
20+ return renderWarningBox(condition, i18n('You have no followers'), explanation)
21+ }
22+ })
23+
24+ function renderWarningBox (condition, header, explanation) {
25+ var content = h('div', {
26+ classList: 'NotFollowingAnyoneWarning'
27+ }, h('section', [
28+ h('h1', header),
1729 h('p', explanation),
1830 h('p', [i18n('For help getting started, see the guide at '),
19- h('a', {href: 'https://scuttlebutt.nz/getting-started.html'}, 'https://scuttlebutt.nz/getting-started.html')]
20- )
31+ h('a', {
32+ href: 'https://scuttlebutt.nz/getting-started.html'
33+ }, 'https://scuttlebutt.nz/getting-started.html')
34+ ])
2135 ]))
2236
2337 return when(condition, content)
24- })
38+ }
2539 }
modules/page/html/render/public.jsView
@@ -22,8 +22,9 @@
2222 'message.sync.root': 'first',
2323 'progress.html.peer': 'first',
2424
2525 'feed.html.followWarning': 'first',
26+ 'feed.html.followerWarning': 'first',
2627 'feed.html.rollup': 'first',
2728 'profile.obs.recentlyUpdated': 'first',
2829 'profile.obs.contact': 'first',
2930 'contact.obs.following': 'first',
@@ -62,9 +63,10 @@
6263 var contact = api.profile.obs.contact(id)
6364
6465 var prepend = [
6566 api.message.html.compose({ meta: { type: 'post' }, placeholder: i18n('Write a public message') }),
66- noVisibleNewPostsWarning()
67+ noVisibleNewPostsWarning(),
68+ noFollowersWarning()
6769 ]
6870
6971 var lastMessage = null
7072
@@ -262,17 +264,34 @@
262264 ]
263265 }
264266
265267 function noVisibleNewPostsWarning () {
266- var explanation = i18n('You may not be able to see new content until you follow some users or pubs.')
268+ const explanation = i18n('You may not be able to see new content until you follow some users or pubs.')
267269
268- var shownWhen = computed([loading, contact.isNotFollowingAnybody],
270+ const shownWhen = computed([loading, contact.isNotFollowingAnybody],
269271 (isLoading, isNotFollowingAnybody) => !isLoading && isNotFollowingAnybody
270- )
272+ )
271273
272274 return api.feed.html.followWarning(shownWhen, explanation)
273275 }
274276
277+ function noFollowersWarning () {
278+ const explanation = i18n(
279+ 'Nobody will be able to see your posts until you have a follower. The easiest way to get a follower is to use a pub invite as the pub will follow you back. If you have already redeemed a pub invite and you see it has not followed you back on your profile, try another pub.'
280+ )
281+
282+ // We only show this if the user has followed someone as the first warning ('You are not following anyone')
283+ // should be sufficient to get the user to join a pub. However, pubs have been buggy and not followed back on occassion.
284+ // Additionally, someone onboarded on a local network might follow someone on the network, but not be followed back by
285+ // them, so we begin to show this warning if the user has followed someone, but has no followers.
286+ const shownWhen = computed([loading, contact.hasNoFollowers, contact.isNotFollowingAnybody],
287+ (isLoading, hasNoFollowers, isNotFollowingAnybody) =>
288+ !isLoading && (hasNoFollowers && !isNotFollowingAnybody)
289+ )
290+
291+ return api.feed.html.followerWarning(shownWhen, explanation)
292+ }
293+
275294 function subscribe (id) {
276295 api.message.async.publish({
277296 type: 'channel',
278297 channel: id,
modules/profile/obs/contact.jsView
@@ -50,8 +50,12 @@
5050 var isNotFollowingAnybody = computed([following, following.sync], (following, sync) => {
5151 return sync && (!following || !following.length)
5252 })
5353
54+ var hasNoFollowers = computed(followers, followersList => {
55+ return sync && (!followersList || !followersList.length)
56+ })
57+
5458 return {
5559 followers,
5660 following,
5761 blockers,
@@ -64,8 +68,9 @@
6468 incomingVia,
6569 incomingViaCount: count(incomingVia),
6670 hasOutgoing,
6771 isNotFollowingAnybody,
72+ hasNoFollowers,
6873 noOutgoing: not(hasOutgoing, isYou),
6974 hasIncoming,
7075 noIncoming: not(hasIncoming, isYou),
7176 yourId,

Built with git-ssb-web