Addons-frontend: Comment date is not updated after comment edit

Created on 13 Mar 2017  ·  16Comments  ·  Source: mozilla/addons-frontend

Steps to reproduce:

  1. Add a comment to a theme/add-on on Android i.e. https://addons-dev.allizom.org/en-US/android/addon/full-screen-252573/
  2. Wait a while and edit your comment

Expected results:
Date of the comment is updated to the moment that the comment was edited.

Actual results:
Date of the comment is not the same.

Notes/Issues:
Verified on FF52(Android 6.0.1). Issue is reproducing on both dev and stage.
Comment edited today:
edit_001

add-on ratings p4 amo triaged papercut

Most helpful comment

Thanks for all your work on this @kartik-budhiraja but upon closer inspection, I decided that this is not a good issue for us to work on at the moment (I include team members and contributors in that statement).

The reason is that the API is not returning an updated field but it should be. It's only returning a created field (which is used here). This means that we'll need an API update and that makes this issue non-trivial to work on.

This was probably the source of your confusion -- the edited field you added technically exists already but only in the database. We can't simulate this on the frontend.

All 16 comments

This is still an issue. We might want to define how we display edits vs the original comment date. E.g. I don't know that we should simply update the date display.

@pwalm Thoughts on how this should work?

Hmmm... How about: "posted 3 days ago (edited 5 mins ago)"

Repeating "ago" twice seems weird, but it works for me.

While I’m rarely one to point to reddit as a way to do things 😅, I think their edit system works well here. They just show an asterisk next to the time posted and add a title attribute for when it was edited iirc.

I think adding a bracketed “edited” with a title attribute for more info (“last edited 5 mins ago”) would work eg: posted 3 days ago <span title=“Last edited 5 minutes ago”>(edited)</span>. It prevents the “ago” appearing twice, shows a post was edited, and preserves relative dates so it’s easy to compare creation date with last edited date.

Side note: it might be worth ignoring displaying “edited” if it was edited within a few minutes of creation date as that is likely a typo fix or similar, though obviously there’s an abuse potential there. It’s small though–the developer would need to reply to a review that was entirely changed within a few minutes to look foolish. Maybe if there’s a developer reply we show a post was edited no matter what.

@tofumatt Let's try the Reddit way

I'm opening this up to contributors. I can mentor.

Hey guys - I have a friend whose looking to get started in open source. I'll speak to him (@kartik-budhiraja) and see if he can give this a shot!

@kumar303 I would love to work on this issue.

Kumar is on PTO (aka Holidays) so we'll try to get as far as we can and leave feedback on what we've done

I added Boolean (edited) property to the review type, but I am stuck on the process of updating it's value on edit, I suppose this method below is responsible for that :

https://github.com/mozilla/addons-frontend/blob/e6913b93d1345f96931861de247283a057399281/src/amo/actions/reviews.js#L704-L730

I modified it accordingly :
https://github.com/kartik-budhiraja/addons-frontend/blob/dcb653486b5dfd4f5214894e9a85e41a56879bd6/src/amo/actions/reviews.js#L706-L732

It is receiving the values as expected but edited is not getting updated and always coming as false.
@kumar303 can you please help me out here?

Is there a PR I could look at?

Added PR #7406 . @kumar303

Thanks for all your work on this @kartik-budhiraja but upon closer inspection, I decided that this is not a good issue for us to work on at the moment (I include team members and contributors in that statement).

The reason is that the API is not returning an updated field but it should be. It's only returning a created field (which is used here). This means that we'll need an API update and that makes this issue non-trivial to work on.

This was probably the source of your confusion -- the edited field you added technically exists already but only in the database. We can't simulate this on the frontend.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ioanarusiczki picture ioanarusiczki  ·  5Comments

Sparsh1212 picture Sparsh1212  ·  5Comments

ValentinaPC picture ValentinaPC  ·  4Comments

AlexandraMoga picture AlexandraMoga  ·  6Comments

ioanarusiczki picture ioanarusiczki  ·  4Comments