Open garethrees opened 9 years ago
This is a similar problem to #2551.
I revisited #2654 today, to see what I could to do make the message view nicer on Mimes brønn, but reading through this issue again leave me mystified about how to solve it. Is there some documentation somewhere explaining how to customize the original_message setting?
Hi Petter,
You can override the full method in your theme.
# THEME_ROOT/lib/model_patches.rb
# -*- encoding : utf-8 -*-
Rails.configuration.to_prepare do
InfoRequest.class_eval do
def self.remove_quoted_sections(text, replacement = "FOLDED_QUOTED_SECTION")
# method body omitted for demonstration
end
end
end
I tend to copy the full method from the commit you're deployed at, then you can make the change in 99aeb8ff1ed96bf437183e5513b6ac8db7927f77 against the overridden version in the theme.
Here's an example we've overridden in WDTK:
@petterreinholdtsen submitted https://github.com/mysociety/alaveteli/pull/2654 to add a quoted section marker in their language.
I don't see the benefit in continually adding additional strings to this method, as many of them will be irrelevant for a given install.
The particular markers are theme-specific, so we should supply an interface for them to be customised from a theme. This would have the benefit of reducing the performance cost of processing messages.
A nice interface to add markers would be something along the lines of:
Usage of the library in alaveteli core should look something like:
There also looks like some special handling for other UK-specific stuff.
It would be awesome if you could build up a filter chain for sanitising your messages: