Repository navigation
Description
Overview
Goal: limit how long a Huddle post can be edited, using an organization setting (default 7 days). Every post should clearly show when it was written, which day it counts for, and when and by whom it was last edited.
Why: Huddle posts are plans, wrap-ups and status updates that teams and managers rely on as a record of work. If a post can be quietly rewritten weeks later, nobody can trust it. Anyone reading a post should be able to tell whether it changed, when, and who changed it.
**Prototypes **
- 🖱️ Clickable prototype on the Huddle and Settings → Organization pages, with a switch to view as the author, another member, a team admin or an org admin: https://claude.ai/artifact/9dkzsUPnrPBXKvwVsGNZe5
- 📄 Proposal page with mockups, rules and a simulator for the edit limit: https://claude.ai/artifact/PT9KdKNpdH3KfasY9CdvMQ
Problem Statement
- No edit limit. A post can be edited at any time, even months later.
- "Edited" is often wrong. The feed treats a post as edited whenever
updatedAtdiffers fromcreatedAt. ButupdatedAtalso changes when someone likes a post, comments on it, deletes a comment, or adds a wrap-up line. So posts nobody edited show "(edited)", and the edit time shown is really the time of the last like or comment. - Not enough edit information. The "(edited)" tag has no date, and only a time in a hover tooltip, which doesn't work on phones. It never says who made the edit, even though team admins and org owners can edit other people's posts.
- Edits go unnoticed. An edited post stays in its old Day or Session conversation. Nobody is told it changed. An @mention added in an edit notifies nobody.
- Edit permissions don't match the intended roles. Today the author, team admins and org owners can edit. Org admins can't.
Current State
-
huddle.updatePost(meteor-backend/server/huddle.js) checks onlycanModifyPost(author, team admin or org owner). There is no time check, and it sends no notifications. -
Each post stores these times:
Field What it is Notes createdAtOriginal date and time: when the post was written Server time, an exact moment. Each viewer sees it in their own time zone. Never changes. deliverAt/deliveredAtWhen a scheduled post is due, and when it actually went out Scheduled posts only postDateEffective date: the day the post counts for, e.g. "2026-10-28"A calendar date with no time, so it is the same day for every viewer. The app always sets it to the day of posting (or the delivery day for scheduled posts). wrapUpAtWhen the wrap-up line was added to a session's plan post clockEventIdThe clock session the post belongs to Gives the shift's clock-in and clock-out times updatedAtLast write of any kind Changed by likes, comments and wrap-ups too, so it can't mean "edited" -
The feed (
src/features/huddle/superChatFeed.ts) works out "edited" aspost.updatedAt !== post.createdAt. -
SuperChat in
@mieweb/uishows an "(edited)" tag with a time-only tooltip. It can only turn editing on or off for the whole chat, not for one message. -
Org settings already have a cascade (enterprise → org → team, with locks) in
meteor-backend/server/settings/registry.js, shown byDefaultsCardin Settings → Organization. Every setting so far is an on/off switch. -
Notifications (Add Notification Preferences for Desktop and Phone, Starting With Huddle #784) already have a per-team All posts / Mentions & replies / Mute choice. All posts sends "X posted in Team" for new posts (
notifyTeamFollowersinhuddle-delivery.js).
Proposed Changes
1. Three times on every post
Editing never changes the original time. Each time has one job:
| Time | Meaning | Stored as | Shown |
|---|---|---|---|
| Posted | When it was written, and by whom | createdAt (or deliveredAt) + userId, as today |
Next to the post, always |
| Effective | The day it counts for | postDate, as today. No effective time is stored, because a plan or wrap-up gets its shift times from its clock session (clockEventId) |
"for Wed, Oct 28", only when it's a different day from the posted date |
| Edited | When it was last changed, and by whom | New editedAt + editedBy |
Next to the post, whenever it was edited |
On the post:
Priya Shah 9:02 AM ← not edited
Priya Shah 9:02 AM · edited Thu, Oct 29, 4:15 PM ← edited by the author
Priya Shah 9:02 AM · edited Thu, Oct 29, 4:15 PM by Sam Lee ← edited by someone else
Clicking the time (or choosing Post details in the ⋯ menu) shows everything at once:
Posted Thu, Oct 29, 9:02 AM by Priya Shah
Counts for Wed, Oct 28 ← only when it differs
Edited Thu, Oct 29, 4:15 PM by Sam Lee
Editable Until Thu, Nov 5, 9:02 AM
An edit never moves a post. It stays in the same Day, Session, Person and Ticket conversation, in the same place in the thread, because grouping uses postDate and clockEventId, and ordering uses the original time.
2. Org setting: "Editing posts allowed for"
- New row in Settings → Organization → Team defaults: a dropdown with Not allowed · 1 hour · 24 hours · 3 days · 7 days (default) · 30 days · No limit.
- Enterprises and orgs can set it (
levels: ['enterprise', 'org'], likeallowAutoJoin). Teams can't change it. - Personal teams follow the org rule (no exemption).
3. Edit rules
- Who can edit: the author, team admins, and org admins (org owners count as org admins). Nobody else, including enterprise admins and other members.
- The limit applies to everyone, including admins. There is no admin override.
- The window starts when the post goes out:
deliveredAt ?? createdAt. A scheduled post that hasn't been sent yet can always be edited. - Changing the setting takes effect immediately. The limit is worked out when a post is read or saved, so going from 7 days to 24 hours locks older posts at once, and going back unlocks them. No data migration.
- The server enforces it.
huddle.updatePostrefuses a late edit. The app greys out Edit message and shows the reason (e.g. "Editing closed Tue, Oct 27, 9:10 AM").
flowchart TD
EditRequest["huddle.updatePost"] --> CanModify{"Author, team admin,<br/>or org admin/owner?"}
CanModify -- no --> Forbidden["forbidden: cannot modify"]
CanModify -- yes --> Scheduled{"Scheduled and<br/>not sent yet?"}
Scheduled -- yes --> Save["Save text<br/>set editedAt + editedBy"]
Scheduled -- no --> Window{"now < wentOut + org window?"}
Window -- yes --> Save
Window -- no --> Closed["forbidden: edit window closed"]
Save --> Notify["notifyPostEdited()"]
classDef ok fill:#dcfce7,stroke:#15803d,color:#14532d
classDef stop fill:#fef3c7,stroke:#b45309,color:#78350f
class Save,Notify ok
class Forbidden,Closed stop
4. Notifications for edited posts
| Who | Notification |
|---|---|
| The author, when someone else edits their post | "Sam Lee edited your post from Mon, Oct 26". Always sent, even if the author chose Mentions & replies or Mute. |
| Teammates who chose All posts for the team | "Priya edited her post from Mon, Oct 26". Skipped for the author's own edits within 5 minutes of posting (typo fixes). |
| Anyone newly @mentioned by the edit | The normal mention notification |
| Everyone else | Nothing |
The notification opens the post where it lives, so an edit to an old post can't go unnoticed.
5. How to implement (brief)
Backend (meteor-backend/server/)
huddle.js/huddle.updatePost: seteditedAtandeditedBy(content edits only), check the edit window, and callnotifyPostEdited().huddle.js/canModifyPost: allow orgadminas well asowner.huddle.js/ post enrichment: returneditedAt, the editor's name, andeditableUntil, all worked out at read time.editableUntilis not stored.settings/registry.js: addpostEditWindow(default'7d', levels enterprise + org). Insettings/write.js, add a value type that allows only a fixed list of choices, next toboolean.notification-prefs-core.js: add ahuddlePostEditedevent (desktop on, phone off). The Mentions & replies and Mute levels drop it, as they drophuddlePost. AddnotifyPostEdited()tohuddle-delivery.js.
Frontend (src/)
features/huddle/superChatFeed.ts: useeditedAtinstead ofupdatedAt !== createdAt. Pass each message's edit permission (and the reason when it's locked), the edited label, the "for " label and the post details.features/settings/DefaultsCard.tsx: support a dropdown row, usingSelectfrom@mieweb/ui.features/org/OrganizationSettings.tsx: add the "Editing posts allowed for" row.- Notification settings: a row for "Edited posts".
- Release note in
release-notes/.
@mieweb/ui (upstream PR via vendor/ui)
- Turn editing off for a single message, keeping "Edit message" visible but greyed out with the reason.
- Show the edit's date, time and editor inline next to the message time.
- A host-supplied details panel on the time label, and an inline label slot for "for Wed, Oct 28". Add these to
docs/superchat-inbox-gaps.md.
Suggested PR order: (1) editedAt/editedBy and fix the false "edited" (shippable alone) → (2) @mieweb/ui changes → (3) the setting + server enforcement + org admin permission → (4) Huddle wiring + release note → (5) edit notifications, after the in-progress #784 notification work lands.
Acceptance Criteria
Stored times
- A content edit sets
editedAtandeditedBy. Likes, comments, comment deletes, wrap-up appends and session linking don't. -
createdAtandpostDatenever change when a post is edited. - Posts with no
editedAt(including older posts) show no edited label.
Display
- An edited post shows "· edited <weekday, month day, time>" next to its time, and "by " when the editor isn't the author.
- A post whose
postDatediffers from its posted day shows "for <weekday, month day>". - Clicking the time (or ⋯ → Post details) shows Posted, Counts for (when different), Edited, and Editable until / closed. This works on phones.
- Editing a post doesn't move it to another Day, Session, Person or Ticket conversation, or to another place in the thread.
Setting
- Settings → Organization → Team defaults has "Editing posts allowed for" with the seven choices, defaulting to 7 days.
- Enterprise and org can set it. Teams can't. "Reset to inherited" works.
- The server refuses any other value.
Rules
- The author, team admins, org admins and org owners can edit inside the window. Other members and enterprise admins can't.
- After the window closes,
huddle.updatePostreturnsforbiddenfor everyone, including admins. - A scheduled post that hasn't been sent can always be edited. Its window starts when it is delivered.
- "Not allowed" blocks every edit after a post goes out. "No limit" allows edits at any time.
- Changing the setting changes which existing posts can be edited without a data migration.
- "Edit message" is greyed out with the reason when the window has closed.
Notifications
- The author gets a notification when someone else edits their post, regardless of their team notification choice.
- Teammates on All posts get an "edited" notification. None is sent for the author's own edits within 5 minutes of posting.
- People newly @mentioned by an edit get a mention notification.
- Tapping the notification opens the post in its original conversation.
- "Edited posts" has Desktop/Phone switches in Settings → Notifications (desktop on, phone off by default).
Quality
- Unit tests for the window check, permissions, the new setting value type and the notification routing.
- Release note added.
-
npm run lint && npm run typecheck,npm run formatand the test suites pass.
Open Questions
- Quick-fix grace period: is 5 minutes the right cutoff for not notifying All-posts teammates about the author's own edits? Should it be configurable?
- Author alert when muted: we propose always telling the author when someone else edits their post, even if they muted the team. Confirm.
Out of Scope (for Now)
- A limit on deleting posts. Deleting stays as it is today. A matching setting can follow later.
- Edit history. Only the most recent edit (when and by whom) is kept.
- An admin override to edit after the window closes.
- Comments. The limit covers posts only.
- Posting for an earlier day (choosing
postDatewhen posting). Posts belong to the day they are written. This would be a separate feature. - Per-team edit limits. Teams inherit the org (or enterprise) value.
Activity
docs: posted plan is the source of truth; edits follow #797 (#880)
docs: check off M4 in the MVP plan, with a 1.2.0 release note (#886)