* Add test notification tool

* Add frontend styles

* Remove option from admin view

* Refactor create post and add translations

* Fix several CI errors

* Fix API and frontend snapshots

* Refactor trailing and leading icon on buttons

* Add different button states

* i18n-extract

* Fix wrong text

* Add tests

* Fix wrong string

* Fix test

* feat: E2E send test notifications (#28371)

* Refactor send desktop notification

* Address rest of the feedback

* Fix tests

* Add correct link

* Fix test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: yasserfaraazkhan <attitude3cena.yf@gmail.com>
Этот коммит содержится в:
Daniel Espino García
2024-11-08 13:57:06 +01:00
коммит произвёл GitHub
родитель 30a6ddc995
Коммит 118d0346ee
31 изменённых файлов: 1170 добавлений и 56 удалений

Просмотреть файл

@@ -344,6 +344,10 @@ func (c *Client4) testEmailRoute() string {
return "/email/test"
}
func (c *Client4) testNotificationRoute() string {
return "/notifications/test"
}
func (c *Client4) usageRoute() string {
return "/usage"
}
@@ -4820,6 +4824,15 @@ func (c *Client4) TestEmail(ctx context.Context, config *Config) (*Response, err
return BuildResponse(r), nil
}
func (c *Client4) TestNotifications(ctx context.Context) (*Response, error) {
r, err := c.DoAPIPost(ctx, c.testNotificationRoute(), "")
if err != nil {
return BuildResponse(r), err
}
defer closeBody(r)
return BuildResponse(r), nil
}
// TestSiteURL will test the validity of a site URL.
func (c *Client4) TestSiteURL(ctx context.Context, siteURL string) (*Response, error) {
requestBody := make(map[string]string)

Просмотреть файл

@@ -75,6 +75,7 @@ const (
PostPropsMentionHighlightDisabled = "mentionHighlightDisabled"
PostPropsGroupHighlightDisabled = "disable_group_highlight"
PostPropsPreviewedPost = "previewed_post"
PostPropsForceNotification = "force_notification"
PostPriorityUrgent = "urgent"
PostPropsRequestedAck = "requested_ack"
@@ -339,8 +340,9 @@ func (o *Post) EncodeJSON(w io.Writer) error {
}
type CreatePostFlags struct {
TriggerWebhooks bool
SetOnline bool
TriggerWebhooks bool
SetOnline bool
ForceNotification bool
}
type GetPostsSinceOptions struct {
@@ -500,6 +502,7 @@ func (o *Post) SanitizeProps() {
}
membersToSanitize := []string{
PropsAddChannelMember,
PostPropsForceNotification,
}
for _, member := range membersToSanitize {

Просмотреть файл

@@ -115,29 +115,34 @@ func TestPostSanitizeProps(t *testing.T) {
post1.SanitizeProps()
require.Nil(t, post1.GetProp(PropsAddChannelMember))
require.Nil(t, post1.GetProp(PostPropsForceNotification))
post2 := &Post{
Message: "test",
Props: StringInterface{
PropsAddChannelMember: "test",
PropsAddChannelMember: "test",
PostPropsForceNotification: "test",
},
}
post2.SanitizeProps()
require.Nil(t, post2.GetProp(PropsAddChannelMember))
require.Nil(t, post2.GetProp(PostPropsForceNotification))
post3 := &Post{
Message: "test",
Props: StringInterface{
PropsAddChannelMember: "no good",
"attachments": "good",
PropsAddChannelMember: "no good",
PostPropsForceNotification: "no good",
"attachments": "good",
},
}
post3.SanitizeProps()
require.Nil(t, post3.GetProp(PropsAddChannelMember))
require.Nil(t, post3.GetProp(PostPropsForceNotification))
require.NotNil(t, post3.GetProp("attachments"))
}