{
  "name": "Lock monitor Group Posts",
  "nodes": [
    {
      "id": "92315389-b80f-40c6-aac9-8ed00c1802e4",
      "type": "trigger:post_created",
      "typeVersion": "1.0",
      "name": "Post created",
      "parameters": {},
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 316.1355880915902,
        "y": 431.6790100154883
      }
    },
    {
      "id": "3bb71781-9ab4-4eb2-bbb9-3b65d03d3db2",
      "type": "action:group",
      "typeVersion": "1.0",
      "name": "Group",
      "parameters": {
        "group_id": "={{ $vars.monitor_group_id }}",
        "username": "={{ $(\"Trigger data\").first().json.user.username }}",
        "operation": "check_membership",
        "actor_username": "system"
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 536.327640441657,
        "y": 431.5625484792788
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "c84dc50b-9b78-4759-8b3d-a45e17f8ec7e",
      "type": "trigger:manual",
      "typeVersion": "1.0",
      "name": "DEBUG",
      "parameters": {},
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 315.6642093727396,
        "y": 328.015029189261
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "43c8f4fd-c42a-4d5f-8d12-a223705a8dd4",
      "type": "action:user",
      "typeVersion": "1.0",
      "name": "User",
      "parameters": {
        "updates": {},
        "username": "={{ $(\"Trigger data\").first().json.user.username }}",
        "operation": "get",
        "actor_username": "system",
        "include_extensions": []
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 834.0590786319772,
        "y": 431.3505574055109
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "5e1cb93c-da80-4141-9494-c27b6602436c",
      "type": "condition:filter",
      "typeVersion": "1.0",
      "name": "Non-staff?",
      "parameters": {
        "combinator": "and",
        "conditions": [
          {
            "id": "fc654f7f-3297-42f5-a033-eab9831fccb2",
            "operator": {
              "type": "string",
              "operation": "equals",
              "singleValue": false
            },
            "leftValue": "={{ $json.user.staff }}",
            "rightValue": "false"
          }
        ]
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 900.6516646441282,
        "y": 430.8326813758936
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "391c1690-b09d-4fbb-85e5-2cc706d643ce",
      "type": "action:code",
      "typeVersion": "1.0",
      "name": "Trigger data",
      "parameters": {
        "code": "var triggerData = {};\r\n\r\n// Populate from step that triggered this run.\r\nif (Object.keys($(\"DEBUG\").first().json).length !== 0) {\r\n  triggerData = $(\"DEBUG\").first().json;\r\n} else if (Object.keys($(\"Post created\").first().json).length !== 0) {\r\n  triggerData = $(\"Post created\").first().json;\r\n} else {\r\n  throw new Error(\"Unknown trigger.\");\r\n}\r\n\r\nreturn [triggerData];\r\n",
        "mode": "runOnceForAllItems"
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 429.9366438589049,
        "y": 432.0780303317931
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "0179538c-63b8-4314-ad0a-9670ede88f18",
      "type": "condition:filter",
      "typeVersion": "1.0",
      "name": "Member?",
      "parameters": {
        "combinator": "and",
        "conditions": [
          {
            "id": "46b1d557-cde5-4cc7-97de-103b9a1d6ac6",
            "operator": {
              "type": "string",
              "operation": "equals",
              "singleValue": false
            },
            "leftValue": "={{ $json.group_membership.in_group }}",
            "rightValue": "true"
          }
        ]
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 606.65509348284,
        "y": 431.238007462754
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "d23c50bf-7458-44fc-94e1-82b0bfe4759f",
      "type": "action:workflow_call",
      "typeVersion": "1.0",
      "name": "Lock post",
      "parameters": {
        "fields": {
          "assignments": [
            {
              "id": "a15979c2-62af-40fc-aec9-b4dbfbc0839e",
              "name": "id",
              "type": "number",
              "value": "={{ $(\"Trigger data\").first().json.post.id }}"
            },
            {
              "id": "3b3bd930-834b-4ba6-b799-35641174eb42",
              "name": "lock",
              "type": "boolean",
              "value": true
            }
          ]
        },
        "workflow_id": 40,
        "mapping_mode": "manual"
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 1126.580330927725,
        "y": 431.1580779201212
      },
      "notes": "",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "id": "8594127b-47a8-4fad-824d-c8fe26c4ccc0",
      "type": "flow:sticky_note",
      "typeVersion": "1.0",
      "name": "Sticky Note",
      "parameters": {
        "content": "This workflow locks posts by users who are members of the \"monitor\" group.\n\nThis is done to prevent edit spam.\n\n---\n\nSPDX-License-Identifier: [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/)",
        "width": 397.7501248410323,
        "height": 104.4643227312019,
        "color": "blue"
      },
      "credentials": {},
      "webhookId": null,
      "position": {
        "x": 340.6875154677751,
        "y": 194.7525780393979
      }
    }
  ],
  "connections": {
    "User": {
      "main": [
        [
          {
            "node": "Non-staff?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DEBUG": {
      "main": [
        [
          {
            "node": "Trigger data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group": {
      "main": [
        [
          {
            "node": "Member?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Member?": {
      "main": [
        [
          {
            "node": "User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Non-staff?": {
      "main": [
        [
          {
            "node": "Lock post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post created": {
      "main": [
        [
          {
            "node": "Trigger data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger data": {
      "main": [
        [
          {
            "node": "Group",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {},
  "variables": [],
  "staticData": {
    "node:Schedule": {
      "recurrenceRules": []
    }
  }
}