mirror of
https://github.com/usememos/memos.git
synced 2025-10-09 05:46:22 +08:00
parent
7d5f603482
commit
f46b64a17d
1 changed files with 18 additions and 0 deletions
|
@ -3,6 +3,7 @@ package integration
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
@ -144,6 +145,23 @@ func (t *TelegramHandler) CallbackQueryHandle(ctx context.Context, bot *telegram
|
|||
return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Memo %d not found, possibly deleted elsewhere", memoID))
|
||||
}
|
||||
|
||||
var disablePublicMemo bool
|
||||
setting, err := t.store.GetWorkspaceSetting(ctx, &store.FindWorkspaceSetting{
|
||||
Name: apiv1.SystemSettingDisablePublicMemosName.String(),
|
||||
})
|
||||
if err != nil {
|
||||
return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to get workspace setting %s", err))
|
||||
}
|
||||
|
||||
err = json.Unmarshal([]byte(setting.Value), &disablePublicMemo)
|
||||
if err != nil {
|
||||
return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to get workspace setting %s", err))
|
||||
}
|
||||
|
||||
if disablePublicMemo && visibility == store.Public {
|
||||
return bot.AnswerCallbackQuery(ctx, callbackQuery.ID, fmt.Sprintf("Failed to changing Memo %d to %s\n(workspace disallowed public memo)", memoID, visibility))
|
||||
}
|
||||
|
||||
update := store.UpdateMemo{
|
||||
ID: memoID,
|
||||
Visibility: &visibility,
|
||||
|
|
Loading…
Add table
Reference in a new issue