“If you don’t have something nice to say, don’t say anything at all.” That is usually bad advice. Because then when you say nothing at all it is understood that you have only unkind things to say.
If you are trying to maximize pleasantry then your policy should depend on your listener’s preferences. Based on what you say she is going to revise her beliefs over what you think about her. What matters is her preferences over these beliefs.
A key fact is that you have only limited control over those beliefs. Some of the time you will say something kind and some of the time you will say something unkind. These will move her beliefs up and down but by the law of total probability the average value of her beliefs is equal to her prior. You control only the variance.
If good feelings help at the margin more than bad feelings hurt then she is effectively risk-loving. You should go to extremes and maximize variance. Here the old adage applies: you should say something nice when you have something nice to say and you should not say anything nice when you don’t. In terms of her beliefs, it makes no difference whether you say the unkind thing or just keep quiet and allow her to infer it. But perhaps politeness gets a lexicographic kick here and you should not say anything at all.
(On thing the standard policy ignores is the ambiguity. Since there are potentially many unkind things you might be witholding, if she is pessimistic you might worry that she will assume the worst. Then you should consider saying slightly-unkind things in order to prevent the pessimistic inference. Still there is the danger of unraveling because then when you say nothing at all she will know that what is on your mind is even worse than that.)
If she is risk-averse in beliefs then you want to go to the opposite extreme and never say anything. She never updates her beliefs.
But prospect theory suggests that her preferences are S-shaped around the prior: risk-averse on the upside but risk-loving on the downside. Then often it is optimal to generate some variance but not to go to extremes. You do this by dithering. Your never give outright compliments or insults. Your statements are always noisy and subject to interpretation. But the signal to noise ratio is not zero.
A full analysis of this problem would combine the tools of psychological game theory with persuasion mechanisms a’ la Gentzkow and Kamenica.