MM-48614: saves priority for drafts (#21752)
* MM-48614: saves priority for drafts Adds a new column in the drafts table, "priority". This way we can save post's priority in the draft. Fixes OmitConnectionId, which when you published a ws event for a user was getting bypassed. Fixes Get for drafts returns deleted ones as well, which is needed for upsert. * Adds test case for the OmitConnectionId * Addresses review comments, removes DeleteAt * Vets * Adds missing translation * Re-instates DeleteAt column * Adds separate case to get draft including deleted * Fixes Update Draft * Empty
Этот коммит содержится в:
@@ -120,7 +120,12 @@ func deleteDraft(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
channelID := c.Params.ChannelId
|
||||
|
||||
draft, err := c.App.GetDraft(userID, channelID, rootID)
|
||||
if err != nil || c.AppContext.Session().UserId != draft.UserId {
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
if c.AppContext.Session().UserId != draft.UserId {
|
||||
c.SetPermissionError(model.PermissionDeletePost)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ func TestUpsertDraft(t *testing.T) {
|
||||
draft := &model.Draft{
|
||||
CreateAt: 12345,
|
||||
UpdateAt: 12345,
|
||||
DeleteAt: 0,
|
||||
UserId: user.Id,
|
||||
ChannelId: channel.Id,
|
||||
Message: "original",
|
||||
@@ -105,7 +104,6 @@ func TestGetDrafts(t *testing.T) {
|
||||
draft1 := &model.Draft{
|
||||
CreateAt: 00001,
|
||||
UpdateAt: 00001,
|
||||
DeleteAt: 0,
|
||||
UserId: user.Id,
|
||||
ChannelId: channel1.Id,
|
||||
Message: "draft1",
|
||||
@@ -114,7 +112,6 @@ func TestGetDrafts(t *testing.T) {
|
||||
draft2 := &model.Draft{
|
||||
CreateAt: 11111,
|
||||
UpdateAt: 32222,
|
||||
DeleteAt: 0,
|
||||
UserId: user.Id,
|
||||
ChannelId: channel2.Id,
|
||||
Message: "draft2",
|
||||
@@ -180,7 +177,6 @@ func TestDeleteDraft(t *testing.T) {
|
||||
draft1 := &model.Draft{
|
||||
CreateAt: 00001,
|
||||
UpdateAt: 00001,
|
||||
DeleteAt: 0,
|
||||
UserId: user.Id,
|
||||
ChannelId: channel1.Id,
|
||||
Message: "draft1",
|
||||
@@ -190,7 +186,6 @@ func TestDeleteDraft(t *testing.T) {
|
||||
draft2 := &model.Draft{
|
||||
CreateAt: 11111,
|
||||
UpdateAt: 32222,
|
||||
DeleteAt: 0,
|
||||
UserId: user.Id,
|
||||
ChannelId: channel2.Id,
|
||||
Message: "draft2",
|
||||
|
||||
Ссылка в новой задаче
Block a user