Forum Discussion

bryanpollack's avatar
11 years ago

Check if a message is moved

Are there any ways to tell if a message has been moved (i.e. check if a message is a placeholder message)? I'd like to display "Moved:" in my custom component like in the default message-list, but I see no way to determine if that's the case. Thanks.

4 Replies

  • JakeS's avatar
    JakeS
    Lithium Alumni (Retired)
    11 years ago
    I'm not sure that there's a way to get that info about a message, but would it also be acceptable just not to show any moved messages in that component?
  • Hi ,

     

    I had a similar requirement awhile back . Unfortunately after asking around and searching , I found there isn't a way to find out if a post has been moved. 

     

    Thanks,

    Sam

     

     

  • NicoB's avatar
    NicoB
    Lithium Alumni (Retired)
    11 years ago
    Hi,
    the only approach I can think about is:
    Given you know the message ID you can do:
    /search/messages?q=ID:[MESSAGE ID HERE]&showMoved=true
    If this query returns something it means the message has been moved, otherwise it isn't.
    Not very elegant, I know, but I don't know any other way to achieve this.
  • I compared the response of API calls to a placeholder message and the moved message at the new location. There indeed seems to be no metadata exposed that allows to tell whether a message is a placeholder. But two in combination seem to set placeholder messages apart: Their body is empty and they are set to read-only:

    <body type="string"/>
    ....
    <read_only type="boolean">true</read_only>

    If you disallow messages with empty bodies maybe this is already reliable enough.