This commit is contained in:
Daniel 2025-06-09 22:31:29 +08:00
parent c145cd2a95
commit a93762abd3
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 32 additions and 0 deletions

View file

@ -44,6 +44,36 @@ import (
"github.com/xrash/smetrics"
)
func (tx *Transaction) doSetAttrViewFitImage(operation *Operation) (ret *TxErr) {
err := setAttrViewFitImage(operation)
if err != nil {
return &TxErr{code: TxErrWriteAttributeView, id: operation.AvID, msg: err.Error()}
}
return
}
func setAttrViewFitImage(operation *Operation) (err error) {
attrView, err := av.ParseAttributeView(operation.AvID)
if err != nil {
return
}
view, err := getAttrViewViewByBlockID(attrView, operation.BlockID)
if err != nil {
return
}
switch view.LayoutType {
case av.LayoutTypeTable:
return
case av.LayoutTypeGallery:
view.Gallery.FitImage = operation.Data.(bool)
}
err = av.SaveAttributeView(attrView)
return
}
func (tx *Transaction) doSetAttrViewCardSize(operation *Operation) (ret *TxErr) {
err := setAttrViewCardSize(operation)
if err != nil {

View file

@ -284,6 +284,8 @@ func performTx(tx *Transaction) (ret *TxErr) {
ret = tx.doSetAttrViewCoverFromAssetKeyID(op)
case "setAttrViewCardSize":
ret = tx.doSetAttrViewCardSize(op)
case "setAttrViewFitImage":
ret = tx.doSetAttrViewFitImage(op)
}
if nil != ret {