diff --git a/net/server/internal/api_setCardStatus.go b/net/server/internal/api_setCardStatus.go index b06d638a..9b5fcc1b 100644 --- a/net/server/internal/api_setCardStatus.go +++ b/net/server/internal/api_setCardStatus.go @@ -108,6 +108,7 @@ func SetCardStatus(w http.ResponseWriter, r *http.Request) { slot.Card.NotifiedArticle = articleRevision slot.Card.NotifiedChannel = channelRevision slot.Card.NotifiedProfile = profileRevision + slot.Card.DetailRevision += 1 // save and update contact revision err = store.DB.Transaction(func(tx *gorm.DB) error { diff --git a/net/server/internal/api_setCloseMessage.go b/net/server/internal/api_setCloseMessage.go index b86b80c0..4ea7b739 100644 --- a/net/server/internal/api_setCloseMessage.go +++ b/net/server/internal/api_setCloseMessage.go @@ -63,6 +63,9 @@ func SetCloseMessage(w http.ResponseWriter, r *http.Request) { return res } } + if res := tx.Model(&card).Update("detail_revision", account.CardRevision + 1).Error; res != nil { + return res + } if res := tx.Model(&slot).Update("revision", account.CardRevision + 1).Error; res != nil { return res } diff --git a/net/server/internal/ucContactApp_test.go b/net/server/internal/ucContactApp_test.go index a78ea1fb..06188a93 100644 --- a/net/server/internal/ucContactApp_test.go +++ b/net/server/internal/ucContactApp_test.go @@ -178,4 +178,28 @@ func TestContactApp(t *testing.T) { } return false })) + + // disconnect from B + card := &Card{} + params = &TestApiParams{ restType: "PUT", query: "/contact/cards/{cardId}/status", tokenType: APP_TOKENAPP, token: set.B.Token, + path: map[string]string{ "cardId": set.B.A.CardId }, body: APP_CARDCONFIRMED } + response = &TestApiResponse{ data: card } + assert.NoError(t, TestApiRequest(SetCardStatus, params, response)) + msg := &DataMessage{} + params = &TestApiParams { query: "/contact/cards/{cardId}/closeMessage", tokenType: APP_TOKENAPP, token: set.B.Token, + path: map[string]string{ "cardId": set.B.A.CardId } } + response = &TestApiResponse{ data: msg } + assert.NoError(t, TestApiRequest(GetCloseMessage, params, response)) + params = &TestApiParams { restType: "PUT", query: "/contact/closeMessage", body: msg } + response = &TestApiResponse{} + assert.NoError(t, TestApiRequest(SetCloseMessage, params, response)) + + // wait for + assert.NoError(t, app.WaitFor(func(testApp *TestApp)bool { + contact, contactSet := testApp.contacts[set.A.B.CardId] + if contactSet && contact.card.Data.CardDetail.Status == APP_CARDCONFIRMED { + return true + } + return false + })) }