Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-15228 consecutive bot posts maintain the profile image #2716

Merged
merged 8 commits into from
May 10, 2019
Merged

MM-15228 consecutive bot posts maintain the profile image #2716

merged 8 commits into from
May 10, 2019

Conversation

scottleedavis
Copy link
Contributor

@scottleedavis scottleedavis commented Apr 27, 2019

Summary

This adds the profile image in consecutive bot posts.

Ticket Link

Fixes mattermost/mattermost#10681

Related Pull Requests

@scottleedavis scottleedavis changed the title consecutive bot posts maintain the profile image MM-15228 consecutive bot posts maintain the profile image Apr 27, 2019
@hanzei hanzei requested a review from jasonblais April 27, 2019 05:39
@hanzei hanzei added the 1: PM Review Requires review by a product manager label Apr 27, 2019
@hanzei hanzei added this to the v5.12.0 milestone Apr 27, 2019
@jasonblais jasonblais added the Setup Old Test Server Triggers the creation of a test server label Apr 27, 2019
Copy link
Contributor

@jasonblais jasonblais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @scottleedavis!

After testing with the reminder bot, looks like consecutive posts aren't maintaining the profile image (and username). This is using v0.1.6 of the plugin

image

@scottleedavis
Copy link
Contributor Author

scottleedavis commented Apr 29, 2019

@jasonblais I had neglected 'compact view'. With Standard view I believe they are not grouped.
Screen Shot 2019-04-29 at 2 03 23 PM

@scottleedavis
Copy link
Contributor Author

scottleedavis commented Apr 29, 2019

Though yours look different than collapsed. The spinmint server gives me different results currently that what you got.

@jasonblais
Copy link
Contributor

@scottleedavis That's odd. Mine is indeed in Standard View. Reproduces on macOS Sierra, latest Chrome version

image

@scottleedavis
Copy link
Contributor Author

After a couple page refreshes (chrome, osx mojave) I was able to reproduce it in the spinmint server. I am however, not currently able to reproduce the issue locally e38ac5b.

@scottleedavis
Copy link
Contributor Author

@hmhealey @saturninoabril This PR works locally (for me) but not on this spinmint. Do you have a recommendation on how best to troubleshoot this?

@saturninoabril saturninoabril removed the Setup Old Test Server Triggers the creation of a test server label Apr 30, 2019
@saturninoabril
Copy link
Member

Thanks @scottleedavis, I'm checking...

@mattermost mattermost deleted a comment from mattermod Apr 30, 2019
@saturninoabril saturninoabril added the Setup Old Test Server Triggers the creation of a test server label Apr 30, 2019
@saturninoabril
Copy link
Member

I posted several reminders - /remind me testing in 1 minute - and below were what I've got after waiting some time. Each post has profile image which indicates that it works.

Screen Shot 2019-04-30 at 2 56 40 PM

Could you try it again?

Not sure if my repro steps are good enough. Let me know if not and I'll test it again.

@jasonblais
Copy link
Contributor

Hm, I'm not able to reproduce it on this new spinmint. So I'll approve the PR with the latest changes.

@jasonblais
Copy link
Contributor

@saturninoabril @scottleedavis Actually, it does reproduce.

  1. Install v0.1.6 of the remind bot plugin https://github.com/scottleedavis/mattermost-plugin-remind/releases/tag/v0.1.6
  2. Post /remind me testing 5sec
  3. Post /remind me testing 5sec again
  4. Refresh the page

Observed: Consecutive posts do not have profile picture or username of the bot

image

@scottleedavis
Copy link
Contributor Author

@saturninoabril @jasonblais
I can confirm latest spinmint, using the test branch https://github.com/scottleedavis/mattermost-plugin-remind/tree/ephemeral-bot-posts , reproduces the results of collapsed consecutive posts.

I also confirm that using the same branch locally, works as intended.

Screen Shot 2019-04-30 at 7 31 21 AM

@scottleedavis
Copy link
Contributor Author

@jasonblais @saturninoabril I was able to replicate the failure locally by recloning the repo and starting fresh.

This latest commit fixes the issue for me locally, and I am hoping it will run in spinmint as well. :)

@saturninoabril saturninoabril removed the Setup Old Test Server Triggers the creation of a test server label May 2, 2019
@mattermost mattermost deleted a comment from mattermod May 2, 2019
@saturninoabril saturninoabril added the Setup Old Test Server Triggers the creation of a test server label May 2, 2019
@jasonblais
Copy link
Contributor

Thanks @scottleedavis!! Looks like the build is failing, can you help take a look? I'll then generate a new spinmint to test

@jasonblais jasonblais added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels May 2, 2019
@jasonblais
Copy link
Contributor

jasonblais commented May 2, 2019

Thanks @scottleedavis! Consecutive posts now indeed maintain profile picture and username.

However, on page reload while the profile loads, the posts are initially collapsed, until they're separated.

This is different from the behaviour for webhook posts, and may cause scroll pop when loading a channel:

image

I'm wondering if there is a way to maintain user profile for consecutive bot posts similar to consecutive webhook posts while the channel contents load?

@scottleedavis
Copy link
Contributor Author

@jasonblais My attempts at optimizing the rendering of user profile for bot posts has not been fruitful so far, and I am curious how to best solve it.

@scottleedavis
Copy link
Contributor Author

scottleedavis commented May 4, 2019

@jasonblais following your idea to render the same as a webhook bot, I followed the same pattern of using the post.props sent from server, one called 'from_bot'. In doing so, the 'scroll pop' effect has gone away. This is because the webapp no longer needs a second call to the store to pull a user object to determine 'isBot' . This required a minimal server side change as well. mattermost/mattermost#10793

Please let me know if this solves the problem!

@jasonblais jasonblais added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels May 4, 2019
@jasonblais jasonblais removed their assignment May 4, 2019
Copy link
Contributor

@jasonblais jasonblais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks @scottleedavis! Scroll pop is now resolved based on testing I carried out.

One more question which is not directly related to this PR and hence not blocking - would you know why the bot post username and profile picture aren't initially loaded after a page refresh, whereas they are for regular users (and also for webhook posts, as in above screenshot).

image

@jasonblais jasonblais added 2: Dev Review Requires review by a core commiter and removed 1: PM Review Requires review by a product manager labels May 4, 2019
@scottleedavis
Copy link
Contributor Author

scottleedavis commented May 4, 2019

@jasonblais Looking at imageURLForUser(userIdOrObject)
On page load for users and webhook bots, a user object object is passed, and is immediately translated into an image route.

For bots, a userId is passed, which at first pass is not found in the store and Constants.TRANSPARENT_PIXEL is loaded until which time the store has the bot user, and the image is rendered. (i.e. the dot -> image transition)

For user & webhook username 'Someone' is displayed for one render cycle before switching to the correct username. For bots it is two, which produces the noticeable shift.

I noticed posts stop collapsing for normal users at commit 32d5332 (@hmhealey) after I merged in master. Is that to be addressed in a separate PR?

@jasonblais
Copy link
Contributor

Thanks @scottleedavis! Appreciate it

I've created two tickets: one for not loading username and profile picture immediately after page refresh, and included your investigation as part of the ticket: https://mattermost.atlassian.net/browse/MM-15433

Bug ticket for regular user posts no longer collapsing: https://mattermost.atlassian.net/browse/MM-15432

@hanzei hanzei removed the Setup Old Test Server Triggers the creation of a test server label May 9, 2019
Copy link
Member

@saturninoabril saturninoabril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @scottleedavis!

@hmhealey hmhealey added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core commiter labels May 10, 2019
@hmhealey hmhealey merged commit f9cf512 into mattermost:master May 10, 2019
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels May 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MM-15228] Do not hide profile pic in consecutive bot account posts
6 participants