mirror of
https://github.com/mattermost/mattermost.git
synced 2026-11-28 15:38:27 +08:00
* Add a read-time entities framework so plugins can mark tokens without rewriting the post.
Matchers, cards, and dictionaries run when a post is read. The stored message stays the author's text, which is what makes the same token usable on mobile and from more than one plugin.
* Keep entity cards inside posts the caller can read.
A card tied to a post now uses the post-read permission and the value on that post, and a failed dictionary write or a removed plugin no longer leaves the in-memory registry ahead of Postgres.
* Compute entity spans on read instead of storing them.
The postentities and entityterms tables cached a regex result the server can recompute. Pattern spans now live in the process memo and the platform cache, so a warm page does not query Postgres and Redis shares the spans when it is configured.
* Fix entity rendering and teardown from the review notes.
Related cards no longer bind to the parent post, entity highlights skip rewritten messages, and plugin cleanup runs after OnDeactivate so a late registration cannot stick.
* Render entity card bodies with Mattermost Blocks and ship mm.time.
Card chrome stays outside the block tree; interactive blocks are stripped on
normalize. Core mm.time gives a working underline and Blocks card without a
plugin, and card lookup prefers the type the client selected when a span has
several.
* Add a screenshot of the mm.time Blocks entity card.
* Remove the mm.time entity card screenshot for now.
* Expand mm.time formats and show profile-local time on hover.
Recognize clock-with-zone tokens such as 16:30 CET and 4.30pm CET, keep the
Blocks body to UTC plus the written token, and format Instant in the reader's
profile timezone for hover and the RHS heading.
* Address CodeRabbit findings for entities parse-on-read.
Skip accept-all memo writes, bound cache/provider/validate work, keep finished pattern hits, and refresh etags, cards, and RHS handling for the open review notes.
* Fix CI for entities: lint, automation models, and API tests.
Add the missing automation model types the plugin API already declares, regenerate plugintest/feature-flag artifacts, clear webapp lint, and cover the entity card/posts endpoints.
* Fix entities TypeScript errors blocking check-types.
Register the dictionary websocket event in the client union and tighten entity mention, card, and RHS types so CI typecheck passes.
* Flatten nested ternaries in entity RHS components.
* Fix post attributes composer button after IconContainer removal.
The attributes PR still imported the old styled IconContainer; switch it to IconButton so check-types can pass on current master.
* Add tests for automation values and entity card UI.
Cover AutomationValue.Validate and the entity label/card render paths called out by the PR test analysis check.
* Fix entities CI: OpenAPI, style, API tests, and attributes button.
Document the entities routes for vet-api, satisfy govet/golangci on the
entities packages, drop Parallel+Setenv from entity API tests, and keep the
composer attributes control focusable via IconButton asChild.
* Update support packet golden for Entities feature flag.
* Address CodeRabbit entities findings worth fixing.
Harden the GetPost ETag assertion, skip invalid mm.time and non-participating
value groups, publish dictionary changes on matcher/provider removal, avoid
stale RHS/card/cache races, restore entity reopen, and ignore deleted posts.
* Fix webapp check-types failures from entity RHS/test changes.
* Fix entity card cache staleness and clear entities on delete.
* Ignore in-flight entity card cache writes after a dictionary clear.
* Simplify entities: platform pattern cache only, drop dictionary WS.
Remove process memos and stale-generation background refresh from the
hydrate path, and drop entities_dictionary_changed plus the batch posts
API so HA dictionary updates no longer stampede clients.
* Address Joram review: drop EntityValidate, automation, and localize entity UI.
Restore early getPost etags by removing post-match validate, delete unused
automation stubs, bump EntityLookup to 12.2, stop hardcoding custom_tf_*,
localize card/RHS/mention strings, and drop in-repo specs from the PR.
* Remove unrelated leftovers from the entities PR.
Drop the reintroduced SlackAttachment aliases, unused ProviderFor, and
speculative core labels that are not shipped in this change.
* Gate entities on FeatureFlags.Entities / MM_FEATUREFLAGS_ENTITIES.
Drop the ad-hoc MM_ENTITIES env bypass so enabling matches other feature
flags, and wire unit/API tests through the standard config path.
* Fix gofmt on entities bench helper methods.
* Identify entities by owner and name with an owner:name wire id.
Entities belong to an owner, not a plugin. The registry used to record
a plugin id on every type, matcher, provider and term, and stored it
twice on matchers: storedMatcher.owner, which every ownership check
read, and matcher.pluginID, which nothing read. Now each entry records
an opaque owner, and a plugin's owner is just its plugin id. The
storedMatcher wrapper and the unread field fold into the matcher's
Ref, RemovePlugin becomes RemoveOwner, and Remote carries the provider
Ref instead of a PluginID and ProviderID, so the app finds the plugin
hooks from the provider's owner.
Types, matchers and providers are identified by a Ref{Owner, Name}
(entities/ref.go), with the wire form "owner:name". Owners cannot
contain the colon, so a wire id always splits back into the same
owner and name. Because the owner is part of the id, two owners can
never claim the same id, which removes the "owned by someone else"
checks and the rule that ids start with the plugin id.
Built-in types belong to the owner "mm", so core time is "mm:time"
(previously "mm.time", owned by "core"). ensureCore registers it
through AddType and AddMatcher like any other owner, and panics if
that fails. Plugin ids are at least three characters, so no plugin
can claim the owner "mm".
Plugins register local names: EntityType, EntityMatcher and
EntityProvider take Name, Type and Types instead of ID, TypeID and
TypeIDs. A bare name means one of the plugin's own entries and
"owner:name" means anyone else's, such as "mm:time". Other owners
may attach matchers and providers only to built-in types.
UnregisterEntityMatcher and RegisterEntityTerms take names, and
EntityLookupRequest gives Provider and Type back the way the plugin
wrote them. Related links on a card returned by a provider may use bare
names, and the server qualifies them to wire ids.
The API docs and the webapp's localized labels switch to "mm:time".
* Release plugin commands and entities when the plugin API is closed.
* Keep provider cards behind a readable post and date clocks from that post.
A message full of mentions is scanned in one pass, and tests lock the post date for both card routes and for timestamps that already carry a day.
* Refuse glossary cards on a lookup that has no post.
A related term renders the link it already carries, and the same term on a post the caller can read still returns its title and URL.
* Return entity card errors as error so vet accepts them.
A bare string check and the card test import order were failing the same way.
* Let a plugin authorize an entity card that has no post.
EntityLookup always receives the caller. A lookup without a post is asked only when a matcher accepts the value, is not cached, and is refused the same way as a glossary term.
* Refuse a card lookup that only a scoped matcher covers.
A lookup with no post has no channel to apply Scope, and the plugin is not told the team. The same 403 as an unknown value keeps that from showing a scoped matcher exists. mm:time still answers from the built-in clock when the plugin returns nothing.
---------
Co-authored-by: Jesse Hallam <jesse@mattermost.com>
102 lines
3.9 KiB
Makefile
102 lines
3.9 KiB
Makefile
ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
.PHONY: build build-v4 clean playbooks
|
|
|
|
V4_YAML = $(ROOT)/v4/html/static/mattermost-openapi-v4.yaml
|
|
|
|
V4_SRC = $(ROOT)/v4/source
|
|
PLAYBOOKS_SRC = $(ROOT)/playbooks
|
|
|
|
build: build-v4
|
|
|
|
build-v4: node_modules playbooks
|
|
@echo Building mattermost openapi yaml for v4
|
|
|
|
@if [ -r $(PLAYBOOKS_SRC)/merged-tags.yaml ]; then cat $(PLAYBOOKS_SRC)/merged-tags.yaml > $(V4_YAML); else cat $(V4_SRC)/introduction.yaml > $(V4_YAML); fi
|
|
@cat $(V4_SRC)/users.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/status.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/teams.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/channels.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/posts.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/preferences.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/files.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/recaps.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/uploads.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/jobs.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/system.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/emoji.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/webhooks.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/saml.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/compliance.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/ldap.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/groups.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/cluster.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/brand.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/commands.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/oauth.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/elasticsearch.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/dataretention.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/plugins.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/roles.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/schemes.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/service_terms.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/remoteclusters.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/sharedchannels.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/reactions.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/actions.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/bots.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/cloud.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/permissions.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/imports.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/exports.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/ip_filters.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/bookmarks.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/boards.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/views.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/reports.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/limits.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/logs.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/outgoing_oauth_connections.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/metrics.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/scheduled_post.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/custom_profile_attributes.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/audit_logging.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/ephemeral_mode.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/access_control.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/content_flagging.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/delivery_tracking.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/health.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/agents.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/scheduled_recaps.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/properties.yaml >> $(V4_YAML)
|
|
@cat $(V4_SRC)/entities.yaml >> $(V4_YAML)
|
|
@if [ -r $(PLAYBOOKS_SRC)/paths.yaml ]; then cat $(PLAYBOOKS_SRC)/paths.yaml >> $(V4_YAML); fi
|
|
@if [ -r $(PLAYBOOKS_SRC)/merged-definitions.yaml ]; then cat $(PLAYBOOKS_SRC)/merged-definitions.yaml >> $(V4_YAML); else cat $(V4_SRC)/definitions.yaml >> $(V4_YAML); fi
|
|
@echo Extracting code samples
|
|
cd server && go run . $(V4_YAML)
|
|
|
|
@node_modules/.bin/swagger-cli validate $(V4_YAML)
|
|
@cp ./v4/html/ssr_template.hbs ./v4/html/index.html
|
|
@echo Complete
|
|
|
|
node_modules: package.json $(wildcard package-lock.json)
|
|
@echo Getting dependencies using npm
|
|
|
|
npm install
|
|
touch $@
|
|
|
|
run:
|
|
@echo Starting local server
|
|
python3 -m http.server 8080 --directory ./v4/html
|
|
|
|
clean:
|
|
@echo Cleaning
|
|
|
|
rm -rf node_modules
|
|
|
|
playbooks:
|
|
@echo Fetching Playbooks OpenAPI spec
|
|
cd playbooks && node extract.js
|
|
cd playbooks && node merge-definitions.js $(V4_SRC)/definitions.yaml
|
|
cd playbooks && node merge-tags.js $(V4_SRC)/introduction.yaml
|