Shalitha Suranga wants to merge 12 commits from /u/shalithasuranga/allura/ to master, 2018-11-08
This is for [#8253]. Can someone check this approach and test. I created a mixin ReactableArtificat
that applies to comments
Commit | Date | |
---|---|---|
2018-11-08 06:06:17 | Tree | |
2018-11-08 06:05:20 | Tree | |
2018-11-05 08:07:54 | Tree | |
2018-11-05 08:07:19 | Tree | |
[3a9618]
by
Merge branch 'patch10' of https://forge-allura.apache.org/git/u/shalithasuranga/allura into patch10 |
2018-11-05 05:49:23 | Tree |
[07bf03]
by
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/allura into patch10 |
2018-11-05 05:40:36 | Tree |
2018-11-01 09:48:50 | Tree | |
2018-10-31 08:55:04 | Tree | |
2018-10-30 16:36:07 | Tree | |
2018-10-30 16:35:34 | Tree | |
2018-10-30 16:34:01 | Tree | |
2018-10-30 16:32:04 | Tree |
Updated with some unit tests
We should be thoughtful about the reactions list: 'thumbs_up', 'thumbs_down', 'laugh', 'hooray', 'confused', 'heart' Looks like the same ones GitHub offers. GitLab lets people pick any emoji at all. Should we consider more, or less? "laugh" surprised me, it is just a smile when GitHub renders it. I think we should call it "smile" since that's what the emoji is. And also "tada" instead of "hooray"? One idea would be to make it configurable for site administrators via a .ini setting. One of allura's strengths is its flexibility and customizability, so that might be a nice way to do it. Another thought would be to let every project customize it, but that seems like too much probably.
Maybe the counts should be a dictionary like
react_users
is, so that it can be more flexible if any are added or removed later. Would also make some methods likeupdate_react_count
a bit simpler.Although
VotableArtifact
has a__mongometa__
too, neither get used since they are mixins. The data gets stored in the main class' collection, notvote
orreaction
. So probably good to remove those.I'll test a bit more thoroughly after you look into those things too.
Hi..Dave.
I just hard coded current emoji list because this related merge request mentioned Github's reaction list. I also think customizablity via ini is good feature.
Appreaciate your ideas and made updates as per below
reactions.emoji_list = :+1:, :-1:, :smile:
in config ini. I just currently splitting value do we need to validate it ?dict
for countsupdate_react_count
by adding boolean parameterNotices
I had to use utils.py to add a common method. moved js code from allura-base to widget since it is dynamic. updated app_globals with emojize method because it is required inside jinja templates
Can you advice regarding the changes
Thanks
Hey Shalitha,
This is great as far as functionality and configuration go. Mostly feedback on code setup / cleanup:
%s
.onclick
isn't ideal, although allura code in other places does it too. Better to have regular .js file do some jquery with the class selectors.var reactions = {{h.escape_json(reactions)|safe}};
assert ... and .. and ..
can you split those into separate statements? That when when a test fails its clear exactly which part the problem is.For the config setting, splitting it without validation is fine. If someone makes a mistake, its only site administrators and they can fix it :) What I would do though is put a
reactions.emoji_list
example in development.ini like we do for other settings so people can find it and see how it works.If you wanted to add more functionality at this point, it could be nice to indicate which reaction you currently have. And be able to click on it to remove it.
Getting excited 😁
Hi.. Dave
Thanks for the feedback. Please check these modifications done...
global_reactions
via Thread widget and moved modified function to utilscurrent reaction display can be done simply checking user in react_users dict. But will it afect performance if there are huge list of comments? Better to do in another ticket + MR?
A separate ticket for currrent reaction makes sense. Regarding performance, I don't think it'll be a problem unless there are thousands of reactions or more. Once data is in memory, looping through is quite quick.
Okay. Agree I will go with separate ticket after we add this one
Also
emoji_unicode
in json response is no longer needed since we already have list of emojis as a global var. Can we remove it from response. but there is rare situation when user reacts and at the same time admin changes emoji listWhat do you think?
Yea I think that situation would be extremely rare, so cleaning that up would be fine.
Can you put a
reactions.emoji_list
example in development.ini like we do for other settings so people can find it and see how it works.Then I think we're good to go with this
Okay Thanks. I will do the cleaning and ini modification
Hi.. Dave
I updated branch with modifications please check
👍
🥳