You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-15 23:54:29 +02:00
New Props: Created By, Created At, Updated By, Updated At (#583)
* Added create_at column for blocks * Populating created by * Added logic for storing created by * Added GetBlock by ID to store interface * Added creayed by and modified by properties * Added created by and modified by properties * Added lastmodifiedat property * Fixed existing webapp test * Added webapp unit tests * Added webapp unit tests * Added webapp unit tests * Adding server test * Added server tests * Fixed a bug causing created by to be set empty * Avodining timezone specific test behavior * Made cypress viewport bigger to avoid out-of-viewoport issues in multiple tests * Removed a leftover comment * Added updated at/by in table view * Added updated at in card view * Fixing sort * Fixed sorting of updated by * Fixed existing tests * Added table tests * Added cardTree fix * Fixed tests * Removed unused import * Update snapshots * Added a tamper attempt test * Removed some leftover debug code * Removed sending creator from client * Fixed lint error * Fixed a build issue * Avoided setting insert query params multiple times * Multiple minor review fixes * Fixed test
This commit is contained in:
@ -254,7 +254,7 @@ func (a *API) handleGetBlocks(w http.ResponseWriter, r *http.Request) {
|
||||
auditRec.Success()
|
||||
}
|
||||
|
||||
func stampModifiedByUser(r *http.Request, blocks []model.Block, auditRec *audit.Record) {
|
||||
func stampModificationMetadata(r *http.Request, blocks []model.Block, auditRec *audit.Record) {
|
||||
ctx := r.Context()
|
||||
session := ctx.Value("session").(*model.Session)
|
||||
userID := session.UserID
|
||||
@ -262,8 +262,10 @@ func stampModifiedByUser(r *http.Request, blocks []model.Block, auditRec *audit.
|
||||
userID = ""
|
||||
}
|
||||
|
||||
now := utils.GetMillis()
|
||||
for i := range blocks {
|
||||
blocks[i].ModifiedBy = userID
|
||||
blocks[i].UpdateAt = now
|
||||
|
||||
if auditRec != nil {
|
||||
auditRec.AddMeta("block_"+strconv.FormatInt(int64(i), 10), blocks[i])
|
||||
@ -347,9 +349,12 @@ func (a *API) handlePostBlocks(w http.ResponseWriter, r *http.Request) {
|
||||
auditRec := a.makeAuditRecord(r, "postBlocks", audit.Fail)
|
||||
defer a.audit.LogRecord(audit.LevelModify, auditRec)
|
||||
|
||||
stampModifiedByUser(r, blocks, auditRec)
|
||||
stampModificationMetadata(r, blocks, auditRec)
|
||||
|
||||
err = a.app.InsertBlocks(*container, blocks)
|
||||
ctx := r.Context()
|
||||
session := ctx.Value("session").(*model.Session)
|
||||
|
||||
err = a.app.InsertBlocks(*container, blocks, session.UserID)
|
||||
if err != nil {
|
||||
a.errorResponse(w, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
@ -774,9 +779,11 @@ func (a *API) handleImport(w http.ResponseWriter, r *http.Request) {
|
||||
auditRec := a.makeAuditRecord(r, "import", audit.Fail)
|
||||
defer a.audit.LogRecord(audit.LevelModify, auditRec)
|
||||
|
||||
stampModifiedByUser(r, blocks, auditRec)
|
||||
stampModificationMetadata(r, blocks, auditRec)
|
||||
|
||||
err = a.app.InsertBlocks(*container, blocks)
|
||||
ctx := r.Context()
|
||||
session := ctx.Value("session").(*model.Session)
|
||||
err = a.app.InsertBlocks(*container, blocks, session.UserID)
|
||||
if err != nil {
|
||||
a.errorResponse(w, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user