157
+    this.getList()
158
+  },
159
+  methods: {
160
+    getList() {
161
+      this.listLoading = true
162
+      var _self = this
163
+      fetchRoomGoodsList(this.listQuery).then(response => {
164
+        _self.list = response.data.goods_list.map(goods => {
165
+          goods.isEditable = false
166
+          return goods
167
+        })
168
+        _self.total = response.data.count
169
+        // Just to simulate the time of the request
170
+        this.listLoading = false
171
+      })
172
+    },
173
+
174
+    handleFilter() {
175
+      this.getList()
176
+    },
177
+
178
+    handleOff(row) {
179
+      var _self = this
180
+      this.$alert(`确定从${row.room_name}下架${row.goods_name}`, '下架产品', {
181
+        confirmButtonText: '下架',
182
+        callback: action => {
183
+          offRoomGoods(row).then(response => {
184
+            _self.getList()
185
+          })
186
+        }
187
+      })
188
+    },
189
+
190
+    handlePublish(row) {
191
+      var _self = this
192
+      publishRoomGoods(row).then(response => {
193
+        _self.getList()
194
+      })
195
+    },
196
+
197
+    handleUpdate(row) {
198
+      row.isEditable = true
199
+      this.inventory = row.inventory
200
+    },
201
+
202
+    handleUpdateCancel(row) {
203
+      row.isEditable = false
204
+    },
205
+
206
+    handleInventoryChanged(row) {
207
+      var _self = this
208
+      const goods = row
209
+      goods.inventory = this.inventory
210
+      updateRoomGoods(goods).then(response => {
211
+        _self.getList()
212
+      })
213
+    }
214
+  }
215
+}
216
+</script>

Fix Bug: duplicate thumbup should not increase thumbup_num · 017d878faa - Gogs: Go Git Service

Fix Bug: duplicate thumbup should not increase thumbup_num

Brightcells 9 gadi atpakaļ
vecāks
revīzija
017d878faa
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. 4 3
      group/views.py

+ 4 - 3
group/views.py

@@ -691,9 +691,10 @@ def thumbup_submit_api(request):
691 691
     photo_thumbup.thumbup = True
692 692
     photo_thumbup.save()
693 693
 
694
-    # 群组照片点赞数更新
695
-    group_photo.thumbup_num += 1
696
-    group_photo.save()
694
+    if created:
695
+        # 群组照片点赞数更新
696
+        group_photo.thumbup_num += 1
697
+        group_photo.save()
697 698
 
698 699
     # 判断群组照片发布者是否已经被管理员移除/主动退出,如若移除/退出,则不给发布者提醒
699 700
     if r.sismember(GROUP_USERS_PASSED_SET % group_photo.group_id, group_photo.user_id):