Skip to content

Commit

Permalink
Merge pull request #22 from scm-manager/bugfix/merge_without_email
Browse files Browse the repository at this point in the history
Replace author information with CommitAuthor component
  • Loading branch information
sdorra authored Oct 16, 2020
2 parents 4e94a68 + 138b37f commit e75f2c9
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 61 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### Fixed
- Committing without an email address ([#22](https://github.com/scm-manager/scm-editor-plugin/pull/22))

## 2.1.1 - 2020-09-15
### Fixed
- Redundant URL encoding for branch in edit ([#21](https://github.com/scm-manager/scm-editor-plugin/pull/21))
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<parent>
<artifactId>scm-plugins</artifactId>
<groupId>sonia.scm.plugins</groupId>
<version>2.0.0</version>
<version>2.8.0-SNAPSHOT</version>
</parent>

<artifactId>scm-editor-plugin</artifactId>
Expand Down
12 changes: 3 additions & 9 deletions src/main/js/CommitMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,24 @@
*/
import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Textarea } from "@scm-manager/ui-components";
import { Me } from "@scm-manager/ui-types";
import { Textarea, CommitAuthor } from "@scm-manager/ui-components";
import styled from "styled-components";

const MarginBottom = styled.div`
margin-bottom: 0.5rem;
`;

type Props = WithTranslation & {
me: Me;
onChange: (p: string) => void;
disabled: boolean;
};

class CommitMessage extends React.Component<Props> {
render() {
const { t, me, onChange, disabled } = this.props;
const { t, onChange, disabled } = this.props;
return (
<>
<MarginBottom>
<span>
<strong>{t("scm-editor-plugin.commit.author")}</strong> {me.displayName + " <" + me.mail + ">"}
</span>
</MarginBottom>
<MarginBottom><CommitAuthor /></MarginBottom>
<Textarea
placeholder={t("scm-editor-plugin.commit.placeholder")}
onChange={message => onChange(message)}
Expand Down
18 changes: 2 additions & 16 deletions src/main/js/Delete/FileDeleteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { File, Me } from "@scm-manager/ui-types";

type Props = WithTranslation & {
file: File;
me?: Me;
onCommit: (p: string) => void;
onClose: () => void;
loading: boolean;
Expand All @@ -56,12 +55,11 @@ class FileRemoveModal extends React.Component<Props, State> {
};

render() {
const { onCommit, onClose, loading, me, t } = this.props;
const { onCommit, onClose, loading, t } = this.props;
const { commitMessage } = this.state;

const body = (
<CommitMessage
me={me}
commitMessage={this.state.commitMessage}
onChange={this.changeCommitMessage}
disabled={loading}
Expand Down Expand Up @@ -99,16 +97,4 @@ class FileRemoveModal extends React.Component<Props, State> {
}
}

const mapStateToProps = state => {
const { auth } = state;
const me = auth.me;

return {
me
};
};

export default compose(
withTranslation("plugins"),
connect(mapStateToProps)
)(FileRemoveModal);
export default withTranslation("plugins")(FileRemoveModal);
20 changes: 4 additions & 16 deletions src/main/js/Edit/FileEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Changeset, File, Link, Me, Repository } from "@scm-manager/ui-types";
import { Changeset, File, Link, Repository } from "@scm-manager/ui-types";
import { RouteComponentProps, withRouter } from "react-router-dom";
import FileMetaData from "../FileMetaData";
import {
Expand All @@ -36,8 +36,6 @@ import {
Subtitle,
Breadcrumb
} from "@scm-manager/ui-components";
import { compose } from "redux";
import { connect } from "react-redux";
import CommitMessage from "../CommitMessage";
import { isEditable } from "./isEditable";
import styled from "styled-components";
Expand Down Expand Up @@ -88,7 +86,6 @@ type FileWithType = File & {
type Props = WithTranslation &
RouteComponentProps & {
repository: Repository;
me: Me;
extension: string;
revision?: string;
path?: string;
Expand Down Expand Up @@ -359,7 +356,7 @@ class FileEdit extends React.Component<Props, State> {
};

render() {
const { revision, t, me, repository, baseUrl } = this.props;
const { revision, t, repository, baseUrl } = this.props;
const {
path,
file,
Expand Down Expand Up @@ -420,7 +417,7 @@ class FileEdit extends React.Component<Props, State> {
<Editor onChange={this.changeFileContent} content={content} disabled={loading} language={language} />
</Border>
<ExtensionPoint name="editor.file.hints" renderAll={true} props={extensionsProps} />
<CommitMessage me={me} commitMessage={commitMessage} onChange={this.changeCommitMessage} disabled={loading} />
<CommitMessage commitMessage={commitMessage} onChange={this.changeCommitMessage} disabled={loading} />
{error && <ErrorNotification error={error} />}
<div className="level">
<div className="level-left" />
Expand All @@ -446,13 +443,4 @@ class FileEdit extends React.Component<Props, State> {
}
}

const mapStateToProps = (state: any) => {
const { auth } = state;
const me = auth.me;

return {
me
};
};

export default compose(withRouter, connect(mapStateToProps), withTranslation("plugins"))(FileEdit);
export default withRouter(withTranslation("plugins")(FileEdit));
22 changes: 5 additions & 17 deletions src/main/js/Upload/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
* SOFTWARE.
*/
import React from "react";
import { compose } from "redux";
import { connect } from "react-redux";
import { withRouter, RouteComponentProps } from "react-router-dom";
import { RouteComponentProps, withRouter } from "react-router-dom";
import { WithTranslation, withTranslation } from "react-i18next";
import { File, Me, Repository, Link, Changeset } from "@scm-manager/ui-types";
import { File, Repository, Link, Changeset } from "@scm-manager/ui-types";
import { apiClient, Button, ButtonGroup, ErrorNotification, Subtitle, Breadcrumb } from "@scm-manager/ui-components";
import FileUploadDropzone from "./FileUploadDropzone";
import FilePath from "../FileMetaData";
Expand Down Expand Up @@ -75,7 +73,6 @@ const Border = styled.div`

type Props = WithTranslation &
RouteComponentProps & {
me?: Me;
url: string;
repository: Repository;
sources: File;
Expand Down Expand Up @@ -201,7 +198,7 @@ class FileUpload extends React.Component<Props, State> {
};

render() {
const { repository, revision, me, baseUrl, t } = this.props;
const { repository, revision, baseUrl, t } = this.props;
const { files, path, commitMessage, error, loading } = this.state;

return (
Expand All @@ -224,7 +221,7 @@ class FileUpload extends React.Component<Props, State> {
<FileUploadTable files={files} removeFileEntry={this.removeFileEntry} disabled={loading} />
)}
{error && <ErrorNotification error={error} />}
<CommitMessage me={me} commitMessage={commitMessage} onChange={this.changeCommitMessage} disabled={loading} />
<CommitMessage commitMessage={commitMessage} onChange={this.changeCommitMessage} disabled={loading} />
<br />
<div className="level">
<div className="level-left" />
Expand All @@ -246,13 +243,4 @@ class FileUpload extends React.Component<Props, State> {
}
}

const mapStateToProps = (state: any) => {
const { auth } = state;
const me = auth.me;

return {
me
};
};

export default compose(withTranslation("plugins"), withRouter, connect(mapStateToProps))(FileUpload);
export default withRouter(withTranslation("plugins")(FileUpload));
1 change: 0 additions & 1 deletion src/main/resources/locales/de/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"tooltip": "Neue Datei erstellen"
},
"commit": {
"author": "Autor",
"placeholder": "Bitte eine Commit Nachricht eintragen"
},
"errors": {
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/locales/en/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"tooltip": "Create new file"
},
"commit": {
"author": "Author",
"placeholder": "Please insert your commit message"
},
"errors": {
Expand Down

0 comments on commit e75f2c9

Please sign in to comment.