fix: do not try to load profile image from param for self - #8605
Conversation
I have an old profile which has ProfileImage param set on the reserved SELF contact. When I deleted an avatar from the profile, very old profile image showed up in the settings in Delta Chat Desktop instead, which can be "deleted" again without any result. This fix is to return `None` early from get_profile_image_ext for self contact without trying to load the parameter. Fallthrough to loading params was likely there since keycontacts and grey avatars for address contacts introduction in 416131b
2570e5b to
2d542ce
Compare
|
Could even be it is also some result of me doing development on this profile at some point long ago, so it is really minor. Or it is very uncommon to delete an avatar without a replacement. I also deleted all params from the database for self contact locally now to be sure. |
hpk42
left a comment
There was a problem hiding this comment.
lgtm, but two notes: would have been easier to review if you didn't also refactor the structure (which makes sense, and is fine). The other minor nit is that it would be nice to remove Param::ProfileImage maybe just on the fly, or maybe keep it on a list for some future migration that maybe also cleans up other historic oddities.
Yes, it is to make it visible that there is no fallthrough anywhere, as the bug was caused by fallthrough from the first
I only cleaned this parameter locally to be 100% sure i'm not sending old avatar and not have it appear until the bugfix is released. For all users i think it's too risky to clean up things like this and there is nothing visible as the result. E.g. in this case we want to cleanup the parameter we will need to open a write transaction and re-read the parameter there, otherwise may accidentally revert some change from another thread. We also have columns in the database that cannot be removed because when we tried some phones failed to run migrations as they ran out of space/memory. For some cleanup, i did a follow-up to remove unused avatar file in housekeeping: #8634 |
I have an old profile which has ProfileImage param set on the reserved SELF contact. When I deleted
an avatar from the profile, very old profile image showed up in the settings in Delta Chat Desktop instead, which can be "deleted" again without any result.
This fix is to return
Noneearly from get_profile_image_ext for self contact without trying to load the parameter. Fallthrough to loading params was likely theresince keycontacts and grey avatars for address contacts introduction in 416131b