<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { Components } from 'meteor/vulcan:core';
import { registerComponent } from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';

const FormSubmit = ({
  submitForm,
  submitLabel,
  cancelLabel,
  cancelCallback,
  revertLabel,
  revertCallback,
  document,
  deleteDocument,
  collectionName,
  classes,
  currentUser,
}, {
  isChanged,
  clearForm,
}) => (
  <div className="form-submit">
    <Components.Button type="submit" variant="primary">
      {submitLabel ? submitLabel : <Components.FormattedMessage id="forms.submit" defaultMessage="Submit" />}
    </Components.Button>

    {cancelCallback ? (
      <a
        className="form-cancel"
        onClick={e => {
          e.preventDefault();
          cancelCallback(document);
        }}
      >
        {cancelLabel ? cancelLabel : <Components.FormattedMessage id="forms.cancel" defaultMessage="Cancel" />}
      </a>
    ) : null}
  
    {revertCallback ? (
      <a
        className="form-cancel"
        onClick={e => {
          e.preventDefault();
          clearForm();
          revertCallback(document);
        }}
      >
      {revertLabel ? revertLabel : <Components.FormattedMessage id="forms.revert" defaultMessage="Revert" />}
      </a>
    ) : null}
  
    { deleteDocument && Users.canDelete({
        context: { Users },
        user: currentUser,
        document,
        collectionName
      }) ? (
      <div>
        <hr />
        <Components.Button variant="link" onClick={deleteDocument} className={`delete-link ${collectionName}-delete-link`}>
          <Components.Icon name="close" /> <Components.FormattedMessage id="forms.delete" defaultMessage="Delete" />
        </Components.Button>
      </div>
    ) : null}
  </div>
);

FormSubmit.propTypes = {
  submitLabel: PropTypes.node,
  cancelLabel: PropTypes.node,
  cancelCallback: PropTypes.func,
  revertLabel: PropTypes.node,
  revertCallback: PropTypes.func,
  document: PropTypes.object,
  deleteDocument: PropTypes.func,
  collectionName: PropTypes.string,
  classes: PropTypes.object
};<commit_msg>Issue #2664 - Removed unused parameter in canDelete permission check<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { Components } from 'meteor/vulcan:core';
import { registerComponent } from 'meteor/vulcan:core';
import Users from 'meteor/vulcan:users';

const FormSubmit = ({
  submitForm,
  submitLabel,
  cancelLabel,
  cancelCallback,
  revertLabel,
  revertCallback,
  document,
  deleteDocument,
  collectionName,
  classes,
  currentUser,
}, {
  isChanged,
  clearForm,
}) => (
  <div className="form-submit">
    <Components.Button type="submit" variant="primary">
      {submitLabel ? submitLabel : <Components.FormattedMessage id="forms.submit" defaultMessage="Submit" />}
    </Components.Button>

    {cancelCallback ? (
      <a
        className="form-cancel"
        onClick={e => {
          e.preventDefault();
          cancelCallback(document);
        }}
      >
        {cancelLabel ? cancelLabel : <Components.FormattedMessage id="forms.cancel" defaultMessage="Cancel" />}
      </a>
    ) : null}
  
    {revertCallback ? (
      <a
        className="form-cancel"
        onClick={e => {
          e.preventDefault();
          clearForm();
          revertCallback(document);
        }}
      >
      {revertLabel ? revertLabel : <Components.FormattedMessage id="forms.revert" defaultMessage="Revert" />}
      </a>
    ) : null}
  
    { deleteDocument && Users.canDelete({
        user: currentUser,
        document,
        collectionName
      }) ? (
      <div>
        <hr />
        <Components.Button variant="link" onClick={deleteDocument} className={`delete-link ${collectionName}-delete-link`}>
          <Components.Icon name="close" /> <Components.FormattedMessage id="forms.delete" defaultMessage="Delete" />
        </Components.Button>
      </div>
    ) : null}
  </div>
);

FormSubmit.propTypes = {
  submitLabel: PropTypes.node,
  cancelLabel: PropTypes.node,
  cancelCallback: PropTypes.func,
  revertLabel: PropTypes.node,
  revertCallback: PropTypes.func,
  document: PropTypes.object,
  deleteDocument: PropTypes.func,
  collectionName: PropTypes.string,
  classes: PropTypes.object
};
{'fraction_non_alphanumeric': 0.13117033603707995, 'fraction_numerical': 0.0009269988412514484, 'mean_word_length': 2.9852262234533704, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5995070', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1264, 'n_words': 238}