Plugin Interaction
Custom status should be accessible via a plugin API
If we have certain “Emojis” for statuses (ie: Phone booth for in a meeting) those should be accessible via API as well
There should be a Hookable event for whenever a user’s status is changed that a plugin can watch for
[AR] Consideration: Have a plugin hook for “StatusWillBeSet” so that plugins could be used as a “control plane” in certain organizations that want to restrict statuses (for example to a specific list, or restricting certain words from being used in a status) for users. This may help us avoid building functionality into the core product.
[AR] Is there a way for plugins to set a status to “override for 27 minutes, then go back to whatever the user’s settings were before we hijacked it”? That would probably make it easier for plugins to implement Custom Statuses without having a horrible UX for the end-user. Also, is there a way we could tell a plugin if the current status was set by a User, or another Plugin to help deal with “plugins fighting with each other over statuses”
Future Consideration: The User Profile Popover on mobile does NOT support plugins inserting text into the UI currently. It would be nice if we could update that area of the mobile app to support plugins modifying fields on the popover while we’re adding the custom status text. Probably “out of scope” initially, (example use case: Custom Attributes Plugin would start working on mobile).
[MK] In order for a plugin or app to know if itself changed the last status, we can have an `Author` string field that is set to the plugin id or "user". We may want to know which entity cleared the status too.
[MK] It also may be useful to have a mnemonic "id" of the change. Then the app can use that to identify why the custom status was set to its current state.
[MK] Using an expiry allows the app to potentially not have to run its own scheduled job for syncing the status.
[MK] We need to store the user’s original custom status somewhere, so when a plugin/app “resets” the status, we are actually setting it back to the user’s choice. Any changes should be within `user.props`, as that is where the custom status is currently being stored. We can store the “saved user” custom status in a different prop.
[MK] Plugin API changes:
GetUserCustomStatus
UpdateUserCustomStatus - app should ideally not be able to set “author”. It should be set automatically
ResetUserCustomStatus - should automatically set the status back to the last status the /user/ had set
UserCustomStatusHasBeenUpdated hook
At the time of writing, the CustomStatus struct currently looks like this:
type CustomStatus struct {
Emoji string `json:"emoji"`
Text string `json:"text"`
}
Proposed structure for use by plugins/apps:
CustomStatus{
Emoji: ":calendar:",
Text: "In a meeting",
Author: "com.mattermost.gcal",
Id: "automated-meeting-(MEETING_ID)",
UpdateAt: "10:00AM...",
Expiry: "12:00PM...",
SnoozeNotifications: true,
}