Skip to content

Commit 398e4cf

Browse files
[MM-410]: Fixed the update of Slack attachment props for the meeting post (#411)
* fixed the meeting reconfirmation issue * fixed testcases * fix past post fetch to check reconfirmation of meeting
1 parent 1748f4d commit 398e4cf

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

server/http.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,10 @@ func (p *Plugin) checkPreviousMessages(channelID string) (recentMeeting bool, me
752752
}
753753

754754
for _, post := range postList.ToSlice() {
755+
if post.DeleteAt != 0 {
756+
continue
757+
}
758+
755759
meetingProvider := getString("meeting_provider", post.Props)
756760
if meetingProvider == "" {
757761
continue

server/plugin_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func TestPlugin(t *testing.T) {
162162

163163
api.On("KVSetWithOptions", "mutex_mmi_bot_ensure", mock.AnythingOfType("[]uint8"), model.PluginKVSetOptions{Atomic: true, OldValue: []uint8(nil), ExpireInSeconds: 15}).Return(true, nil)
164164
api.On("KVSetWithOptions", "mutex_mmi_bot_ensure", []byte(nil), model.PluginKVSetOptions{ExpireInSeconds: 0}).Return(true, nil)
165+
api.On("KVSetWithOptions", "post_meeting_234", []byte(nil), model.PluginKVSetOptions{ExpireInSeconds: 0}).Return(true, nil)
165166

166167
api.On("EnsureBotUser", &model.Bot{
167168
Username: botUserName,

server/store.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ func (p *Plugin) storeMeetingPostID(meetingID int, postID string) *model.AppErro
150150

151151
func (p *Plugin) fetchMeetingPostID(meetingID string) (string, error) {
152152
key := fmt.Sprintf("%v%v", postMeetingKey, meetingID)
153-
var postID string
154-
if err := p.client.KV.Get(key, &postID); err != nil {
153+
var postIDData []byte
154+
if err := p.client.KV.Get(key, &postIDData); err != nil {
155155
p.client.Log.Debug("Could not get meeting post from KVStore", "error", err.Error())
156156
return "", err
157157
}
158158

159-
if postID == "" {
159+
if postIDData == nil {
160160
return "", errors.New("stored meeting post ID not found")
161161
}
162162

163-
return postID, nil
163+
return string(postIDData), nil
164164
}
165165

166166
func (p *Plugin) deleteMeetingPostID(postID string) error {

server/webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (p *Plugin) handleWebhook(w http.ResponseWriter, r *http.Request) {
6969
}
7070
}
7171

72-
func (p *Plugin) handleMeetingEnded(w http.ResponseWriter, r *http.Request, body []byte) {
72+
func (p *Plugin) handleMeetingEnded(w http.ResponseWriter, _ *http.Request, body []byte) {
7373
var webhook zoom.MeetingWebhook
7474
if err := json.Unmarshal(body, &webhook); err != nil {
7575
p.client.Log.Error("Error unmarshaling meeting webhook", "err", err.Error())
@@ -169,7 +169,7 @@ func (p *Plugin) verifyZoomWebhookSignature(r *http.Request, body []byte) error
169169
return nil
170170
}
171171

172-
func (p *Plugin) handleValidateZoomWebhook(w http.ResponseWriter, r *http.Request, body []byte) {
172+
func (p *Plugin) handleValidateZoomWebhook(w http.ResponseWriter, _ *http.Request, body []byte) {
173173
config := p.getConfiguration()
174174
if config.ZoomWebhookSecret == "" {
175175
p.API.LogWarn("Failed to validate Zoom webhook: Zoom webhook secret not set")

0 commit comments

Comments
 (0)