Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19842

Likes table of the user profile always display the likes of the current user

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 14.4.2, 13.10.7, 14.5
    • 13.3-rc-1
    • None
    • Integration
    • Unknown
    • N/A
    • N/A

    Description

      When logged in as "superadmin" and viewing any user profile page, the following the error message appears for s short time at the bottom of the page in a red error box:

      Updating the entries failed for an unknown reason.

      The log file reveals the cause of the problem:

      2022-06-15 22:17:38,643 [qtp936580213-18 - http://localhost:11080/xwiki/rest/liveData/sources/liveTable/entries?timestamp=1655324258444&namespace=wiki%3Axwiki&sourceParams.resultPage=XWiki.Like.Code.LiveTableResultPage&sourceParams.queryFilters=currentlanguage%2Chidden&properties=doc.title&properties=doc.location&properties=like&offset=0&limit=15] ERROR r.i.e.ExceptionExceptionMapper - A REST endpoint failed with an unmapped exception. 
      org.xwiki.livedata.LiveDataException: Failed to execute the live data query.
      	at org.xwiki.livedata.internal.livetable.LiveTableLiveDataEntryStore.get(LiveTableLiveDataEntryStore.java:116)
      	at org.xwiki.livedata.internal.rest.DefaultLiveDataEntriesResource.getEntries(DefaultLiveDataEntriesResource.java:193)
      	at org.xwiki.livedata.internal.rest.DefaultLiveDataEntriesResource.getEntries(DefaultLiveDataEntriesResource.java:79)
      [...]
      Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Failed': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
       at [Source: (String)"Failed to execute the [velocity] macro. Cause: [Only DocumentUserReference are handled]. Click on this message for details.
      
      org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [#if ($xcontext.action == 'get')
        #template('hierarchy_macros.vm')
        #if("$!{request.xpage}" == 'plain')
          $response.setContentType('application/json')
        #end
        #if($request.user)
          #set ($userReference = $request.user)
        #else
          #set ($userReference = $services.user.cur"[truncated 19648 chars]; line: 1, column: 7]
      	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2391)
      	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:745)
      	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2961)
      	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:2002)
      	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:802)
      	at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4703)
      	at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:3076)
      	at org.xwiki.livedata.internal.livetable.LiveTableLiveDataEntryStore.getLiveTableResultsJSON(LiveTableLiveDataEntryStore.java:142)
      	at org.xwiki.livedata.internal.livetable.LiveTableLiveDataEntryStore.get(LiveTableLiveDataEntryStore.java:107)
      	... 101 common frames omitted
      

      As the user representation of the superadmin user is no "DocumentUserReference", als the likes section always shows the likes of the user currently logged in, the liv data sources failes.

      Solution ideas: Either show the likes for the user of the profile instead (might need access checks, so only admins can see them), or check in the live data source that the user reference type is appropriate.

      Note: the root cause is the user missing in the parameters of the Live Data.
       

      Attachments

        Issue Links

          Activity

            People

              mleduc Manuel Leduc
              camil7 Clemens Robbenhaar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: