Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ceadebfe

Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)

Fixed issue with cached info not being returned to FE

Zobrazit rozdíly:

Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs
174 174
            else
175 175
            {
176 176
                docToRender = annotation.CachedDocumentHTML;
177
                HTMLService.CachedInfo cachedInfo = new()
177
                cachedInfoToReturn = new()
178 178
                {
179 179
                    TagStartPositions = JsonConvert.DeserializeObject<List<int>>(annotation.CachedStartPositions),
180 180
                    TagStartLengths = JsonConvert.DeserializeObject<List<int>>(annotation.CachedLengths),
181 181
                    TagClosingPositions = JsonConvert.DeserializeObject<List<int>>(annotation.CachedClosingPositions),
182
                    TagClosingLengths = JsonConvert.DeserializeObject<List<int>>(annotation.CachedClosingLengths)
182
                    TagClosingLengths = JsonConvert.DeserializeObject<List<int>>(annotation.CachedClosingLengths),
183
                    TagInstanceCSS = JsonConvert.DeserializeObject<List<TagInstanceCSSInfo>>(annotation.CachedCSS)
183 184
                };
184 185
                
185 186
                // The annotation has been modified and we need to either add the new tag or remove the tag
......
188 189
                    if (annotation.ModifiedType == EModified.ADDED)
189 190
                    {
190 191
                        var lastModifiedTag = context.AnnotationTags.Where(at => at.Id == annotation.LastModifiedTagId).First();
191
                        var result = htmlService.PartialPreprocessHTMLAddTag(docToRender, documentContent.Content, lastModifiedTag, tags, cachedInfo);
192
                        var result = htmlService.PartialPreprocessHTMLAddTag(docToRender, documentContent.Content, lastModifiedTag, tags, cachedInfoToReturn);
192 193
                        docToRender = result.Item1;
193 194
                        cachedInfoToReturn = result.Item2;
194 195
                    }
195 196
                    else if (annotation.ModifiedType == EModified.REMOVED)
196 197
                    {
197
                        var result = htmlService.PartialPreprocessHTMLRemoveTag(docToRender, documentContent.Content, new AnnotationTag() { Id = annotation.LastModifiedTagId.Value }, tags, cachedInfo);
198
                        var result = htmlService.PartialPreprocessHTMLRemoveTag(docToRender, documentContent.Content, new AnnotationTag() { Id = annotation.LastModifiedTagId.Value }, tags, cachedInfoToReturn);
198 199
                        docToRender = result.Item1;
199 200
                        cachedInfoToReturn = result.Item2;
200 201
                    }
......
249 250
                }
250 251
            }
251 252

  
252
            if (annotation.State == EState.NEW)
253
            {
254
                annotation.State = EState.IN_PROGRESS;
255
            }
256

  
257 253
            AnnotationTag annotationTag = new()
258 254
            {
259 255
                Id = Guid.NewGuid(),
......
312 308
                throw new ArgumentException($"Unknown tag type {request.Type}");
313 309
            }
314 310

  
311
            if (annotation.State == EState.NEW)
312
            {
313
                annotation.State = EState.IN_PROGRESS;
314
            }
315

  
315 316
            annotation.LastModifiedTagId = annotationTag.Id;
316 317
            annotation.ModifiedType = EModified.ADDED;
317 318

  
Backend/Core/Services/HTMLService/HTMLService.cs
66 66
            AssignIdsToOriginalDocument(descendantsOriginal, ref currentId);
67 67

  
68 68
            WrapTextInSpan(descendantsOriginal, docToEdit);
69

  
70
            descendantsToEdit = docToEdit.DocumentNode.DescendantsAndSelf().ToList();
69 71
            int descCount = descendantsToEdit.Count;
70 72

  
71 73
            foreach (var tag in tags)

Také k dispozici: Unified diff