Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send email to newly added coauthors explaining what it means #2028

Closed
jywarren opened this issue Jan 17, 2018 · 11 comments
Closed

send email to newly added coauthors explaining what it means #2028

jywarren opened this issue Jan 17, 2018 · 11 comments
Assignees
Labels
help wanted requires help by anyone willing to contribute in progress Ruby

Comments

@jywarren
Copy link
Member

This could actually be relatively simply achieved via a comment -- by automatically leaving a comment as we do for the barnstar feature:

node.add_comment(subject: 'barnstar',
uid: current_user.uid,
body: "@#{current_user.username} awards a #{barnstar_info_link} to #{node.drupal_user.name} for their awesome contribution!")

The comment could say @_author_ has marked @_recipient_ as a co-author. and everybody on the thread would get email notified.

This code would go just before the last line of this block:

plots2/app/models/node.rb

Lines 660 to 667 in 033676b

if tag.name.split(':')[0] == 'date'
begin
DateTime.strptime(tag.name.split(':')[1], '%m-%d-%Y').to_date.to_s(:long)
rescue
return [false, tag.destroy]
end
end
tag.save!

and the message could look like:

"_@#{user.username} has marked @#{node.author.username} as a co-author._"

This should work but could take some troubleshooting -- happy to help, and any assistance in taking this task on is appreciated!

@jywarren jywarren added help wanted requires help by anyone willing to contribute Ruby labels Jan 17, 2018
@grvsachdeva
Copy link
Member

Can I take this issue ?

@jywarren
Copy link
Member Author

jywarren commented Jan 17, 2018 via email

@grvsachdeva
Copy link
Member

Hey @jywarren, the method in the tag_controller for solving this issue would work similar to method barnstar.The barnstar method is called by the form which is there in 'views/like/_like' but for making co-author there is no form present, we make co-author as for now by adding tags only, so should I add if statement in create method of tag_controller and redirect to separate method for handling creation of with:user tag or should I make a new form to trigger the method for this issue which would then perform comment creation part ?

@grvsachdeva
Copy link
Member

Also, presently automatic comment creation for barnstar take place if the barnstar is generated via Award barnstar form and not by just adding power tag [barnstar: type], so we can also make changes so that comment creation could take place if someone has added barnstar tag.What do you think @jywarren?

@jywarren
Copy link
Member Author

ah, i see. Yes, i think perhaps we should refactor these to trigger on the tag creation, not on the form submission, for both barnstars and co-authorship.

Do you want to take a crack at this? Thank you!

@jywarren
Copy link
Member Author

Just watch out because you can't access current_user in the models -- they don't "know" about the user session. But we should be able to use the tag creator's uid, right?

@grvsachdeva
Copy link
Member

I will take care of this.Thanks, Jeff.

@jywarren
Copy link
Member Author

jywarren commented Jan 23, 2018 via email

@grvsachdeva
Copy link
Member

The comment could say @author has marked @recipient as a co-author. and everybody on the thread would get email notified.

I want to confirm @jywarren that whether we need to send email to all the people present on that thread or only to the user who has been added as a co-author ?

@jywarren
Copy link
Member Author

jywarren commented Feb 6, 2018 via email

@grvsachdeva
Copy link
Member

Thanks for clarifying Jeff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted requires help by anyone willing to contribute in progress Ruby
Projects
None yet
Development

No branches or pull requests

2 participants