Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Author-login empty on commit messages for Azure backend #7199

Open
techbecca opened this issue May 7, 2024 · 0 comments
Open

Author-login empty on commit messages for Azure backend #7199

techbecca opened this issue May 7, 2024 · 0 comments
Labels
area: extensions/backends/azure type: bug code to address defects in shipped code

Comments

@techbecca
Copy link

Describe the bug
I've set up commit messages templates according to the documentation (see CMS config-file). I expected to see the users login email or username when using {{author-login}}, but the value just returns empty. The users are logged in to the same organization as the repository is in. I can see errors in the console log related to decap's calls to fetch Azure users.

backend:
  name: azure
  repo: [redacted]
  tenant_id: [redacted]
  app_id: [redacted]
  branch: main # Branch to update (optional; defaults to master)
  commit_messages:
    create: Create {{collection}} “{{slug}}” by "{{author-login}}"
    update: Update {{collection}} “{{slug}}” by "{{author-login}}"
    delete: Delete {{collection}} “{{slug}}” by "{{author-login}}"
    uploadMedia: Upload “{{path}}” by "{{author-login}}"
    deleteMedia: Delete “{{path}}” by "{{author-login}}"

To Reproduce

  1. Go to the config.yml file for Decap
  2. Set commit message templates which includes the {{author-login}} variable
  3. Commit and build (so the templates will be used)
  4. Create a new post from the Decap CMS UI
  5. See commit message

Expected behavior
The commit messages should include the author's username or email, as well as the collection and slug for the new item created.

Actual behavior
Only the collection and slug for the item created is included in the commit message, not the author details.

Screenshots
image

Applicable Versions:

  • Decap CMS version: decap-cms-app -> 3.1.4 and `decap-cms-core ->
  • Git provider: [e.g. GitHub, BitBucket]
  • OS: [e.g. Windows 7]
  • Browser version [e.g. chrome 22, safari 11]
  • Node.JS version:

CMS configuration

backend:
  name: azure
  repo: [redacted]
  tenant_id: [redacted]
  app_id: [redacted]
  branch: main # Branch to update (optional; defaults to master)
  commit_messages:
    create: Create {{collection}} “{{slug}}” by "{{author-login}}"
    update: Update {{collection}} “{{slug}}” by "{{author-login}}"
    delete: Delete {{collection}} “{{slug}}” by "{{author-login}}"
    uploadMedia: Upload “{{path}}” by "{{author-login}}"
    deleteMedia: Delete “{{path}}” by "{{author-login}}"

media_folder: static/img
public_folder: /img
publish_mode: editorial_workflow
site_url: [redacted]
# display_url: https://your-site.com
logo_url: [redacted]

local_backend: true

# i18n:
#   # Required and can be one of multiple_folders, multiple_files or single_file
#   # multiple_folders - persists files in `<folder>/<locale>/<slug>.<extension>`
#   # multiple_files - persists files in `<folder>/<slug>.<locale>.<extension>`
#   # single_file - persists a single file in `<folder>/<slug>.<extension>`
#   structure: multiple_files

#   # Required - a list of locales to show in the editor UI
#   locales: [en, se]

#   # Optional, defaults to the first item in locales.
#   # The locale to be used for fields validation and as a baseline for the entry.
#   default_locale: en

collections:
  - name: "esm"
    label: [redacted]
    description: >
      [redacted]
    folder: "content/esm"
    create: true
    # i18n: true
    slug: "{{title}}"
    path: "{{title}}/index"
    sortable_fields: ["date", "commit_date", "title", "commit_author", "order"]
    meta:
      {
        path:
          {
            widget: string,
            label: "Path",
            index_file: "index",
            default: "{{dirname}}",
            hint: "Example: Setting path to [redacted] will result in the url [redacted]",
          },
      }
    nested:
      depth: 3
      summary: "{{title}}"
    summary: "{{order}} - {{title}}"
    fields:
      - {
          label: "Page Template",
          name: "templateKey",
          widget: "select",
          options: ["item-page", "chapter-page", "title-page"],
          default: ["item-page"],
          # i18n: duplicate,
        }
      - {
          label: "Sort Order",
          name: "order",
          widget: "number",
          value_type: int,
          default: 0,
          min: -99,
          max: 99,
          hint: "Any number between -99 and 99. A higher number will put the article higher in the navigational structure.",
          #i18n: duplicate
        }
      - {
          label: "Title",
          name: "title",
          widget: "string", # i18n: true
        }
      - {
          label: "Publish Date",
          name: "date",
          widget: "datetime",
          # i18n: duplicate,
        }
      - {
          label: "Description",
          name: "description",
          widget: "text",
          required: false,
          # i18n: true,
        }
      - {
          label: "Featured",
          name: "featured",
          widget: "boolean",
          required: false,
          # i18n: duplicate
        }
      - {
          label: "Body",
          name: "body",
          widget: "markdown",
          # i18n: true
        }
      - {
          label: "Tags",
          name: "tags",
          widget: "list",
          # i18n: true
        }
  - name: "ecc"
    label: "[redacted]"
    description: >
      [redacted]
    folder: "content/ecc"
    create: true
    # i18n: true
    slug: "{{title}}"
    path: "{{title}}/index"
    sortable_fields: ["date", "commit_date", "title", "commit_author", "order"]
    meta:
      {
        path:
          {
            widget: string,
            label: "Path",
            index_file: "index",
            default: "{{dirname}}",
            hint: "Example: Setting path to security-services will result in the url [redacted]",
          },
      }
    nested:
      depth: 3
      summary: "{{title}}"
    summary: "{{order}} - {{title}}"
    fields:
      - {
          label: "Page Template",
          name: "templateKey",
          widget: "select",
          options: ["item-page", "chapter-page", "title-page"],
          default: ["item-page"],
          # i18n: duplicate,
        }
      - {
          label: "Sort Order",
          name: "order",
          widget: "number",
          value_type: int,
          default: 0,
          min: -99,
          max: 99,
          hint: "Any number between -99 and 99. A higher number will put the article higher in the navigational structure.",
          #i18n: duplicate
        }
      - {
          label: "Title",
          name: "title",
          widget: "string", # i18n: true
        }
      - {
          label: "Publish Date",
          name: "date",
          widget: "datetime",
          # i18n: duplicate,
        }
      - {
          label: "Description",
          name: "description",
          widget: "text",
          required: false,
          # i18n: true,
        }
      - {
          label: "Featured",
          name: "featured",
          widget: "boolean",
          required: false,
          # i18n: duplicate
        }
      - {
          label: "Body",
          name: "body",
          widget: "markdown",
          # i18n: true
        }
      - {
          label: "Tags",
          name: "tags",
          widget: "list",
          # i18n: true
        }
  - name: "release-notes" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "Release Notes" # Used in the UI
    folder: "content/release-notes"
    create: true # Allow users to create new documents in this collection
    # i18n: true # Enables multiple language editor. Needs to be set on each field affected
    slug: "{{title}}"
    path: "{{title}}/index"
    sortable_fields: ["date", "commit_date", "title", "commit_author"]
    meta:
      {
        path:
          {
            widget: string,
            label: "Path",
            index_file: "index",
            default: "{{path}}",
            hint: "Example: Setting path to v4/release-4-25-0 will result in the url [redacted]",
          },
      }
    nested:
      depth: 3
      summary: "{{title}}"
    summary: "{{title}}"
    fields: # The fields each document in this collection have
      - {
          label: "Page Template",
          name: "templateKey",
          widget: "select",
          options:
            ["release-note", "rolling-chapter-page", "rolling-title-page"],
          default: ["release-note"],
          # i18n: duplicate,
        }
      - {
          label: "Title",
          name: "title",
          widget: "string",
          tagname: "h1",
          # i18n: true,
        }
      - {
          label: "Publish Date",
          name: "date",
          widget: "datetime",
          # i18n: duplicate,
        }
      - {
          label: "Body",
          name: "body",
          widget: "markdown", # i18n: true
        }
  - name: "faq" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "FAQ" # Used in the UI
    folder: "content/faq"
    create: true # Allow users to create new documents in this collection
    # i18n: true # Enables multiple language editor. Needs to be set on each field affected
    fields: # The fields each document in this collection have
      - {
          label: "Page Template",
          name: "templateKey",
          widget: "hidden",
          default: "faq", # Template does not exist yet
          # i18n: true,
        }
      - {
          label: "Question",
          name: "title",
          widget: "string",
          tagname: "h1",
          # i18n: true,
        }
      - {
          label: "Answer",
          name: "body",
          widget: "markdown",
          # i18n: true
        }
  - name: "news" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "News" # Used in the UI
    folder: "content/news"
    create: true # Allow users to create new documents in this collection
    # i18n: true # Enables multiple language editor. Needs to be set on each field affected
    slug: "{{title}}"
    path: "{{title}}/index"
    sortable_fields: ["date", "commit_date", "title", "commit_author"]
    meta:
      {
        path:
          {
            widget: string,
            label: "Path",
            index_file: "index",
            default: "{{fields.title}}",
            hint: "Example: Setting path to ecc-launch will result in the url [redacted]",
          },
      }
    nested:
      depth: 2
      summary: "{{title}}"
    summary: "{{title}}"
    fields: # The fields each document in this collection have
      - {
          label: "Page Template",
          name: "templateKey",
          widget: "select",
          options: ["news-page", "title-page"],
          default: ["news-page"],
          # i18n: duplicate,
        }
      - {
          label: "Title",
          name: "title",
          widget: "string",
          tagname: "h1",
          # i18n: true,
        }
      - {
          label: "Publish Date",
          name: "date",
          widget: "datetime",
          # i18n: duplicate,
        }
      - {
          label: "Featured",
          name: "featured",
          widget: "boolean",
          required: false,
          # i18n: duplicate
        }
      - {
          label: "Body",
          name: "body",
          widget: "markdown", # i18n: true
        }
      - {
          label: "Tags",
          name: "tags",
          widget: "list",
          # i18n: true
        }
  - name: "pages" # Used in routes, ie.: /admin/collections/:slug/edit
    label: "Top-Level Pages" # Used in the UI
    label_singular: "Top-Level Page"
    folder: "content"
    slug: "{{title}}"
    path: "{{title}}/index"
    create: true # Allow users to create new documents in this collection
    # i18n: true # Enables multiple language editor. Needs to be set on each field affected
    meta:
      {
        path:
          {
            widget: string,
            label: "Filename",
            index_file: "index",
            default: "{{path}}",
            hint: "Example: Setting path to release-notes will result in the url [redacted]",
          },
      }
    fields: # The fields each document in this collection have
      - {
          label: "Page Template",
          name: "templateKey",
          widget: "select",
          options:
            [
              { label: "general", value: "general" },
              { label: "collection-title-page", value: "title-page" },
              { label: "rolling-title-page", value: "rolling-title-page" },
            ],
          default: ["general"],
          # i18n: duplicate,
        }
      - {
          label: "Title",
          name: "title",
          widget: "string",
          tagname: "h1",
          # i18n: true,
        }
      - {
          label: "Body",
          name: "body",
          widget: "markdown",
          # i18n: true
        }

Additional context
I'm getting the following errors in the console log that are probably related:

image image
@techbecca techbecca added the type: bug code to address defects in shipped code label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: extensions/backends/azure type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants