# app.studynext.comment

> A comment posted inside a study room. Stored on the commenter's PDS.

- Kind: record
- Record key: tid
- Authority: studynext.app
- Lexicon: 1
- Published by [studynext.app](https://lexicon.garden/identity/did:plc:nstib2qjcu3tyun7cxz4dxcm), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:nstib2qjcu3tyun7cxz4dxcm/app.studynext.comment)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:nstib2qjcu3tyun7cxz4dxcm/app.studynext.comment/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:nstib2qjcu3tyun7cxz4dxcm/app.studynext.comment/analytics)

## Record (`app.studynext.comment`)

Type: record · key tid

### Properties

- `createdAt` (string · datetime, required)
- `edited` (boolean): True once the sender has edited this comment's text after posting (see editComment in comments.ts). Absent/false means never edited. Editing only ever rewrites `text` in place (same rkey, via putRecord) — createdAt does not change, and media/mentions are dropped on edit rather than carried over, since a text edit's offsets could no longer match them.
- `media` (array): 1-4 images, OR exactly 1 of video/audio/file (client-enforced — a video/audio/file can't be combined with other attachments, images can't be combined with a video/audio/file).
  - Constraints: maxLength: 4
  - `items` (ref)
    - Reference: `#commentMediaItem`
- `mentions` (array)
  - Constraints: maxLength: 10
  - `items` (ref)
    - Reference: `#mention`
- `replyTo` (string · at-uri): AT-URI of another app.studynext.comment in the same room this replies to.
- `room` (string · at-uri, required): AT-URI of the containing study room, such as an app.studynext.socialPost or app.studynext.studyTeam record; legacy status/self room URIs may also exist
- `text` (string, required): May be empty only when `media` is present.
  - Constraints: minLength: 0, maxLength: 2000

## #aspectRatio (`app.studynext.comment#aspectRatio`)

Type: object

### Properties

- `height` (integer, required)
  - Constraints: minimum: 1
- `width` (integer, required)
  - Constraints: minimum: 1

## #commentMediaItem (`app.studynext.comment#commentMediaItem`)

Type: object

A tagged union by `type` — exactly one of `image`/`video` is present depending on its value. Not expressed as a formal lexicon union since this is documentation only (all comment writes use validate:false).

### Properties

- `alt` (string)
  - Constraints: maxLength: 300
- `aspectRatio` (ref)
  - Reference: `#aspectRatio`
- `audio` (blob): Present iff type=audio. Uploaded as picked (no client-side re-encoding, unlike image/video) — the client restricts the picker to wav/ogg/opus/mp3 (plus a couple of common OS-recorder container formats) so every accepted source is already something both major mobile platforms and browsers can decode without transcoding.
  - Constraints: maxSize: 100000000, accept: audio/mpeg, audio/wav, audio/x-wav, audio/wave, audio/ogg, audio/opus, audio/webm, audio/mp4, audio/x-m4a
- `durationMs` (integer): video/audio only
  - Constraints: minimum: 0
- `file` (blob): Present iff type=file. A generic attachment (documents, text/markdown notes, archives, ...) with no fixed mime type — unlike image/video/audio's narrow accept lists, this is intentionally unrestricted since the client can't re-encode or otherwise normalize arbitrary file content. `mimeType`/`filename` (siblings on this same commentMediaItem) tell a viewer whether to attempt a text/markdown preview or fall back to a plain download link.
  - Constraints: maxSize: 100000000, accept: */*
- `filename` (string): file (and optionally audio) only — original filename as picked by the sender.
  - Constraints: maxLength: 255
- `image` (blob): Present iff type=image. Always the *output* format — the client accepts any source format the OS photo picker offers (including HEIC/HEIF) but always re-encodes to JPEG via ImageManipulator before upload (see comments.ts), so a HEIC-shooting iPhone never uploads a HEIC blob and every viewer's device only ever needs JPEG decode support. maxSize is the common 100MB attachment limit; the client normally resizes/compresses images to a few hundred KB.
  - Constraints: maxSize: 100000000, accept: image/jpeg, image/png, image/webp
- `mimeType` (string): file only — the blob's own mime type, since type=file has no fixed accept list to infer it from.
  - Constraints: maxLength: 255
- `size` (integer): file only — byte size, used by viewers to decide whether to preview or just link out.
  - Constraints: minimum: 0
- `type` (string, required)
  - Constraints: enum: image | video | audio | file
- `video` (blob): Present iff type=video. Always the *output* format after client-side compression (react-native-compressor) — the client accepts any source codec the OS lets it read (H.264, HEVC/H.265, VP9, AV1, ...) and re-encodes on-device before upload, so every viewer's device only ever needs to decode whatever the compressor's own output codec is (typically H.264/mp4), never the sender's original codec. No server-side transcoding (unlike app.bsky.embed.video's separate video service). Source VP9/AV1 decode is not supported by iOS's AVFoundation at all — on iOS, compressing (and therefore sending) such a source file fails with a clear client-side error rather than silently uploading something viewers can't play; Android's MediaCodec has much broader VP9/AV1 decode support. maxSize is the common 100MB attachment limit.
  - Constraints: maxSize: 100000000, accept: video/mp4, video/quicktime, video/webm

## #mention (`app.studynext.comment#mention`)

Type: object

A did mentioned within `text`, by UTF-16 code unit offset — mirrors how the app renders/taps the mention, not a general-purpose richtext facet.

### Properties

- `did` (string · did, required)
- `end` (integer, required)
  - Constraints: minimum: 0
- `start` (integer, required)
  - Constraints: minimum: 0

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "aspectRatio": {
      "properties": {
        "height": {
          "minimum": 1,
          "type": "integer"
        },
        "width": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "width",
        "height"
      ],
      "type": "object"
    },
    "commentMediaItem": {
      "description": "A tagged union by `type` — exactly one of `image`/`video` is present depending on its value. Not expressed as a formal lexicon union since this is documentation only (all comment writes use validate:false).",
      "properties": {
        "alt": {
          "maxLength": 300,
          "type": "string"
        },
        "aspectRatio": {
          "ref": "#aspectRatio",
          "type": "ref"
        },
        "audio": {
          "accept": [
            "audio/mpeg",
            "audio/wav",
            "audio/x-wav",
            "audio/wave",
            "audio/ogg",
            "audio/opus",
            "audio/webm",
            "audio/mp4",
            "audio/x-m4a"
          ],
          "description": "Present iff type=audio. Uploaded as picked (no client-side re-encoding, unlike image/video) — the client restricts the picker to wav/ogg/opus/mp3 (plus a couple of common OS-recorder container formats) so every accepted source is already something both major mobile platforms and browsers can decode without transcoding.",
          "maxSize": 100000000,
          "type": "blob"
        },
        "durationMs": {
          "description": "video/audio only",
          "minimum": 0,
          "type": "integer"
        },
        "file": {
          "accept": [
            "*/*"
          ],
          "description": "Present iff type=file. A generic attachment (documents, text/markdown notes, archives, ...) with no fixed mime type — unlike image/video/audio's narrow accept lists, this is intentionally unrestricted since the client can't re-encode or otherwise normalize arbitrary file content. `mimeType`/`filename` (siblings on this same commentMediaItem) tell a viewer whether to attempt a text/markdown preview or fall back to a plain download link.",
          "maxSize": 100000000,
          "type": "blob"
        },
        "filename": {
          "description": "file (and optionally audio) only — original filename as picked by the sender.",
          "maxLength": 255,
          "type": "string"
        },
        "image": {
          "accept": [
            "image/jpeg",
            "image/png",
            "image/webp"
          ],
          "description": "Present iff type=image. Always the *output* format — the client accepts any source format the OS photo picker offers (including HEIC/HEIF) but always re-encodes to JPEG via ImageManipulator before upload (see comments.ts), so a HEIC-shooting iPhone never uploads a HEIC blob and every viewer's device only ever needs JPEG decode support. maxSize is the common 100MB attachment limit; the client normally resizes/compresses images to a few hundred KB.",
          "maxSize": 100000000,
          "type": "blob"
        },
        "mimeType": {
          "description": "file only — the blob's own mime type, since type=file has no fixed accept list to infer it from.",
          "maxLength": 255,
          "type": "string"
        },
        "size": {
          "description": "file only — byte size, used by viewers to decide whether to preview or just link out.",
          "minimum": 0,
          "type": "integer"
        },
        "type": {
          "enum": [
            "image",
            "video",
            "audio",
            "file"
          ],
          "type": "string"
        },
        "video": {
          "accept": [
            "video/mp4",
            "video/quicktime",
            "video/webm"
          ],
          "description": "Present iff type=video. Always the *output* format after client-side compression (react-native-compressor) — the client accepts any source codec the OS lets it read (H.264, HEVC/H.265, VP9, AV1, ...) and re-encodes on-device before upload, so every viewer's device only ever needs to decode whatever the compressor's own output codec is (typically H.264/mp4), never the sender's original codec. No server-side transcoding (unlike app.bsky.embed.video's separate video service). Source VP9/AV1 decode is not supported by iOS's AVFoundation at all — on iOS, compressing (and therefore sending) such a source file fails with a clear client-side error rather than silently uploading something viewers can't play; Android's MediaCodec has much broader VP9/AV1 decode support. maxSize is the common 100MB attachment limit.",
          "maxSize": 100000000,
          "type": "blob"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "main": {
      "description": "A comment posted inside a study room. Stored on the commenter's PDS.",
      "key": "tid",
      "record": {
        "properties": {
          "createdAt": {
            "format": "datetime",
            "type": "string"
          },
          "edited": {
            "description": "True once the sender has edited this comment's text after posting (see editComment in comments.ts). Absent/false means never edited. Editing only ever rewrites `text` in place (same rkey, via putRecord) — createdAt does not change, and media/mentions are dropped on edit rather than carried over, since a text edit's offsets could no longer match them.",
            "type": "boolean"
          },
          "media": {
            "description": "1-4 images, OR exactly 1 of video/audio/file (client-enforced — a video/audio/file can't be combined with other attachments, images can't be combined with a video/audio/file).",
            "items": {
              "ref": "#commentMediaItem",
              "type": "ref"
            },
            "maxLength": 4,
            "type": "array"
          },
          "mentions": {
            "items": {
              "ref": "#mention",
              "type": "ref"
            },
            "maxLength": 10,
            "type": "array"
          },
          "replyTo": {
            "description": "AT-URI of another app.studynext.comment in the same room this replies to.",
            "format": "at-uri",
            "type": "string"
          },
          "room": {
            "description": "AT-URI of the containing study room, such as an app.studynext.socialPost or app.studynext.studyTeam record; legacy status/self room URIs may also exist",
            "format": "at-uri",
            "type": "string"
          },
          "text": {
            "description": "May be empty only when `media` is present.",
            "maxLength": 2000,
            "minLength": 0,
            "type": "string"
          }
        },
        "required": [
          "room",
          "text",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    },
    "mention": {
      "description": "A did mentioned within `text`, by UTF-16 code unit offset — mirrors how the app renders/taps the mention, not a general-purpose richtext facet.",
      "properties": {
        "did": {
          "format": "did",
          "type": "string"
        },
        "end": {
          "minimum": 0,
          "type": "integer"
        },
        "start": {
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "did",
        "start",
        "end"
      ],
      "type": "object"
    }
  },
  "id": "app.studynext.comment",
  "lexicon": 1
}
```
