רבי שמעון בן אלעזר אומר
אל תרצה את חברך בשעת כעסו
ואל תנחמהו בשעה שמתו מוטל לפניו
Rabbi Shimon b. Elazar says:
Don’t appease your friend when he’s angry,
and don’t comfort your friend when his dead lies before him… 
Previously, Rabbi Yishmael said that we should accept others as they are.
“Receive” shares the Hebrew root [קבל] with “accept.” Thus, to “receive them cheerfully” is also to “accept them” as they are.
We’d assume that in the interest of peace, we should be quick to appease a friend we’ve angered, or to try to calm him/her at a time when they’ve become angry for any reason.
But the rabbis, observing human interactions, note that sometimes, trying to calm an angry person only makes them angrier!
Why is this so?
At its root, “anger” is self-will that’s been thwarted:
“…disappointment (as occurs when wishes are thwarted) always and without exception, leads to a sense of lack of power, or a sense of impotence, or a sense simply of disempowerment…
whenever there is disempowerment, we get angry — always…
[Why is anger] the universal response to disempowerment?
[Because] when a person feels disempowered, frequently the only way to feel re-empowered is to be angry. And we all want to be empowered.
… Anger sees itself as an empowerment. It eliminates feelings of helplessness.
…Anger like any other basic emotion has a personality based upon a single command. In the case of anger, this command is…: ATTACK!
Why? Because none of the basic or primary emotions cares a hoot about civilization.” 
This is demonstrated in Torah:
“[Yakov said of Shimon and Levi]…
In their anger [אפם] they killed men
and in their self-will [רצנם] they slaughtered oxen.” 
In their fury — their sense of disempowerment — at the rape of their sister, Yakov’s sons violate their own father’s truce and attack Shechem — weak from having just been circumcised — killing all the men. Yakov adds that they even slaughter the cattle horrifically, as well. Yakov describes them doing it “b’r’tzo’nam” — in their will; in their self-will. He sees his two sons having become so wild from fury that they violently kill anything they see. They’re no longer concerned with “civilization” — with social constraints — at all.
And yet, this is perfectly in keeping with the nature of anger itself when it’s unrestrained or unexpressed in healthier ways.
Thus, to try to appease a person when they’re angry can be asking that person to ignore their own self-will, at the very moment when they’re least able to do so.
The rabbis therefore caution us to use good sense in the timing of our efforts:
כשם שמצוה על אדם לומר דבר הנשמע
כך מצוה על אדם שלא לומר דבר שאינו נשמע
…[just] as one is commanded to say that which will be heard,
so is one commanded not to say that which will not be heard. 
“…in his hour of anger, he will not accept your pacifying words. Instead, leave him alone until he calms down. Then try to placate him and he will listen to you.” 
Why should Rabbi Shimon then tell us not to comfort someone who is freshly in mourning?
Perhaps one reason is that grief itself can contain an element of anger — of thwarted self-will:
“Anger: This stage of grief is common. It usually occurs when an individual feels helpless and powerless. Anger can stem from a feeling of abandonment because of a death or loss. Sometimes the individual is angry at a higher power, at the doctors who cared for the loved one, or toward life in general.” 
In grief, there is an element of sadness because we miss the person (or pet, or job, or home) we’ve lost.
But there can be an element of anger, too. As above, “loss” can trigger our own feelings of powerlessness.
This kind of anger can be directed at a “higher power” — at G-d:
“Depression is like anger and rage. It is like a complaint against G-d for not fulfilling one’s wishes.” 
Thus, as with anger, Rabbi Shimon cautions us not to “comfort a friend” in grief. He means, don’t tell someone to be comforted and “accept” a situation, at the very moment when that person is in the least accepting frame of mind.
“…it will seem as if you do not sympathize with the anguish of your friend.” 
Let us not ask our friends and others to cease being angry or to cease grieving only because it will make us more comfortable if they do so.
As Rabbi Yishmael said, we must accept others as they are.
 Pirkei Avot 4:23
 Henry Kellerman, Ph.D.; see http://www.psychologytoday.com/blog/thinking-matters/200910/anger-is-the-key
 Ber./Gen. 49:6
 Yevamot 65b
 Machzor Vitry (11th – 12th centuries; compiled by students of Rashi)
quoted in Goldin, Judah, trans. and ed.; The Living Talmud — The Wisdom of the Fathers; Mentor Books; © 1957 by Judah Goldin; p. 175
 Rebbe Nachman’s Wisdom, #42
 Magriso, Rabbi Yitzhak b. Mosheh; Ethics of the Talmud; Pirkei Avot (Me’am Lo’ez commentary); Barocas, David N., trans. and Rabbi Aryeh Kaplan, ed.; Maznaim Publishing Company, © 1979; p. 211