Open platform to collect and prioritize feedback
refactor: standardize field names (id, url, ...) (#502)
Guilherme Oenningc058e1c0349c
diff --git a/app/actions/oauth.go b/app/actions/oauth.goindex 567468eb0..bcd77095b 100644--- a/app/actions/oauth.go+++ b/app/actions/oauth.go@@ -61,9 +61,9 @@ func (input *CreateEditOAuthConfig) Validate(user *models.User, services *app.Se}if input.Model.ClientID == "" {- result.AddFieldFailure("clientId", "Client ID is required.")+ result.AddFieldFailure("clientID", "Client ID is required.")} else if len(input.Model.ClientID) > 100 {- result.AddFieldFailure("clientId", "Client ID must have less than 100 characters.")+ result.AddFieldFailure("clientID", "Client ID must have less than 100 characters.")}if input.Model.ClientSecret == "" {@@ -79,27 +79,27 @@ func (input *CreateEditOAuthConfig) Validate(user *models.User, services *app.Se}if input.Model.AuthorizeURL == "" {- result.AddFieldFailure("authorizeUrl", "Authorize URL is required.")+ result.AddFieldFailure("authorizeURL", "Authorize URL is required.")} else if messages := validate.URL(input.Model.AuthorizeURL); len(messages) > 0 {- result.AddFieldFailure("authorizeUrl", messages...)+ result.AddFieldFailure("authorizeURL", messages...)}if input.Model.TokenURL == "" {- result.AddFieldFailure("tokenUrl", "Token URL is required.")+ result.AddFieldFailure("tokenURL", "Token URL is required.")} else if messages := validate.URL(input.Model.TokenURL); len(messages) > 0 {- result.AddFieldFailure("tokenUrl", messages...)+ result.AddFieldFailure("tokenURL", messages...)}if input.Model.ProfileURL != "" {if messages := validate.URL(input.Model.ProfileURL); len(messages) > 0 {- result.AddFieldFailure("profileUrl", messages...)+ result.AddFieldFailure("profileURL", messages...)}}if input.Model.JSONUserIDPath == "" {- result.AddFieldFailure("jsonUserIdPath", "JSON User Id Path is required.")+ result.AddFieldFailure("jsonUserIDPath", "JSON User ID Path is required.")} else if len(input.Model.JSONUserIDPath) > 100 {- result.AddFieldFailure("jsonUserIdPath", "JSON User Id Path must have less than 100 characters.")+ result.AddFieldFailure("jsonUserIDPath", "JSON User ID Path must have less than 100 characters.")}if len(input.Model.JSONUserNamePath) > 100 {diff --git a/app/actions/oauth_test.go b/app/actions/oauth_test.goindex 09490c167..910c4ff2b 100644--- a/app/actions/oauth_test.go+++ b/app/actions/oauth_test.go@@ -18,11 +18,11 @@ func TestCreateEditOAuthConfig_InvalidInput(t *testing.T) {input *models.CreateEditOAuthConfig}{{- expected: []string{"displayName", "status", "tokenUrl", "clientId", "clientSecret", "scope", "authorizeUrl", "tokenUrl", "jsonUserIdPath"},+ expected: []string{"displayName", "status", "tokenURL", "clientID", "clientSecret", "scope", "authorizeURL", "tokenURL", "jsonUserIDPath"},input: &models.CreateEditOAuthConfig{},},{- expected: []string{"displayName", "status", "tokenUrl", "clientId", "clientSecret", "scope", "authorizeUrl", "tokenUrl", "profileUrl", "jsonUserIdPath", "jsonUserNamePath", "jsonUserEmailPath"},+ expected: []string{"displayName", "status", "tokenURL", "clientID", "clientSecret", "scope", "authorizeURL", "tokenURL", "profileURL", "jsonUserIDPath", "jsonUserNamePath", "jsonUserEmailPath"},input: &models.CreateEditOAuthConfig{DisplayName: rand.String(51),ClientID: rand.String(101),diff --git a/app/actions/user.go b/app/actions/user.goindex 1c070f56b..050996026 100644--- a/app/actions/user.go+++ b/app/actions/user.go@@ -34,18 +34,18 @@ func (input *ChangeUserRole) Validate(user *models.User, services *app.Services)}if user.ID == input.Model.UserID {- result.AddFieldFailure("userId", "It is not allowed to change your own Role.")+ result.AddFieldFailure("userID", "It is not allowed to change your own Role.")}target, err := services.Users.GetByID(input.Model.UserID)if err != nil {if errors.Cause(err) == app.ErrNotFound {- result.AddFieldFailure("userId", "User not found.")+ result.AddFieldFailure("userID", "User not found.")} else {return validate.Error(err)}} else if target.Tenant.ID != user.Tenant.ID {- result.AddFieldFailure("userId", "User not found.")+ result.AddFieldFailure("userID", "User not found.")}return result}diff --git a/app/actions/user_test.go b/app/actions/user_test.goindex 761682051..aeedc124d 100644--- a/app/actions/user_test.go+++ b/app/actions/user_test.go@@ -64,7 +64,7 @@ func TestChangeUserRole_InvalidUser(t *testing.T) {action := actions.ChangeUserRole{Model: &models.ChangeUserRole{UserID: 999, Role: models.RoleAdministrator}}action.IsAuthorized(currentUser, nil)result := action.Validate(currentUser, services)- ExpectFailed(result, "userId")+ ExpectFailed(result, "userID")}func TestChangeUserRole_InvalidUser_Tenant(t *testing.T) {@@ -84,7 +84,7 @@ func TestChangeUserRole_InvalidUser_Tenant(t *testing.T) {action := actions.ChangeUserRole{Model: &models.ChangeUserRole{UserID: targetUser.ID, Role: models.RoleAdministrator}}action.IsAuthorized(currentUser, nil)result := action.Validate(currentUser, services)- ExpectFailed(result, "userId")+ ExpectFailed(result, "userID")}func TestChangeUserRole_CurrentUser(t *testing.T) {@@ -99,7 +99,7 @@ func TestChangeUserRole_CurrentUser(t *testing.T) {action := actions.ChangeUserRole{Model: &models.ChangeUserRole{UserID: currentUser.ID, Role: models.RoleVisitor}}action.IsAuthorized(currentUser, nil)result := action.Validate(currentUser, services)- ExpectFailed(result, "userId")+ ExpectFailed(result, "userID")user, err := services.Users.GetByID(currentUser.ID)Expect(err).IsNil()diff --git a/app/handlers/apiv1/post_test.go b/app/handlers/apiv1/post_test.goindex ae2411e64..736c41b7f 100644--- a/app/handlers/apiv1/post_test.go+++ b/app/handlers/apiv1/post_test.go@@ -371,17 +371,17 @@ func TestUpdateCommentHandler_Authorized(t *testing.T) {services.SetCurrentTenant(mock.DemoTenant)services.SetCurrentUser(mock.AryaStark)post, _ := services.Posts.Add("The Post #1", "The Description #1")- commentId, _ := services.Posts.AddComment(post, "My first comment")+ commentID, _ := services.Posts.AddComment(post, "My first comment")code, _ := server.OnTenant(mock.DemoTenant).AsUser(mock.AryaStark).AddParam("number", post.Number).- AddParam("id", commentId).+ AddParam("id", commentID).ExecutePost(apiv1.UpdateComment(), `{ "content": "My first comment has been edited" }`)Expect(code).Equals(http.StatusOK)- comment, _ := services.Posts.GetCommentByID(commentId)+ comment, _ := services.Posts.GetCommentByID(commentID)Expect(comment.Content).Equals("My first comment has been edited")}@@ -392,17 +392,17 @@ func TestUpdateCommentHandler_Unauthorized(t *testing.T) {services.SetCurrentTenant(mock.DemoTenant)services.SetCurrentUser(mock.JonSnow)post, _ := services.Posts.Add("The Post #1", "The Description #1")- commentId, _ := services.Posts.AddComment(post, "My first comment")+ commentID, _ := services.Posts.AddComment(post, "My first comment")code, _ := server.OnTenant(mock.DemoTenant).AsUser(mock.AryaStark).AddParam("number", post.Number).- AddParam("id", commentId).+ AddParam("id", commentID).ExecutePost(apiv1.UpdateComment(), `{ "content": "My first comment has been edited" }`)Expect(code).Equals(http.StatusForbidden)- comment, _ := services.Posts.GetCommentByID(commentId)+ comment, _ := services.Posts.GetCommentByID(commentID)Expect(comment.Content).Equals("My first comment")}diff --git a/app/handlers/settings_test.go b/app/handlers/settings_test.goindex d1de866aa..c93669d17 100644--- a/app/handlers/settings_test.go+++ b/app/handlers/settings_test.go@@ -89,7 +89,7 @@ func TestChangeRoleHandler_Valid(t *testing.T) {OnTenant(mock.DemoTenant).AsUser(mock.JonSnow).AddParam("role", models.RoleAdministrator).- ExecutePost(handlers.ChangeUserRole(), fmt.Sprintf(`{ "userId": %d }`, mock.AryaStark.ID))+ ExecutePost(handlers.ChangeUserRole(), fmt.Sprintf(`{ "userID": %d }`, mock.AryaStark.ID))user, _ := services.Users.GetByID(mock.AryaStark.ID)diff --git a/app/models/identity.go b/app/models/identity.goindex 633e7591b..b9991df44 100644--- a/app/models/identity.go+++ b/app/models/identity.go@@ -17,7 +17,7 @@ type Tenant struct {CNAME string `json:"cname"`Status int `json:"-"`IsPrivate bool `json:"isPrivate"`- LogoID int `json:"logoId"`+ LogoID int `json:"logoID"`CustomCSS string `json:"-"`}@@ -283,7 +283,7 @@ type UpdateUserSettings struct {// ChangeUserRole is the input model change role of an usertype ChangeUserRole struct {Role Role `route:"role"`- UserID int `json:"userId"`+ UserID int `json:"userID"`}// InviteUsers is used to invite new users into Fiderdiff --git a/app/models/infra.go b/app/models/infra.goindex 438879562..12cc808ea 100644--- a/app/models/infra.go+++ b/app/models/infra.go@@ -33,13 +33,13 @@ type CreateEditOAuthConfig struct {Provider string `json:"provider"`Status int `json:"status"`DisplayName string `json:"displayName"`- ClientID string `json:"clientId"`+ ClientID string `json:"clientID"`ClientSecret string `json:"clientSecret"`- AuthorizeURL string `json:"authorizeUrl" format:"lower"`- TokenURL string `json:"tokenUrl" format:"lower"`+ AuthorizeURL string `json:"authorizeURL" format:"lower"`+ TokenURL string `json:"tokenURL" format:"lower"`Scope string `json:"scope"`- ProfileURL string `json:"profileUrl" format:"lower"`- JSONUserIDPath string `json:"jsonUserIdPath"`+ ProfileURL string `json:"profileURL" format:"lower"`+ JSONUserIDPath string `json:"jsonUserIDPath"`JSONUserNamePath string `json:"jsonUserNamePath"`JSONUserEmailPath string `json:"jsonUserEmailPath"`}@@ -72,15 +72,15 @@ func (o OAuthConfig) MarshalJSON() ([]byte, error) {"id": o.ID,"provider": o.Provider,"displayName": o.DisplayName,- "logoId": o.LogoID,+ "logoID": o.LogoID,"status": o.Status,- "clientId": o.ClientID,+ "clientID": o.ClientID,"clientSecret": secret,- "authorizeUrl": o.AuthorizeURL,- "tokenUrl": o.TokenURL,- "profileUrl": o.ProfileURL,+ "authorizeURL": o.AuthorizeURL,+ "tokenURL": o.TokenURL,+ "profileURL": o.ProfileURL,"scope": o.Scope,- "jsonUserIdPath": o.JSONUserIDPath,+ "jsonUserIDPath": o.JSONUserIDPath,"jsonUserNamePath": o.JSONUserNamePath,"jsonUserEmailPath": o.JSONUserEmailPath,})diff --git a/app/pkg/oauth/oauth.go b/app/pkg/oauth/oauth.goindex 64e228026..84a430917 100644--- a/app/pkg/oauth/oauth.go+++ b/app/pkg/oauth/oauth.go@@ -27,10 +27,10 @@ type UserProfile struct {type ProviderOption struct {Provider string `json:"provider"`DisplayName string `json:"displayName"`- ClientID string `json:"clientId"`+ ClientID string `json:"clientID"`URL string `json:"url"`- CallbackURL string `json:"callbackUrl"`- LogoID int `json:"logoId"`+ CallbackURL string `json:"callbackURL"`+ LogoID int `json:"logoID"`IsCustomProvider bool `json:"isCustomProvider"`IsEnabled bool `json:"isEnabled"`}diff --git a/app/storage/postgres/notifications_test.go b/app/storage/postgres/notifications_test.goindex 9f6bc5754..a91e33bb5 100644--- a/app/storage/postgres/notifications_test.go+++ b/app/storage/postgres/notifications_test.go@@ -115,7 +115,7 @@ func TestNotificationStorage_ReadAll(t *testing.T) {Expect(allNotifications[1].Read).IsTrue()}-func TestNotificationStorage_GetNotificationById(t *testing.T) {+func TestNotificationStorage_GetNotificationByID(t *testing.T) {SetupDatabaseTest(t)defer TeardownDatabaseTest()@@ -136,7 +136,7 @@ func TestNotificationStorage_GetNotificationById(t *testing.T) {Expect(not1.Read).IsFalse()}-func TestNotificationStorage_GetNotificationById_OtherUser(t *testing.T) {+func TestNotificationStorage_GetNotificationByID_OtherUser(t *testing.T) {SetupDatabaseTest(t)defer TeardownDatabaseTest()diff --git a/app/storage/postgres/post_test.go b/app/storage/postgres/post_test.goindex 13d748049..e25104a36 100644--- a/app/storage/postgres/post_test.go+++ b/app/storage/postgres/post_test.go@@ -60,18 +60,18 @@ func TestPostStorage_AddAndGet(t *testing.T) {post, err := posts.Add("My new post", "with this description")Expect(err).IsNil()- dbPostById, err := posts.GetByID(post.ID)- Expect(err).IsNil()- Expect(dbPostById.ID).Equals(post.ID)- Expect(dbPostById.Number).Equals(1)- Expect(dbPostById.ViewerSupported).IsFalse()- Expect(dbPostById.TotalSupporters).Equals(0)- Expect(dbPostById.Status).Equals(models.PostOpen)- Expect(dbPostById.Title).Equals("My new post")- Expect(dbPostById.Description).Equals("with this description")- Expect(dbPostById.User.ID).Equals(1)- Expect(dbPostById.User.Name).Equals("Jon Snow")- Expect(dbPostById.User.Email).Equals("[email protected]")+ dbPostByID, err := posts.GetByID(post.ID)+ Expect(err).IsNil()+ Expect(dbPostByID.ID).Equals(post.ID)+ Expect(dbPostByID.Number).Equals(1)+ Expect(dbPostByID.ViewerSupported).IsFalse()+ Expect(dbPostByID.TotalSupporters).Equals(0)+ Expect(dbPostByID.Status).Equals(models.PostOpen)+ Expect(dbPostByID.Title).Equals("My new post")+ Expect(dbPostByID.Description).Equals("with this description")+ Expect(dbPostByID.User.ID).Equals(1)+ Expect(dbPostByID.User.Name).Equals("Jon Snow")+ Expect(dbPostByID.User.Email).Equals("[email protected]")dbPostBySlug, err := posts.GetBySlug("my-new-post")@@ -132,24 +132,24 @@ func TestPostStorage_AddGetUpdateComment(t *testing.T) {post, err := posts.Add("My new post", "with this description")Expect(err).IsNil()- commentId, err := posts.AddComment(post, "Comment #1")+ commentID, err := posts.AddComment(post, "Comment #1")Expect(err).IsNil()- comment, err := posts.GetCommentByID(commentId)+ comment, err := posts.GetCommentByID(commentID)Expect(err).IsNil()- Expect(comment.ID).Equals(commentId)+ Expect(comment.ID).Equals(commentID)Expect(comment.Content).Equals("Comment #1")Expect(comment.User.ID).Equals(jonSnow.ID)Expect(comment.EditedOn).IsNil()Expect(comment.EditedBy).IsNil()posts.SetCurrentUser(aryaStark)- err = posts.UpdateComment(commentId, "Comment #1 with edit")+ err = posts.UpdateComment(commentID, "Comment #1 with edit")Expect(err).IsNil()- comment, err = posts.GetCommentByID(commentId)+ comment, err = posts.GetCommentByID(commentID)Expect(err).IsNil()- Expect(comment.ID).Equals(commentId)+ Expect(comment.ID).Equals(commentID)Expect(comment.Content).Equals("Comment #1 with edit")Expect(comment.User.ID).Equals(jonSnow.ID)Expect(comment.EditedOn).IsNotNil()diff --git a/main.go b/main.goindex 00ac7a62c..0a34e5e96 100644--- a/main.go+++ b/main.go@@ -20,7 +20,7 @@ var buildnumber = "local"// Use this for stable releases// var version = "x.y.z"-var version = "0.15.0"+var version = "0.16.0-" + buildnumberfunc main() {settings := &models.SystemSettings{diff --git a/public/components/common/Logo.tsx b/public/components/common/Logo.tsxindex 70473102b..a875e5c48 100644--- a/public/components/common/Logo.tsx+++ b/public/components/common/Logo.tsx@@ -1,5 +1,5 @@import * as React from "react";-import { Fider, uploadedImageUrl } from "@fider/services";+import { Fider, uploadedImageURL } from "@fider/services";type Size = 24 | 50 | 100 | 200;@@ -7,18 +7,18 @@ interface TenantLogoProps {size: Size;}-export const TenantLogoUrl = (size: Size): string | undefined => {+export const TenantLogoURL = (size: Size): string | undefined => {const tenant = Fider.session.tenant;- if (tenant && tenant.logoId > 0) {- return uploadedImageUrl(tenant.logoId, size);+ if (tenant && tenant.logoID > 0) {+ return uploadedImageURL(tenant.logoID, size);}return undefined;};export const TenantLogo = (props: TenantLogoProps) => {const tenant = Fider.session.tenant;- if (tenant && tenant.logoId > 0) {- return <img src={TenantLogoUrl(props.size)} alt={tenant.name} />;+ if (tenant && tenant.logoID > 0) {+ return <img src={TenantLogoURL(props.size)} alt={tenant.name} />;}return null;};@@ -27,7 +27,7 @@ interface OAuthProviderLogoProps {option: {provider?: string;displayName: string;- logoId?: number;+ logoID?: number;};}@@ -38,16 +38,16 @@ const systemProvidersLogo: { [key: string]: string } = {"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMC8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMtU1ZHLTIwMDEwOTA0L0RURC9zdmcxMC5kdGQnPjxzdmcgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIGhlaWdodD0iMzJweCIgaWQ9IkxheWVyXzEiIHZlcnNpb249IjEuMCIgdmlld0JveD0iMCAwIDMyIDMyIiB3aWR0aD0iMzJweCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PHBhdGggY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMTYuMDAzLDBDNy4xNywwLDAuMDA4LDcuMTYyLDAuMDA4LDE1Ljk5NyAgYzAsNy4wNjcsNC41ODIsMTMuMDYzLDEwLjk0LDE1LjE3OWMwLjgsMC4xNDYsMS4wNTItMC4zMjgsMS4wNTItMC43NTJjMC0wLjM4LDAuMDA4LTEuNDQyLDAtMi43NzcgIGMtNC40NDksMC45NjctNS4zNzEtMi4xMDctNS4zNzEtMi4xMDdjLTAuNzI3LTEuODQ4LTEuNzc1LTIuMzQtMS43NzUtMi4zNGMtMS40NTItMC45OTIsMC4xMDktMC45NzMsMC4xMDktMC45NzMgIGMxLjYwNSwwLjExMywyLjQ1MSwxLjY0OSwyLjQ1MSwxLjY0OWMxLjQyNywyLjQ0MywzLjc0MywxLjczNyw0LjY1NCwxLjMyOWMwLjE0Ni0xLjAzNCwwLjU2LTEuNzM5LDEuMDE3LTIuMTM5ICBjLTMuNTUyLTAuNDA0LTcuMjg2LTEuNzc2LTcuMjg2LTcuOTA2YzAtMS43NDcsMC42MjMtMy4xNzQsMS42NDYtNC4yOTJDNy4yOCwxMC40NjQsNi43Myw4LjgzNyw3LjYwMiw2LjYzNCAgYzAsMCwxLjM0My0wLjQzLDQuMzk4LDEuNjQxYzEuMjc2LTAuMzU1LDIuNjQ1LTAuNTMyLDQuMDA1LTAuNTM4YzEuMzU5LDAuMDA2LDIuNzI3LDAuMTgzLDQuMDA1LDAuNTM4ICBjMy4wNTUtMi4wNyw0LjM5Ni0xLjY0MSw0LjM5Ni0xLjY0MWMwLjg3MiwyLjIwMywwLjMyMywzLjgzLDAuMTU5LDQuMjM0YzEuMDIzLDEuMTE4LDEuNjQ0LDIuNTQ1LDEuNjQ0LDQuMjkyICBjMCw2LjE0Ni0zLjc0LDcuNDk4LTcuMzA0LDcuODkzQzE5LjQ3OSwyMy41NDgsMjAsMjQuNTA4LDIwLDI2YzAsMiwwLDMuOTAyLDAsNC40MjhjMCwwLjQyOCwwLjI1OCwwLjkwMSwxLjA3LDAuNzQ2ICBDMjcuNDIyLDI5LjA1NSwzMiwyMy4wNjIsMzIsMTUuOTk3QzMyLDcuMTYyLDI0LjgzOCwwLDE2LjAwMywweiIgZmlsbD0iIzE4MTYxNiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PGcvPjxnLz48Zy8+PGcvPjxnLz48Zy8+PC9zdmc+"};-export const OAuthProviderLogoUrl = (id?: number): string | undefined => {+export const OAuthProviderLogoURL = (id?: number): string | undefined => {if (id && id > 0) {- return uploadedImageUrl(id, 100);+ return uploadedImageURL(id, 100);}return undefined;};export const OAuthProviderLogo = (props: OAuthProviderLogoProps) => {- if (props.option.logoId && props.option.logoId > 0) {- return <img src={OAuthProviderLogoUrl(props.option.logoId)} alt={props.option.displayName} />;+ if (props.option.logoID && props.option.logoID > 0) {+ return <img src={OAuthProviderLogoURL(props.option.logoID)} alt={props.option.displayName} />;}if (props.option.provider && props.option.provider in systemProvidersLogo) {diff --git a/public/components/common/SocialSignInButton.tsx b/public/components/common/SocialSignInButton.tsxindex 800c8b0e3..ddbcda4a7 100644--- a/public/components/common/SocialSignInButton.tsx+++ b/public/components/common/SocialSignInButton.tsx@@ -7,8 +7,8 @@ interface SocialSignInButtonProps {displayName: string;provider?: string;url?: string;- logoId?: number;- logoUrl?: string;+ logoID?: number;+ logoURL?: string;};redirectTo?: string;}@@ -23,8 +23,8 @@ export class SocialSignInButton extends React.Component<SocialSignInButtonProps,});return (<Button href={href} rel="nofollow" fluid={true} className={className}>- {this.props.option.logoUrl ? (- <img src={this.props.option.logoUrl} />+ {this.props.option.logoURL ? (+ <img src={this.props.option.logoURL} />) : (<OAuthProviderLogo option={this.props.option} />)}diff --git a/public/components/common/form/ImageUploader.tsx b/public/components/common/form/ImageUploader.tsxindex 84b297517..22a9462b4 100644--- a/public/components/common/form/ImageUploader.tsx+++ b/public/components/common/form/ImageUploader.tsx@@ -9,14 +9,14 @@ import { Button, ButtonClickEvent } from "@fider/components";interface ImageUploaderProps {field: string;label?: string;- defaultImageUrl?: string;+ defaultImageURL?: string;disabled?: boolean;previewMaxWidth: number;- onChange(state: ImageUploaderState, previewUrl?: string): void;+ onChange(state: ImageUploaderState, previewURL?: string): void;}interface ImageUploaderState extends ImageUploadState {- previewUrl?: string;+ previewURL?: string;}export interface ImageUploadState {@@ -34,7 +34,7 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplothis.state = {upload: undefined,remove: false,- previewUrl: this.props.defaultImageUrl+ previewURL: this.props.defaultImageURL};}@@ -50,10 +50,10 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUploaction: "upload"},remove: false,- previewUrl: `data:${file.type};base64,${base64}`+ previewURL: `data:${file.type};base64,${base64}`},() => {- this.props.onChange(this.state, this.state.previewUrl);+ this.props.onChange(this.state, this.state.previewURL);});}@@ -64,10 +64,10 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplo{remove: true,upload: undefined,- previewUrl: undefined+ previewURL: undefined},() => {- this.props.onChange(this.state, this.state.previewUrl);+ this.props.onChange(this.state, this.state.previewURL);});};@@ -80,7 +80,7 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplopublic render() {const isUploading = !!this.state.upload;- const hasFile = (!this.state.remove && this.props.defaultImageUrl) || isUploading;+ const hasFile = (!this.state.remove && this.props.defaultImageURL) || isUploading;const imgStyles: React.CSSProperties = {maxWidth: `${this.props.previewMaxWidth}px`@@ -97,7 +97,7 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplo})}><label htmlFor={`input-${this.props.field}`}>{this.props.label}</label>- {hasFile && <img className="preview" src={this.state.previewUrl} style={imgStyles} />}+ {hasFile && <img className="preview" src={this.state.previewURL} style={imgStyles} />}<input ref={e => (this.fileSelector = e)} type="file" onChange={this.fileChanged} /><DisplayError fields={[this.props.field]} error={ctx.error} /><div className="c-form-field-wrapper">diff --git a/public/models/identity.ts b/public/models/identity.tsindex 156ee1e97..e13b407e3 100644--- a/public/models/identity.ts+++ b/public/models/identity.ts@@ -6,7 +6,7 @@ export interface Tenant {invitation: string;welcomeMessage: string;isPrivate: boolean;- logoId: number;+ logoID: number;}export interface User {diff --git a/public/models/settings.ts b/public/models/settings.tsindex 082f93a36..4838f3354 100644--- a/public/models/settings.ts+++ b/public/models/settings.ts@@ -1,10 +1,10 @@export interface OAuthProviderOption {provider: string;displayName: string;- clientId: string;+ clientID: string;url: string;- callbackUrl: string;- logoId: number;+ callbackURL: string;+ logoID: number;isCustomProvider: boolean;isEnabled: boolean;}@@ -35,14 +35,14 @@ export interface OAuthConfig {provider: string;displayName: string;status: number;- clientId: string;+ clientID: string;clientSecret: string;- authorizeUrl: string;- tokenUrl: string;- profileUrl: string;- logoId: number;+ authorizeURL: string;+ tokenURL: string;+ profileURL: string;+ logoID: number;scope: string;- jsonUserIdPath: string;+ jsonUserIDPath: string;jsonUserNamePath: string;jsonUserEmailPath: string;}diff --git a/public/pages/Administration/components/OAuthForm.tsx b/public/pages/Administration/components/OAuthForm.tsxindex 6afc2c336..ccfb0c212 100644--- a/public/pages/Administration/components/OAuthForm.tsx+++ b/public/pages/Administration/components/OAuthForm.tsx@@ -13,7 +13,7 @@ import {ImageUploadState,ImageUploader,Toggle,- OAuthProviderLogoUrl+ OAuthProviderLogoURL} from "@fider/components";interface OAuthFormProps {@@ -25,17 +25,17 @@ export interface OAuthFormState {provider: string;displayName: string;enabled: boolean;- clientId: string;+ clientID: string;clientSecret: string;clientSecretEnabled: boolean;- authorizeUrl: string;- tokenUrl: string;- profileUrl: string;+ authorizeURL: string;+ tokenURL: string;+ profileURL: string;scope: string;- jsonUserIdPath: string;+ jsonUserIDPath: string;jsonUserNamePath: string;jsonUserEmailPath: string;- logoUrl?: string;+ logoURL?: string;logo?: ImageUploadState;error?: Failure;}@@ -47,17 +47,17 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {provider: this.props.config ? this.props.config.provider : "",enabled: this.props.config ? this.props.config.status === OAuthConfigStatus.Enabled : false,displayName: this.props.config ? this.props.config.displayName : "",- clientId: this.props.config ? this.props.config.clientId : "",+ clientID: this.props.config ? this.props.config.clientID : "",clientSecret: this.props.config ? this.props.config.clientSecret : "",clientSecretEnabled: !this.props.config,- authorizeUrl: this.props.config ? this.props.config.authorizeUrl : "",- tokenUrl: this.props.config ? this.props.config.tokenUrl : "",- profileUrl: this.props.config ? this.props.config.profileUrl : "",+ authorizeURL: this.props.config ? this.props.config.authorizeURL : "",+ tokenURL: this.props.config ? this.props.config.tokenURL : "",+ profileURL: this.props.config ? this.props.config.profileURL : "",scope: this.props.config ? this.props.config.scope : "",- jsonUserIdPath: this.props.config ? this.props.config.jsonUserIdPath : "",+ jsonUserIDPath: this.props.config ? this.props.config.jsonUserIDPath : "",jsonUserNamePath: this.props.config ? this.props.config.jsonUserNamePath : "",jsonUserEmailPath: this.props.config ? this.props.config.jsonUserEmailPath : "",- logoUrl: this.props.config ? OAuthProviderLogoUrl(this.props.config.logoId) : ""+ logoURL: this.props.config ? OAuthProviderLogoURL(this.props.config.logoID) : ""};}@@ -66,13 +66,13 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {provider: this.state.provider,status: this.state.enabled ? OAuthConfigStatus.Enabled : OAuthConfigStatus.Disabled,displayName: this.state.displayName,- clientId: this.state.clientId,+ clientID: this.state.clientID,clientSecret: this.state.clientSecretEnabled ? this.state.clientSecret : "",- authorizeUrl: this.state.authorizeUrl,- tokenUrl: this.state.tokenUrl,- profileUrl: this.state.profileUrl,+ authorizeURL: this.state.authorizeURL,+ tokenURL: this.state.tokenURL,+ profileURL: this.state.profileURL,scope: this.state.scope,- jsonUserIdPath: this.state.jsonUserIdPath,+ jsonUserIDPath: this.state.jsonUserIDPath,jsonUserNamePath: this.state.jsonUserNamePath,jsonUserEmailPath: this.state.jsonUserEmailPath,logo: this.state.logo@@ -92,40 +92,40 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {this.setState({ displayName });};- private setLogo = (logo: ImageUploadState, previewUrl: string) => {- this.setState({ logo, logoUrl: previewUrl });+ private setLogo = (logo: ImageUploadState, previewURL: string) => {+ this.setState({ logo, logoURL: previewURL });};private setStatus = async (enabled: boolean) => {this.setState({ enabled });};- private setClientId = (clientId: string) => {- this.setState({ clientId });+ private setClientID = (clientID: string) => {+ this.setState({ clientID });};private setClientSecret = (clientSecret: string) => {this.setState({ clientSecret });};- private setAuthorizeUrl = (authorizeUrl: string) => {- this.setState({ authorizeUrl });+ private setAuthorizeURL = (authorizeURL: string) => {+ this.setState({ authorizeURL });};- private setTokenUrl = (tokenUrl: string) => {- this.setState({ tokenUrl });+ private setTokenURL = (tokenURL: string) => {+ this.setState({ tokenURL });};- private setProfileUrl = (profileUrl: string) => {- this.setState({ profileUrl });+ private setProfileURL = (profileURL: string) => {+ this.setState({ profileURL });};private setScope = (scope: string) => {this.setState({ scope });};- private setJSONUserIdPath = (jsonUserIdPath: string) => {- this.setState({ jsonUserIdPath });+ private setJSONUserIDPath = (jsonUserIDPath: string) => {+ this.setState({ jsonUserIDPath });};private setJSONUserNamePath = (jsonUserNamePath: string) => {@@ -160,7 +160,7 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {<ImageUploaderlabel="Logo"field="logo"- defaultImageUrl={this.state.logoUrl}+ defaultImageURL={this.state.logoURL}previewMaxWidth={80}disabled={!Fider.session.user.isAdministrator}onChange={this.setLogo}@@ -179,12 +179,12 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {</div><Input- field="clientId"+ field="clientID"label="Client ID"maxLength={100}- value={this.state.clientId}+ value={this.state.clientID}disabled={!Fider.session.user.isAdministrator}- onChange={this.setClientId}+ onChange={this.setClientID}/><Input@@ -208,20 +208,20 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {}/><Input- field="authorizeUrl"+ field="authorizeURL"label="Authorize URL"maxLength={300}- value={this.state.authorizeUrl}+ value={this.state.authorizeURL}disabled={!Fider.session.user.isAdministrator}- onChange={this.setAuthorizeUrl}+ onChange={this.setAuthorizeURL}/><Input- field="tokenUrl"+ field="tokenURL"label="Token URL"maxLength={300}- value={this.state.tokenUrl}+ value={this.state.tokenURL}disabled={!Fider.session.user.isAdministrator}- onChange={this.setTokenUrl}+ onChange={this.setTokenURL}/><Input@@ -244,12 +244,12 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {</p><Input- field="profileUrl"+ field="profileURL"label="Profile API URL"maxLength={300}- value={this.state.profileUrl}+ value={this.state.profileURL}disabled={!Fider.session.user.isAdministrator}- onChange={this.setProfileUrl}+ onChange={this.setProfileURL}><p className="info">The URL to fetch the authenticated user info. If empty, Fider will try to parse the user info from the@@ -261,13 +261,13 @@ export class OAuthForm extends React.Component<OAuthFormProps, OAuthFormState> {<div className="row"><Input- field="jsonUserIdPath"+ field="jsonUserIDPath"label="ID"className="col-sm-4"maxLength={100}- value={this.state.jsonUserIdPath}+ value={this.state.jsonUserIDPath}disabled={!Fider.session.user.isAdministrator}- onChange={this.setJSONUserIdPath}+ onChange={this.setJSONUserIDPath}><p className="info">Path to extract User ID from the JSON. This ID <strong>must</strong> be unique within the provider ordiff --git a/public/pages/Administration/pages/GeneralSettings.page.tsx b/public/pages/Administration/pages/GeneralSettings.page.tsxindex 1b8f25dad..aa82427b2 100644--- a/public/pages/Administration/pages/GeneralSettings.page.tsx+++ b/public/pages/Administration/pages/GeneralSettings.page.tsx@@ -10,7 +10,7 @@ import {Input,ImageUploader,ImageUploadState,- TenantLogoUrl+ TenantLogoURL} from "@fider/components/common";import { actions, Failure, fileToBase64, Fider } from "@fider/services";import { AdminBasePage } from "../components";@@ -153,7 +153,7 @@ export class GeneralSettingsPage extends AdminBasePage<GeneralSettingsPageProps,<ImageUploaderlabel="Logo"field="logo"- defaultImageUrl={TenantLogoUrl(200)}+ defaultImageURL={TenantLogoURL(200)}previewMaxWidth={200}disabled={!Fider.session.user.isAdministrator}onChange={this.setLogo}diff --git a/public/pages/Administration/pages/ManageAuthentication.page.tsx b/public/pages/Administration/pages/ManageAuthentication.page.tsxindex 0a4e39d56..40d90739a 100644--- a/public/pages/Administration/pages/ManageAuthentication.page.tsx+++ b/public/pages/Administration/pages/ManageAuthentication.page.tsx@@ -6,7 +6,7 @@ import { AdminBasePage } from "../components";import { Segment, List, ListItem, Button, Heading, OAuthProviderLogo } from "@fider/components";import { OAuthConfig, OAuthProviderOption } from "@fider/models";import { OAuthForm } from "../components/OAuthForm";-import { actions, notify, navigator, Fider, uploadedImageUrl } from "@fider/services";+import { actions, notify, navigator, Fider, uploadedImageURL } from "@fider/services";interface ManageAuthenticationPageProps {providers: OAuthProviderOption[];@@ -107,8 +107,8 @@ export class ManageAuthenticationPage extends AdminBasePage<</div>{o.isCustomProvider && (<span className="info">- <strong>Client ID:</strong> {o.clientId} <br />- <strong>Callback URL:</strong> {o.callbackUrl}+ <strong>Client ID:</strong> {o.clientID} <br />+ <strong>Callback URL:</strong> {o.callbackURL}</span>)}</ListItem>diff --git a/public/pages/SignUp/SignUp.page.tsx b/public/pages/SignUp/SignUp.page.tsxindex 85362ba7c..5cde9dbd0 100644--- a/public/pages/SignUp/SignUp.page.tsx+++ b/public/pages/SignUp/SignUp.page.tsx@@ -64,12 +64,12 @@ export class SignUpPage extends React.Component<{}, SignUpPageState> {if (Fider.isSingleHostMode()) {location.reload();} else {- let baseUrl = `${location.protocol}//${this.state.subdomain.value}${Fider.settings.domain}`;+ let baseURL = `${location.protocol}//${this.state.subdomain.value}${Fider.settings.domain}`;if (location.port) {- baseUrl = `${baseUrl}:${location.port}`;+ baseURL = `${baseURL}:${location.port}`;}- location.href = baseUrl;+ location.href = baseURL;}} else {this.setState({ submitted: true });diff --git a/public/services/actions/post.ts b/public/services/actions/post.tsindex 67dba066e..48c61a5b3 100644--- a/public/services/actions/post.ts+++ b/public/services/actions/post.ts@@ -51,9 +51,9 @@ export const createComment = async (postNumber: number, content: string): Promisreturn http.post(`/api/v1/posts/${postNumber}/comments`, { content }).then(http.event("comment", "create"));};-export const updateComment = async (postNumber: number, commentId: number, content: string): Promise<Result> => {+export const updateComment = async (postNumber: number, commentID: number, content: string): Promise<Result> => {return http- .put(`/api/v1/posts/${postNumber}/comments/${commentId}`, { content })+ .put(`/api/v1/posts/${postNumber}/comments/${commentID}`, { content }).then(http.event("comment", "update"));};diff --git a/public/services/actions/tenant.ts b/public/services/actions/tenant.tsindex c243342fc..25849c3b3 100644--- a/public/services/actions/tenant.ts+++ b/public/services/actions/tenant.ts@@ -68,9 +68,9 @@ export const completeProfile = async (key: string, name: string): Promise<Result});};-export const changeUserRole = async (userId: number, role: UserRole): Promise<Result> => {+export const changeUserRole = async (userID: number, role: UserRole): Promise<Result> => {return await http.post(`/_api/admin/roles/${role}/users`, {- userId+ userID});};@@ -82,13 +82,13 @@ export interface CreateEditOAuthConfigRequest {provider: string;status: number;displayName: string;- clientId: string;+ clientID: string;clientSecret: string;- authorizeUrl: string;- tokenUrl: string;+ authorizeURL: string;+ tokenURL: string;scope: string;- profileUrl: string;- jsonUserIdPath: string;+ profileURL: string;+ jsonUserIDPath: string;jsonUserNamePath: string;jsonUserEmailPath: string;logo?: ImageUploadState;diff --git a/public/services/navigator.ts b/public/services/navigator.tsindex f4ed75135..294738388 100644--- a/public/services/navigator.ts+++ b/public/services/navigator.ts@@ -12,8 +12,8 @@ const navigator = {},replaceState: (path: string): void => {if (history.replaceState) {- const newUrl = Fider.settings.baseURL + path;- window.history.replaceState({ path: newUrl }, "", newUrl);+ const newURL = Fider.settings.baseURL + path;+ window.history.replaceState({ path: newURL }, "", newURL);}}};diff --git a/public/services/utils.ts b/public/services/utils.tsindex 67ff40e14..97802f164 100644--- a/public/services/utils.ts+++ b/public/services/utils.ts@@ -123,7 +123,7 @@ export const isCookieEnabled = (): boolean => {}};-export const uploadedImageUrl = (id: number, size: number): string | undefined => {+export const uploadedImageURL = (id: number, size: number): string | undefined => {if (id > 0) {return `${Fider.settings.assetsURL}/images/${size}/${id}`;}diff --git a/tests/lib/browser.ts b/tests/lib/browser.tsindex ca2caeca3..af22e2cc6 100644--- a/tests/lib/browser.ts+++ b/tests/lib/browser.ts@@ -16,9 +16,9 @@ export class Browser {return new Browser(browser);}- public async newTab(baseUrl: string): Promise<BrowserTab> {+ public async newTab(baseURL: string): Promise<BrowserTab> {const page = await this.browser.newPage();- return new BrowserTab(page, baseUrl);+ return new BrowserTab(page, baseURL);}public async close(): Promise<void> {diff --git a/tests/lib/mailgun.ts b/tests/lib/mailgun.tsindex 0c82052ba..1cca56a93 100644--- a/tests/lib/mailgun.ts+++ b/tests/lib/mailgun.ts@@ -24,7 +24,7 @@ const httpGet = (endpoint: string): Promise<any> => {export const mailgun = {getLinkFromLastEmailTo: async (tenant: string, subject: string, to: string): Promise<string> => {- let messageUrl = "";+ let messageURL = "";let count = 0;do {@@ -39,17 +39,17 @@ export const mailgun = {const events = await httpGet(url);if (events.items.length > 0 && events.items[0].recipient === to) {- messageUrl = events.items[0].storage.url;+ messageURL = events.items[0].storage.url;} else {await delay(500);}- } while (!messageUrl && count < 30);+ } while (!messageURL && count < 30);if (count === 30) {throw new Error(`Message not found for ${to}.`);}- const messages = await httpGet(messageUrl);+ const messages = await httpGet(messageURL);const matches = /<a\s+(?:[^>]*?\s+)?href=(["'])(.*?)\1/.exec(messages["body-html"]);if (matches) {diff --git a/tests/lib/page.ts b/tests/lib/page.tsindex c14adf9af..f723a128d 100644--- a/tests/lib/page.ts+++ b/tests/lib/page.ts@@ -6,14 +6,14 @@ export interface NewablePage<T extends Page> {export abstract class Page {public async navigate(): Promise<void> {- await this.tab.navigate(this.getUrl());+ await this.tab.navigate(this.getURL());await this.tab.wait(this.loadCondition());}public abstract loadCondition(): WaitCondition;- protected getUrl(): string {- throw new Error("getUrl not implemented");+ protected getURL(): string {+ throw new Error("getURL not implemented");}public constructor(protected tab: BrowserTab) {}diff --git a/tests/lib/tab.ts b/tests/lib/tab.tsindex f8ebb021e..9690d3f50 100644--- a/tests/lib/tab.ts+++ b/tests/lib/tab.ts@@ -6,11 +6,11 @@ import { pageHasLoaded } from "./conditions";export class BrowserTab {private page: puppeteer.Page;public pages: AllPages;- public baseUrl: string;+ public baseURL: string;- public constructor(page: puppeteer.Page, baseUrl: string) {+ public constructor(page: puppeteer.Page, baseURL: string) {this.page = page;- this.baseUrl = baseUrl;+ this.baseURL = baseURL;this.pages = new AllPages(this);}diff --git a/tests/pages/GeneralSettingsPage.ts b/tests/pages/GeneralSettingsPage.tsindex 5de7b15dd..832a525dc 100644--- a/tests/pages/GeneralSettingsPage.ts+++ b/tests/pages/GeneralSettingsPage.ts@@ -16,8 +16,8 @@ export class GeneralSettingsPage extends Page {super(tab);}- public getUrl(): string {- return `${this.tab.baseUrl}/admin`;+ public getURL(): string {+ return `${this.tab.baseURL}/admin`;}@findBy("#p-admin-general #input-title")diff --git a/tests/pages/HomePage.ts b/tests/pages/HomePage.tsindex 88dcdb575..f5800506a 100644--- a/tests/pages/HomePage.ts+++ b/tests/pages/HomePage.ts@@ -17,8 +17,8 @@ export class HomePage extends Page {super(tab);}- public getUrl(): string {- return `${this.tab.baseUrl}/`;+ public getURL(): string {+ return `${this.tab.baseURL}/`;}@findBy(".c-menu-item-title")diff --git a/tests/pages/SignUpPage.ts b/tests/pages/SignUpPage.tsindex a26bcbf25..708865b94 100644--- a/tests/pages/SignUpPage.ts+++ b/tests/pages/SignUpPage.ts@@ -16,8 +16,8 @@ export class SignUpPage extends Page {super(tab);}- public getUrl(): string {- return `${this.tab.baseUrl}/signup`;+ public getURL(): string {+ return `${this.tab.baseURL}/signup`;}@findBy("#p-signup")diff --git a/tests/scenarios/index.ts b/tests/scenarios/index.tsindex cbc55acff..6a855aa0f 100644--- a/tests/scenarios/index.ts+++ b/tests/scenarios/index.ts@@ -26,11 +26,11 @@ describe("E2E", () => {const now = new Date().getTime();const tenantName = `Selenium ${now}`;const tenantSubdomain = process.env.HOST_MODE === "single" ? "login" : `selenium${now}`;- const baseUrl = `http://${tenantSubdomain}.dev.fider.io:3000`;+ const baseURL = `http://${tenantSubdomain}.dev.fider.io:3000`;const browser1 = await Browser.launch();- const tab1 = await browser1.newTab(baseUrl);+ const tab1 = await browser1.newTab(baseURL);const browser2 = await Browser.launch();- const tab2 = await browser2.newTab(baseUrl);+ const tab2 = await browser2.newTab(baseURL);ctx = {tenantName,