Multisite 555 #605

Merged
daovist merged 15 commits from multisite-555 into master 2018-10-05 15:33:28 +02:00
daovist commented 2018-09-20 20:28:00 +02:00 (Migrated from github.com)

#555

This PR uses 4 new configuration options: closedRegistration, serveOnlyApproved, publishOnlyApproved, approvedChannels

There is no option to not show Publish in the navbar as described in the issue. Publish and Login are hidden based on the options defined

It's also not "disable publishing for non-authenticated users" but "only allow publishes from whitelisted channels/users"

#555 This PR uses 4 new configuration options: closedRegistration, serveOnlyApproved, publishOnlyApproved, approvedChannels There is no option to not show Publish in the navbar as described in the issue. Publish and Login are hidden based on the options defined It's also not "disable publishing for non-authenticated users" but "only allow publishes from whitelisted channels/users"
kauffj (Migrated from github.com) reviewed 2018-09-21 16:24:44 +02:00
kauffj (Migrated from github.com) left a comment

Some comments

Some comments
@ -28,16 +28,17 @@ class NavigationLinks extends React.Component {
}
kauffj (Migrated from github.com) commented 2018-09-21 16:24:23 +02:00

Should this logic exist in a reducer, index.js, or somewhere that isn't the component itself?

Should this logic exist in a reducer, index.js, or somewhere that isn't the component itself?
@ -11,0 +8,4 @@
twitter : 'default twitter',
defaultDescription : 'default description',
defaultThumbnail : 'default thumbnail',
closedRegistration : false,
kauffj (Migrated from github.com) commented 2018-09-21 16:22:17 +02:00

Doesn't need to be handled in this PR, but rather than defaulting these in JavaScript, we should be including a default config file that includes these values.

Also, we should pick better defaults :)

Doesn't need to be handled in this PR, but rather than defaulting these in JavaScript, we should be including a default config file that includes these values. Also, we should pick better defaults :)
kauffj (Migrated from github.com) commented 2018-09-21 16:23:38 +02:00

I haven't thought this through thoroughly, but are all of these necessary or can some be inferred?

E.g. if there is a list of approved channels, doesn't that imply to only serve content from them and allow publishing to them?

I haven't thought this through thoroughly, but are all of these necessary or can some be inferred? E.g. if there is a list of approved channels, doesn't that imply to only serve content from them and allow publishing to them?
kauffj (Migrated from github.com) commented 2018-09-21 16:19:46 +02:00

This function exists twice in two different places (it's also in server/utils)

This function exists twice in two different places (it's also in `server/utils`)
@ -6,3 +9,4 @@
const LONG_CLAIM_LENGTH = 40;
/*
kauffj (Migrated from github.com) commented 2018-09-21 16:18:17 +02:00

"40" should be defined somewhere, presumably on whatever class / structure defines what a Claim is.

"40" should be defined somewhere, presumably on whatever class / structure defines what a Claim is.
kauffj (Migrated from github.com) commented 2018-09-21 16:18:50 +02:00

Additionally, if shortId and longId are used as special values, they should also be defined constants.

Additionally, if `shortId` and `longId` are used as special values, they should also be defined constants.
@ -95,3 +105,3 @@
if (error.name === CLAIM_TAKEN) {
if ([CLAIM_TAKEN, UNAPPROVED_CHANNEL].includes(error.name)) {
res.status(400).json({
success: false,
kauffj (Migrated from github.com) commented 2018-09-21 16:17:28 +02:00

Is there a way to write this function that doesn't rely on using an exception for control flow?

Is there a way to write this function that doesn't rely on using an exception for control flow?
@ -358,3 +359,4 @@
Claim.fetchClaim = function (name, claimId) {
logger.debug(`Claim.resolveClaim: ${name} ${claimId}`);
return new Promise((resolve, reject) => {
this
kauffj (Migrated from github.com) commented 2018-09-21 16:15:25 +02:00

This logic should probably not be in resolveClaim itself, and instead either in the controller or in a wrapper method like resolveApprovedClaim or resolveClaimForSite.

This logic should probably not be in `resolveClaim` itself, and instead either in the controller or in a wrapper method like `resolveApprovedClaim` or `resolveClaimForSite`.
@ -10,2 +11,4 @@
},
(username, password, done) => {
if (closedRegistration) {
return done('Registration is disabled');
kauffj (Migrated from github.com) commented 2018-09-21 16:01:29 +02:00

Should this be an exception rather than an early exit? If sites with closedRegistration=true are not expected to call this function, it should be probably be an exception.

Should this be an exception rather than an early exit? If sites with `closedRegistration=true` are not expected to call this function, it should be probably be an exception.
kauffj (Migrated from github.com) commented 2018-09-21 15:59:41 +02:00

Is creating a separate utility function and file like this the recommended approach for Express / Sequalize / Node?

I would have expected this to be grouped with other functions that operate on claims.

Is creating a separate utility function and file like this the recommended approach for Express / Sequalize / Node? I would have expected this to be grouped with other functions that operate on claims.
kauffj (Migrated from github.com) reviewed 2018-09-21 16:26:46 +02:00
@ -11,0 +8,4 @@
twitter : 'default twitter',
defaultDescription : 'default description',
defaultThumbnail : 'default thumbnail',
closedRegistration : false,
kauffj (Migrated from github.com) commented 2018-09-21 16:26:45 +02:00
https://github.com/lbryio/spee.ch/issues/606
daovist (Migrated from github.com) reviewed 2018-09-21 22:08:08 +02:00
daovist (Migrated from github.com) commented 2018-09-21 22:08:08 +02:00

I'm trying to learn best practices for these tools as I go so I'm not exactly sure, but I'm moving this to the utils folder shared by server and client, making it a pure function, and passing in approvedChannels from the config file.

I'm trying to learn best practices for these tools as I go so I'm not exactly sure, but I'm moving this to the utils folder shared by server and client, making it a pure function, and passing in `approvedChannels` from the config file.
daovist (Migrated from github.com) reviewed 2018-09-24 14:03:21 +02:00
daovist (Migrated from github.com) commented 2018-09-24 14:03:21 +02:00

This was a small amount of extra effort now to account for other configurations e.g. a spee.ch instance that serves all content but only publishes selected channels.

This was a small amount of extra effort now to account for other configurations e.g. a spee.ch instance that serves all content but only publishes selected channels.
daovist (Migrated from github.com) reviewed 2018-09-24 14:05:59 +02:00
@ -11,0 +8,4 @@
twitter : 'default twitter',
defaultDescription : 'default description',
defaultThumbnail : 'default thumbnail',
closedRegistration : false,
daovist (Migrated from github.com) commented 2018-09-24 14:05:59 +02:00

The default config is on the server. I think having silly things like "default thumbnail" are useful in development which is the only time these values should ever render.

The default config is on the server. I think having silly things like "default thumbnail" are useful in development which is the only time these values should ever render.
daovist (Migrated from github.com) reviewed 2018-09-24 14:37:18 +02:00
@ -10,2 +11,4 @@
},
(username, password, done) => {
if (closedRegistration) {
return done('Registration is disabled');
daovist (Migrated from github.com) commented 2018-09-24 14:37:18 +02:00

That would have the same result and I can't find a way to make it any cleaner/simpler than this.

That would have the same result and I can't find a way to make it any cleaner/simpler than this.
daovist (Migrated from github.com) reviewed 2018-09-24 15:45:37 +02:00
@ -28,16 +28,17 @@ class NavigationLinks extends React.Component {
}
daovist (Migrated from github.com) commented 2018-09-24 15:45:37 +02:00

moved to index.js

moved to index.js
skhameneh (Migrated from github.com) approved these changes 2018-09-25 16:33:55 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/spee.ch#605
No description provided.